Skip to content

Commit 53729a5

Browse files
authored
Add support of bisection decomposition in the test suite (#220)
<!-- Thank you so much for your contribution! --> <!-- First describe what your PR is doing. --> This PR fixes the issue #72 Thanks to @cphyc for the help and for adapting Yt to add support on this bisection decomposition (see yt-project/yt#5340)
1 parent 04c1009 commit 53729a5

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

tests/visu/visu_ramses.py

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -225,19 +225,32 @@ def load_snapshot(nout, read_hydro=True, read_grav=False, read_rt=False):
225225
offset = 4*ninteg + 8*(nlines+nfloat) + nstrin + nquadr*16 + 4
226226
ngridlevel[info["ncpu"]:info["ncpu"]+nboundary,:] = np.asarray(struct.unpack("%ii"%(nboundary*info["levelmax"]), amrContent[offset:offset+4*nboundary*info["levelmax"]])).reshape(info["levelmax"],nboundary).T
227227

228-
# Determine bound key precision
229-
ninteg = 14+(3*info["ncpu"]*info["levelmax"])+(10*info["levelmax"])+(3*nboundary*info["levelmax"])+5
230-
nfloat = 18+(2*noutput)+(2*info["levelmax"])
231-
nlines = 21+2+3*min(1,nboundary)+1+1
232-
nstrin = 128
233-
nquadr = 0
234-
offset = 4*ninteg + 8*(nlines+nfloat) + nstrin + nquadr*16
235-
key_size = struct.unpack("i", amrContent[offset:offset+4])[0]
228+
# Depending on the ordering type, we have two different cases
229+
if(info["ordering type"] == "bisection"):
230+
nbinodes = 2**(math.ceil(math.log(float(info["ncpu"]))/math.log(2.0))+1)-1
231+
ninteg_ordering = 3*nbinodes
232+
nfloat_ordering = nbinodes+2*info["ncpu"]*info["ndim"]
233+
nlines_ordering = 5
234+
key_size = 0
235+
else:
236+
nbinodes = 0
237+
ninteg_ordering = 0
238+
nfloat_ordering = 0
239+
nlines_ordering = 1
240+
241+
# Determine bound key precision
242+
ninteg = 14+(3*info["ncpu"]*info["levelmax"])+(10*info["levelmax"])+(3*nboundary*info["levelmax"])+5
243+
nfloat = 18+(2*noutput)+(2*info["levelmax"])
244+
nlines = 21+2+3*min(1,nboundary)+1+1
245+
nstrin = 128
246+
nquadr = 0
247+
offset = 4*ninteg + 8*(nlines+nfloat) + nstrin + nquadr*16
248+
key_size = struct.unpack("i", amrContent[offset:offset+4])[0]
236249

237250
# Offset for AMR
238-
ninteg1 = 14+(3*info["ncpu"]*info["levelmax"])+(10*info["levelmax"])+(3*nboundary*info["levelmax"])+5+3*ncoarse
239-
nfloat1 = 18+(2*noutput)+(2*info["levelmax"])
240-
nlines1 = 21+2+3*min(1,nboundary)+1+1+1+3
251+
ninteg1 = 14+(3*info["ncpu"]*info["levelmax"])+(10*info["levelmax"])+(3*nboundary*info["levelmax"])+5+ninteg_ordering+3*ncoarse
252+
nfloat1 = 18+(2*noutput)+(2*info["levelmax"])+nfloat_ordering
253+
nlines1 = 21+2+3*min(1,nboundary)+1+1+nlines_ordering+3
241254
nstrin1 = 128 + key_size
242255

243256
# Offset for HYDRO

0 commit comments

Comments
 (0)