コード例 #1
0
def test_map_box_32():  #{{{

    # Obtained by running amr2cube
    keys_min, keys_max = numpy.loadtxt(os.path.join(
        PWD, "hilbert_keys_test_32.dat"),
                                       unpack=True)
    levelmax = 13
    bbox_min = 3 * [0.45]
    bbox_max = 3 * [0.60]
    cpu_list = [
        1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 21, 22, 23,
        24, 25, 26, 27, 29, 30, 31, 32
    ]

    hdcp = hilbert.HilbertDomainDecomp(3, keys_min, keys_max, (0, levelmax))
    pymses_cpu_list = hdcp.map_box((bbox_min, bbox_max))
    assert numpy.all(pymses_cpu_list == numpy.array(cpu_list, 'i'))
コード例 #2
0
def oldtest_map_box_512():  #{{{

    # Obtained by running amr2cube
    keys_min, keys_max = numpy.loadtxt(os.path.join(
        PWD, "hilbert_keys_test_512.dat"),
                                       unpack=True)
    levelmax = 17
    bbox_min = [0.2, 0.3, 0.6]
    bbox_max = [0.23, 0.45, 0.67]
    cpu_list = [
        92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
        108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
        122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
        136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
        150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
        164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177,
        178, 179, 180, 181, 182, 183, 184, 185
    ]

    hdcp = hilbert.HilbertDomainDecomp(3, keys_min, keys_max, (0, levelmax))
    pymses_cpu_list = hdcp.map_box((bbox_min, bbox_max))
    print(pymses_cpu_list)
    print(cpu_list)
    assert numpy.all(pymses_cpu_list == numpy.array(cpu_list, 'i'))
コード例 #3
0
def test_map_box():  #{{{
    # Domain decomposition 5 process (Red, Violet, Green, Orange, Blue) on a 16ix16 grid
    #-----------------------------------------------------------------------------------

    ###########################################################################
    #    0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16    #
    # 16 .---------------------------------------------------------------. 16 #
    #    | G | G | G | G | G | G | G | G | G | G | O | O | O | O | O | O |    #
    # 15 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---| 15 #
    #    | G | G | G | G | G | G | G | G | G | O | O | O | O | O | O | O |    #
    # 14 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---| 14 #
    #    | G | G | G | G | G | G | G | G | G | G | O | O | O | O | O | O |    #
    # 13 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---| 13 #
    #    | V | G | G | G | G | G | G | G | G | G | O | O | O | O | O | O |    #
    # 12 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---| 12 #
    #    | V | V | V | V | G | G | G | G | G | G | G | G | O | O | O | O |    #
    # 11 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---| 11 #
    #    | V | V | V | V | G | G | G | G | G | G | G | G | O | O | O | O |    #
    # 10 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---| 10 #
    #    | V | V | V | V | G | G | G | G | G | G | G | G | O | O | O | O |    #
    #  9 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|  9 #
    #    | V | V | V | V | G | G | G | G | G | G | G | G | O | O | O | O |    #
    #  8 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|  8 #
    #    | V | V | V | V | V | V | V | V | O | O | O | O | O | O | O | O |    #
    #  7 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|  7 #
    #    | V | V | V | V | V | V | V | V | O | O | O | O | O | O | O | O |    #
    #  6 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|  6 #
    #    | V | V | V | V | R | R | V | V | O | O | B | B | O | O | O | O |    #
    #  5 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|  5 #
    #    | V | V | V | V | R | R | V | V | O | O | B | B | O | O | O | O |    #
    #  4 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|  4 #
    #    | R | R | R | R | R | R | R | R | B | B | B | B | B | B | B | B |    #
    #  3 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|  3 #
    #    | R | R | R | R | R | R | R | R | B | B | B | B | B | B | B | B |    #
    #  2 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|  2 #
    #    | R | R | R | R | R | R | R | R | B | B | B | B | B | B | B | B |    #
    #  1 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|  1 #
    #    | R | R | R | R | R | R | R | R | B | B | B | B | B | B | B | B |    #
    #  0 '---------------------------------------------------------------'  0 #
    #    0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16    #
    ###########################################################################
    ndim = 2
    cell_keymin = numpy.array([0.0, 36.0, 81.0, 151.0, 220.0])
    cell_keymax = numpy.array([36.0, 81.0, 151.0, 220.0, 256.0])
    nlevelmax = 4

    corner_keymin = cell_keymin * 2**ndim
    corner_keymax = cell_keymax * 2**ndim
    dd = hilbert.HilbertDomainDecomp(ndim, corner_keymin, corner_keymax,
                                     (1, nlevelmax))

    bbox_min = [0., 0.]
    bbox_max = [0.25, 0.25]
    cpu_list = [1]

    pymses_cpu_list = dd.map_box((bbox_min, bbox_max))
    assert numpy.all(pymses_cpu_list == numpy.array(cpu_list, 'i'))

    bbox_min = [0., 0.]
    bbox_max = [0.5, 0.5]
    cpu_list = [1, 2]

    pymses_cpu_list = dd.map_box((bbox_min, bbox_max))
    assert numpy.all(pymses_cpu_list == numpy.array(cpu_list, 'i'))

    bbox_min = [0.375, 0.375]
    bbox_max = [0.625, 0.625]
    cpu_list = [2, 3, 4]

    pymses_cpu_list = dd.map_box((bbox_min, bbox_max))
    assert numpy.all(pymses_cpu_list == numpy.array(cpu_list, 'i'))
コード例 #4
0
def test_minimal_domain():  #{{{
    # Domain decomposition 5 process (Red, Violet, Green, Orange, Blue) on a 16ix16 grid
    #-----------------------------------------------------------------------------------

    ###########################################################################
    #    0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16    #
    # 16 .---------------------------------------------------------------. 16 #
    #    | G | G | G | G | G | G | G | G | G | G | O | O | O | O | O | O |    #
    # 15 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---| 15 #
    #    | G | G | G | G | G | G | G | G | G | O | O | O | O | O | O | O |    #
    # 14 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---| 14 #
    #    | G | G | G | G | G | G | G | G | G | G | O | O | O | O | O | O |    #
    # 13 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---| 13 #
    #    | V | G | G | G | G | G | G | G | G | G | O | O | O | O | O | O |    #
    # 12 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---| 12 #
    #    | V | V | V | V | G | G | G | G | G | G | G | G | O | O | O | O |    #
    # 11 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---| 11 #
    #    | V | V | V | V | G | G | G | G | G | G | G | G | O | O | O | O |    #
    # 10 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---| 10 #
    #    | V | V | V | V | G | G | G | G | G | G | G | G | O | O | O | O |    #
    #  9 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|  9 #
    #    | V | V | V | V | G | G | G | G | G | G | G | G | O | O | O | O |    #
    #  8 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|  8 #
    #    | V | V | V | V | V | V | V | V | O | O | O | O | O | O | O | O |    #
    #  7 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|  7 #
    #    | V | V | V | V | V | V | V | V | O | O | O | O | O | O | O | O |    #
    #  6 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|  6 #
    #    | V | V | V | V | R | R | V | V | O | O | B | B | O | O | O | O |    #
    #  5 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|  5 #
    #    | V | V | V | V | R | R | V | V | O | O | B | B | O | O | O | O |    #
    #  4 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|  4 #
    #    | R | R | R | R | R | R | R | R | B | B | B | B | B | B | B | B |    #
    #  3 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|  3 #
    #    | R | R | R | R | R | R | R | R | B | B | B | B | B | B | B | B |    #
    #  2 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|  2 #
    #    | R | R | R | R | R | R | R | R | B | B | B | B | B | B | B | B |    #
    #  1 |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|  1 #
    #    | R | R | R | R | R | R | R | R | B | B | B | B | B | B | B | B |    #
    #  0 '---------------------------------------------------------------'  0 #
    #    0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16    #
    ###########################################################################
    ndim = 2
    cell_keymin = numpy.array([0.0, 36.0, 81.0, 151.0, 220.0])
    cell_keymax = numpy.array([36.0, 81.0, 151.0, 220.0, 256.0])
    nlevelmax = 4

    corner_keymin = cell_keymin * 2**ndim
    corner_keymax = cell_keymax * 2**ndim
    dd = hilbert.HilbertDomainDecomp(ndim, corner_keymin, corner_keymax,
                                     (1, nlevelmax))

    # Domain 0 #
    idomain = 0
    grids, orders, no = dd.minimal_domain(idomain, read_lmax=3)
    assert (grids * 2**nlevelmax == numpy.array([[2., 2.], [6., 2.],
                                                 [5., 5.]])).all()
    assert (2.**(4 - orders) == numpy.array([4., 4., 2.])).all()
    assert no == 0

    # Domain 1 #
    idomain = 1
    grids, orders, no = dd.minimal_domain(idomain, read_lmax=3)
    assert (grids * 2**nlevelmax == numpy.array([[2., 6.], [2., 10.], [7., 5.],
                                                 [5., 7.], [7., 7.],
                                                 [1., 13.]])).all()
    assert (2.**(4 - orders) == numpy.array([4., 4., 2., 2., 2., 2.])).all()
    assert no == 1

    # Domain 2 #
    idomain = 2
    grids, orders, no = dd.minimal_domain(idomain, read_lmax=3)
    assert (grids * 2**nlevelmax == numpy.array([[6., 10.], [6., 14.],
                                                 [10., 10.], [3., 13.],
                                                 [1., 15.], [3.,
                                                             15.], [9., 13.],
                                                 [1., 13.], [9., 15.]])).all()
    assert (2.**(4 - orders) == numpy.array(
        [4., 4., 4., 2., 2., 2., 2., 2., 2.])).all()
    assert no == 2

    # Domain 3 #
    idomain = 3
    grids, orders, no = dd.minimal_domain(idomain, read_lmax=3)
    assert (grids * 2**nlevelmax == numpy.array([[14., 6.], [14., 10.],
                                                 [14., 14.],
                                                 [9., 5.], [9., 7.], [11., 7.],
                                                 [11., 13.], [11., 15.],
                                                 [9., 15.]])).all()
    assert (2.**(4 - orders) == numpy.array(
        [4., 4., 4., 2., 2., 2., 2., 2., 2.])).all()
    assert no == 1

    # Domain 4 #
    idomain = 4
    grids, orders, no = dd.minimal_domain(idomain, read_lmax=3)
    assert (grids * 2**nlevelmax == numpy.array([[10., 2.], [14., 2.],
                                                 [11., 5.]])).all()
    assert (2.**(4 - orders) == numpy.array([4., 4., 2.])).all()
    assert no == 0
コード例 #5
0
def bluid_dset_with_overlap():
	###############################################
	#
	# Hydro rho value :
	#     
	#   .---------------------------------------------------------------.
	#   |               |       | 3 | 1 |       |       |               |
	#   |               |   1   |---|---|   4   |   4   |               |
	#   |               |       | 1 | 1 |       |       |               |
	#   |       1       |-------|-------|-------|-------|       6       |
	#   |               |       |       |       |       |               |
	#   |               |   1   |   2   |   4   |   4   |               |
	#   |               |       |       |       |       |               |
	#   |-------------------------------|---------------|---------------|
	#   |       |       |       |       | 4 | 5 |       |               |
	#   |   1   |   3   |   2   |   2   |---|---|   4   |               |
	#   |       |       |       |       | 4 | 4 |       |               |
	#   |-------|-------|-------|-------|---|---|-------|       6       |
	#   |       |       |       | 2 | 2 | 1 | 1 |       |               |
	#   |   1   |   1   |   2   |---|---|---|---|   4   |               |
	#   |       |       |       | 1 | 1 | 1 | 4 |       |               |
	#   |-------------------------------|-------------------------------|
	#   |       |       | 1 | 1 | 1 | 2 |       |       |               |
	#   |   2   |   2   |---|---|---|---|   4   |   4   |               |
	#   |       |       | 1 | 2 | 1 | 1 |       |       |               |
	#   |-------|-------|-------|-------|-------|-------|       6       |
	#   |       |       |       |       |       |       |               |
	#   |   2   |   2   |   2   |   1   |   4   |   4   |               |
	#   |       |       |       |       |       |       |               |
	#   |-------------------------------|---------------|---------------|
	#   |       |       |               |               |               |
	#   |   1   |   1   |               |               |               |
	#   |       |       |               |               |               |
	#   |-------|-------|       1       |       6       |       6       |
	#   |       |       |               |               |               |
	#   |   1   |   1   |               |               |               |
	#   |       |       |               |               |               |
	#   .---------------------------------------------------------------.
	#      ^              ^           ^       ^ 
	#      |              |           |       |
	# ray  0              1           2       3
	# Block with rho value 1 and 2 and 3 belongs to cpu (or dset) 1
	# Block with rho value 4 and 5 and 6 belongs to cpu (or dset) 2
	################################################
	
	
	
	
	
	ndim = 2
	simulation_level_max = 4 # max / data structure
	read_level_max = 4 # max / reading level (user can set depthmax < simulation_level_max to go faster)
	ncpu = 2
	
	# Define the HilbertDomainDecomp needed with the dset to do the ray tracing
	info = {}
	cell_keymin = numpy.array([0.0, 131.0]) # 131 = 128 + 3 additional blocks for cpu 1
	cell_keymax = numpy.array([131.0, 256.0])
	corner_keymin = cell_keymin * 2**ndim
	corner_keymax = cell_keymax * 2**ndim
	dd = hilbert.HilbertDomainDecomp(ndim, corner_keymin, corner_keymax, (1,simulation_level_max))
	info["dom_decomp"] = dd
	grids, orders, no = dd.minimal_domain(0, read_lmax=4)
	assert (grids == numpy.array([[ 0.25,    0.25   ],
								  [ 0.25,    0.75   ],
								  [ 0.53125, 0.53125],
								  [ 0.53125, 0.59375],
								  [ 0.59375, 0.59375]])).all()
	assert (orders == numpy.array([1,1,4,4,4])).all()
	assert no == 0
	
	# Define a ramses amr octree test dset 1
	
	header = {}
	header["ndim"] = ndim
	header["levelmax"] = simulation_level_max
	header["noutputs"] = 1
	header["ncpu"] = ncpu
	header["ncoarse"] = 1
	header["boxlen"] = 1.0
	struct = {}
	struct["ndim"] = ndim
	struct["twotondim"] = 2**ndim
	struct["ngrids"] = 18
	struct["readlmax"] = read_level_max
	struct["levelmax"] = simulation_level_max
	struct["son_indices"] = numpy.array([[1,-1,2,3],\
		[4,-1,5,6],[7,8,-1,9],[10,-1,11,-1],\
		[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,12,13],[-1,-1,-1,-1],[-1,14,-1,-1],[-1,-1,-1,15],[16,-1,17,-1],[-1,-1,-1,-1],\
		[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1]], 'i')
	struct["grid_centers"] = numpy.array([[0.5,0.5],\
		[0.25,0.25],[0.25,0.75],[0.75,0.75],\
		[0.125,0.125],[0.125,0.375],[0.375,0.375],[0.125,0.625],[0.375,0.625],[0.375,0.875],[0.625,0.625],[0.625,0.875],\
		[0.3125,0.4375],[0.4375,0.4375],[0.4375,0.5625],[0.4375,0.9375],[0.5625,0.5625],[0.5625,0.6875]])
	struct["ncpu"] = ncpu
	struct["ngridlevel"] = numpy.array([[1,2,7,5],[0,1,1,1]], 'i')
	struct["ngridbound"] = numpy.zeros((0,simulation_level_max), 'i')
	struct["grid_indices"] = numpy.array(list(range(struct["ngrids"])), 'i')
	amr_dicts = (header,struct)
	dset_1 = RamsesOctreeDataset(amr_dicts)
	dset_1.icpu = 0
	
	# Add the hydro rho data to the dset 1
	dset_1.add_scalars("rho",numpy.array([[1,5,2,5],\
		[1,1,2,1],[1,2,1,2],[4,6,4,6],\
		[1,1,1,1],[2,2,2,2],[2,1,1,1],[1,1,1,3],[2,2,2,2],[1,2,1,2],[2,4,4,4],[4,4,4,4],\
		[1,2,1,1],[1,1,1,2],[1,1,2,2],[1,1,3,1],[1,4,1,1],[4,4,4,5]]))
	
	# Define the ramses amr octree test dset 2
	header = {}
	header["ndim"] = ndim
	header["levelmax"] = simulation_level_max
	header["noutputs"] = 2
	header["ncpu"] = ncpu
	header["ncoarse"] = 1
	header["boxlen"] = 1.0
	struct = {}
	struct["ndim"] = ndim
	struct["twotondim"] = 2**ndim
	struct["ngrids"] = 4
	struct["readlmax"] = read_level_max
	struct["levelmax"] = simulation_level_max
	struct["son_indices"] = numpy.array([[-1,1,-1,2],[-1,-1,-1,-1],[-1,-1,-1,3],[-1,-1,-1,-1]], 'i')
	struct["grid_centers"] = numpy.array([[0.5,0.5],[0.75,0.25],[0.75,0.75],[0.875,0.875]])
	struct["ncpu"] = ncpu
	struct["ngridlevel"] = numpy.array([[0,0,0],[1,2,1]], 'i') # 1 lvl 1 block, 2 lvl 2 blocks and 1 lvl 3 block
	struct["ngridbound"] = numpy.zeros((0,simulation_level_max), 'i')
	struct["grid_indices"] = numpy.array(list(range(struct["ngrids"])), 'i')
	amr_dicts = (header,struct)
	dset_2 = RamsesOctreeDataset(amr_dicts)
	dset_2.icpu = 1
	
	# Add the hydro rho data to the dset 2
	dset_2.add_scalars("rho",numpy.array([[1,2,3,4.0625],[2,2,2,2],[4,4,4,4.25],[4,4,4,5]]))
	
	return (dset_1, dset_2, info)
コード例 #6
0
def bluid_simple_dset(various_value = False):
	###############################################
	#
	# Hydro rho value :
	#     
	#   .-------------------------------.
	#   |       |       |       | 4 | 5 |
	#   |   3   |   3   |   4   |---|---|
	#   |       |       |       | 4 | 4 |
	#   |-------|-------|-------|-------|
	#   |       |       |       |       |
	#   |   3   |   3   |   4   |   4   |
	#   |       |       |       |       |
	#   |-------------------------------|
	#   |       |       |       |       |
	#   |   1   |   1   |   2   |   2   |
	#   |       |       |       |       |
	#   |-------|-------|-------|-------|
	#   |       |       |       |       |
	#   |   1   |   1   |   2   |   2   |
	#   |       |       |       |       |
	#   |-------------------------------|
	#
	# Block with rho value 1 and 3 belongs to cpu (or dset) 1
	# Block with rho value 2 and 4 and 5 belongs to cpu (or dset) 2
	################################################
	
	ndim = 2
	simulation_level_max = 3 # max / data structure
	read_level_max = 3 # max / reading level (user can set depthmax < simulation_level_max to go faster) = amr_struct.readlmax
	ncpu = 2
	
	# Define the HilbertDomainDecomp needed with the dset to do the ray tracing
	info = {}
	cell_keymin = numpy.array([0.0, 32.0])
	cell_keymax = numpy.array([32.0, 64.0])
	corner_keymin = cell_keymin * 2**ndim
	corner_keymax = cell_keymax * 2**ndim
	dd = hilbert.HilbertDomainDecomp(ndim, corner_keymin, corner_keymax, (1,simulation_level_max))
	info["dom_decomp"] = dd
	
	# Define a ramses amr octree test dset 1
	
	header = {}
	header["ndim"] = ndim
	header["levelmax"] = simulation_level_max
	header["noutputs"] = 1
	header["ncpu"] = ncpu
	header["ncoarse"] = 1
	header["boxlen"] = 1.0
	struct = {}
	struct["ndim"] = ndim
	struct["twotondim"] = 2**ndim
	struct["ngrids"] = 3
	struct["readlmax"] = read_level_max
	struct["levelmax"] = simulation_level_max
	struct["son_indices"] = numpy.array([[1,-1,2,-1],[-1,-1,-1,-1],[-1,-1,-1,-1]], 'i')
	struct["grid_centers"] = numpy.array([[0.5,0.5],[0.25,0.25],[0.25,0.75]])
	struct["ncpu"] = ncpu
	struct["ngridlevel"] = numpy.array([[1,2,0],[0,0,0]], 'i') # 1 lvl 1 block, 2 lvl 2 blocks and 0 lvl 3 block
	struct["ngridbound"] = numpy.zeros((0,simulation_level_max), 'i') # not used??
	struct["grid_indices"] = numpy.array(list(range(struct["ngrids"])), 'i') # utility?
	amr_dicts = (header,struct)
	dset_1 = RamsesOctreeDataset(amr_dicts)
	dset_1.icpu = 0
	
	# Add the hydro rho data to the dset 1
	if various_value:
		dset_1.add_scalars("rho",numpy.array([[0.1,0.2,0.4,0.8],[0.01,0.02,0.04,0.08],[0.0001,0.0002,0.0004,0.0008]]))
	else:
		dset_1.add_scalars("rho",numpy.array([[1,2,3,4.0625],[1,1,1,1],[3,3,3,3]]))
	
	# Define the ramses amr octree test dset 2
	header = {}
	header["ndim"] = ndim
	header["levelmax"] = simulation_level_max
	header["noutputs"] = 2
	header["ncpu"] = ncpu
	header["ncoarse"] = 1
	header["boxlen"] = 1.0
	struct = {}
	struct["ndim"] = ndim
	struct["twotondim"] = 2**ndim
	struct["ngrids"] = 4
	struct["readlmax"] = read_level_max
	struct["levelmax"] = simulation_level_max
	struct["son_indices"] = numpy.array([[-1,1,-1,2],[-1,-1,-1,-1],[-1,-1,-1,3],[-1,-1,-1,-1]], 'i')
	struct["grid_centers"] = numpy.array([[0.5,0.5],[0.75,0.25],[0.75,0.75],[0.875,0.875]])
	struct["ncpu"] = ncpu
	struct["ngridlevel"] = numpy.array([[0,0,0],[1,2,1]], 'i') # 1 lvl 1 block, 2 lvl 2 blocks and 1 lvl 3 block
	struct["ngridbound"] = numpy.zeros((0,simulation_level_max), 'i') # not used??
	struct["grid_indices"] = numpy.array(list(range(struct["ngrids"])), 'i') # utility?
	amr_dicts = (header,struct)
	dset_2 = RamsesOctreeDataset(amr_dicts)
	dset_2.icpu = 1
	
	# Add the hydro rho data to the dset 2
	# Note that amr cells order in a block is:
	#   .-------.
	#   | 3 | 4 |
	#   |---|---|
	#   | 1 | 2 |
	#   .-------.
	if various_value:
		dset_2.add_scalars("rho",numpy.array([[0.1,0.2,0.4,0.8],[0.001,0.002,0.004,0.008],[0.00001,0.00002,0.00004,0.00008],[0.000001,0.000002,0.000004,0.000008]]))
	else:
		dset_2.add_scalars("rho",numpy.array([[1,2,3,4.0625],[2,2,2,2],[4,4,4,4.25],[4,4,4,5]]))
	
	return (dset_1, dset_2, info)