a2 = G.cartTetra((10., 0., 0.), (1., 1., 1), (10, 10, 10)) a1 = C.initVars(a1, 'F', 2) a1 = C.initVars(a1, 'centers:G', 1) a2 = C.initVars(a2, 'F', 3) a2 = C.initVars(a2, 'centers:G', 3) t = C.newPyTree(['Base', 3]) a = T.join(a1, a2) t[2][1][2].append(a) test.testT(t, 1) # mix struct 3D + HEXA a1 = G.cart((0., 0., 0.), (1., 1., 1), (11, 11, 10)) a1 = C.addBC2Zone(a1, 'wall', 'BCWall', 'imin') a1 = C.addBC2Zone(a1, 'ov', 'BCOverlap', 'imax') a1 = C.addBC2Zone(a1, 'match1', 'BCMatch', 'jmin', a1, 'jmax') a2 = G.cartHexa((10., 0., 0.), (1., 1., 1), (11, 11, 10)) a1 = C.initVars(a1, 'F', 2) a1 = C.initVars(a1, 'centers:G', 1) a2 = C.initVars(a2, 'F', 3) a2 = C.initVars(a2, 'centers:G', 3) t = C.newPyTree(['Base', 3]) a = T.join(a1, a2) t[2][1][2].append(a) test.testT(t, 2) # Join 2 NON-STRUCT PENTA a1 = G.cartPenta((0., 0., 0.), (1., 1., 1), (11, 11, 10)) a2 = G.cartPenta((10., 0., 0.), (1., 1., 1), (10, 10, 10)) a1 = C.initVars(a1, 'F', 2) a1 = C.initVars(a1, 'centers:G', 1) a2 = C.initVars(a2, 'F', 3)
# t = C.newPyTree(['Base']) t[2][1][2].append(a1) t[2][1][2].append(a2) t[2][1][2].append(T.join(t[2][1][2])) test.testT(t, 2) # # Join sur un arbre # t = C.newPyTree(['Base']) t[2][1][2].append(a1) t[2][1][2].append(a2) z = T.join(t) t = C.newPyTree(['Base']) t[2][1][2].append(z) test.testT(t, 3) # # Join 2 NGON issus d'un TETRA et d'un HEXA a1 = G.cartHexa((0., 0., 0.), (1., 1., 1), (11, 11, 10)) a1 = C.convertArray2NGon(a1) a1 = C.initVars(a1, 'F', 2.) a1 = C.initVars(a1, 'centers:G', 1) a2 = G.cartTetra((10., 0., 0.), (1., 1., 1), (10, 10, 10)) a2 = C.convertArray2NGon(a2) a2 = C.initVars(a2, 'F', 3.) a2 = C.initVars(a2, 'centers:G', 3) a = T.join(a1, a2) t = C.newPyTree(['Base']) t[2][1][2].append(a) test.testT(t, 4)
import Converter.PyTree as C import Connector.PyTree as X import Generator.PyTree as G import Transform.PyTree as T import KCore.test as test def sphere(x, y, z): if x * x + y * y + z * z < 0.5**2: return 0. else: return 1. # # Champ en noeuds non structure HEXA # a = G.cartHexa((-2., -1., -1.), (0.1, 0.1, 0.1), (21, 21, 21)) b = T.translate(a, (2, 0, 0)) b[0] = 'cart2' t = C.newPyTree(['Cart', a, b]) t = C.initVars(t, 'Density', 1.) t = C.initVars(t, 'cellN', sphere, ['CoordinateX', 'CoordinateY', 'CoordinateZ']) nod = 1 for d in [-2, -1, 0, 1, 2, 5]: t2 = X.setHoleInterpolatedPoints(t, depth=d, loc='nodes') test.testT(t2, nod) nod += 1 # Champ cellN en centres a = G.cartHexa((-2., -1., -1.), (0.1, 0.1, 0.1), (21, 21, 21)) b = T.translate(a, (2, 0, 0))
C._initVars(d,'F={CoordinateX}') C._initVars(d,'centers:G={centers:CoordinateY}') d = T.subzone(d, facesL, type='faces') test.testT(d,1) # 3D Tetra N = 51 d = G.cartTetra((0,0,0), (1,1,1),(N,N,N)) facesL=[] for i in xrange(1,N*N): facesL.append(i+1) C._initVars(d,'F={CoordinateX}') C._initVars(d,'centers:G={centers:CoordinateY}') d = T.subzone(d, facesL, type='faces') test.testT(d,2) # 3D Hexa N = 51 d = G.cartHexa((0,0,0), (1,1,1),(N,N,N)) facesL=[] for i in xrange(1,N*N): facesL.append(i+1) C._initVars(d,'F={CoordinateX}') C._initVars(d,'centers:G={centers:CoordinateY}') d = T.subzone(d, facesL, type='faces') test.testT(d,3) # 2D quad N = 51 d = G.cartHexa((0,0,0), (1,1,1),(N,N,1)) facesL=[] for i in xrange(N): facesL.append(i+1) C._initVars(d,'F={CoordinateX}') C._initVars(d,'centers:G={centers:CoordinateY}') d = T.subzone(d, facesL, type='faces')
# - mergeConnectivity (pyTree) - import Converter.PyTree as C import Generator.PyTree as G import Converter.Internal as Internal import KCore.test as test a = G.cartHexa((0, 0, 0), (1, 1, 1), (10, 10, 10)) b = G.cartHexa((0, 0, 0), (1, 1, 1), (10, 10, 1)) # merge boundary connectivity c = C.mergeConnectivity(a, b, boundary=1) test.testT(c, 1) # merge element connectivity b = G.cartTetra((0, 0, 9), (1, 1, 1), (10, 10, 10)) c = C.mergeConnectivity(a, b, boundary=0) test.testO(c, 2)
t = C.convertArray2Tetra(t) test.testT(t, 2) # Sur une liste de zones a = G.cart((0., 0., 0.), (0.1, 0.1, 0.2), (10, 10, 5)) b = G.cart((10, 0., 0.), (0.1, 0.1, 0.2), (10, 10, 5)) a = C.initVars(a, 'F', 1.) a = C.initVars(a, 'centers:G', 2.) a = C.addBC2Zone(a, 'wall1', 'BCWall', 'imin') A = C.convertArray2Tetra([a, b]) t = C.newPyTree(['Base']) t[2][1][2] = t[2][1][2] + A test.testT(t, 3) # Sur un HEXA a = G.cartHexa((0., 0., 0.), (0.1, 0.1, 0.2), (10, 10, 5)) a = C.initVars(a, 'F={CoordinateX}') a = C.initVars(a, 'centers:G={CoordinateY}') a = C.convertArray2Tetra(a) t = C.newPyTree(['Base', a]) test.testT(t, 4) # Sur un QUAD a = G.cartHexa((0., 0., 0.), (0.1, 0.1, 0.2), (10, 10, 1)) a = C.initVars(a, 'F={CoordinateX}') a = C.initVars(a, 'centers:G={CoordinateY}') a = C.convertArray2Tetra(a) t = C.newPyTree(['Base', 2]) t[2][1][2].append(a) test.testT(t, 5)
a = C.convertArray2Tetra(a) b = G.cart((1.1, -0.1, -0.1), (0.1, 0.1, 0.1), (1, 5, 5)) b = C.initVars(b, 'F', 2.) b = C.initVars(b, 'centers:G', 1.) b = G.getNormalMap(b) b = C.center2Node(b, ['centers:sx', 'centers:sy', 'centers:sz']) c = T.projectAllDirs(b, a, ['sx', 'sy', 'sz']) c[0] = 'projection' t = C.newPyTree(['Base', 2]) t[2][1][2] += [c, b] test.testT(t, 3) # NS/NS a = D.sphere((0, 0, 0), 1., 20) a = C.convertArray2Tetra(a) b = G.cartHexa((1.1, -0.1, -0.1), (0.1, 0.1, 0.1), (1, 5, 5)) b = C.initVars(b, 'F', 2.) b = C.initVars(b, 'centers:G', 1.) b = G.getNormalMap(b) b = C.center2Node(b, ['centers:sx', 'centers:sy', 'centers:sz']) c = T.projectAllDirs(b, a, ['sx', 'sy', 'sz']) c[0] = 'projection' t = C.newPyTree(['Base', 2]) t[2][1][2] += [c, b] test.testT(t, 4) # sur un arbre t = C.newPyTree(['Base', 2]) t[2][1][2] += [a] tp = C.newPyTree(['Proj', 2]) tp[2][1][2] += [b]
C._initVars(a, 'centers:cellN', 1) a = C.addBC2Zone(a, 'wall', 'BCWall', 'imin') a = C.addBC2Zone(a, 'overlap', 'BCOverlap', 'jmin') a = C.addBC2Zone(a, 'match1', 'BCMatch', 'imax', a, 'imin', [1, 2]) a = T.contract(a, (0., 0., 0.), (1, 0, 0), (0, 1, 0), 0.1) test.testT(a, 2) # TETRA a = G.cartTetra((0, 0, 0), (1, 1, 1), (10, 10, 3)) C._addVars(a, 'Density') C._initVars(a, 'centers:cellN', 1) a = T.contract(a, (0., 0., 0.), (1, 0, 0), (0, 1, 0), 0.1) test.testT(a, 3) # HEXA a = G.cartHexa((0, 0, 0), (1, 1, 1), (10, 10, 3)) C._addVars(a, 'Density') C._initVars(a, 'centers:cellN', 1) a = T.contract(a, (0., 0., 0.), (1, 0, 0), (0, 1, 0), 0.1) test.testT(a, 4) # TRI a = G.cartTetra((0, 0, 0), (1, 1, 1), (10, 10, 1)) C._addVars(a, 'Density') C._initVars(a, 'centers:cellN', 1) a = T.contract(a, (0., 0., 0.), (1, 0, 0), (0, 1, 0), 0.1) test.testT(a, 5) # QUAD a = G.cartHexa((0, 0, 0), (1, 1, 1), (10, 10, 1)) C._addVars(a, 'Density')
# - addBC2Zone (pyTree) - import Converter.PyTree as C import Generator.PyTree as G import KCore.test as test # - Non structure a elements basiques - # Ajoute la connectivite BC + la BC par element range a = G.cartHexa((2, 0, 0), (0.1, 0.1, 1), (10, 10, 10)) b = G.cartHexa((2, 0, 0), (0.1, 0.1, 1), (10, 10, 1)) a = C.mergeConnectivity(a, b, boundary=1) a = C.addBC2Zone(a, 'wall', 'BCWall', elementRange=[730, 810]) test.testT(a, 1) # Ajout par une subzone a = G.cartHexa((2, 0, 0), (0.1, 0.1, 1), (10, 10, 10)) b = G.cartHexa((2, 0, 0), (0.1, 0.1, 1), (10, 10, 1)) a = C.addBC2Zone(a, 'wall', 'BCWall', subzone=b) test.testT(a, 2) # Match : element range a = G.cartHexa((0, 0, 0), (0.1, 0.1, 0.1), (11, 11, 11)) b = G.cartHexa((1, 0, 0), (0.1, 0.1, 0.1), (1, 11, 11)) a = C.mergeConnectivity(a, b, boundary=1) a2 = G.cartHexa((1, 0, 0), (0.1, 0.1, 0.1), (11, 11, 11)) a2 = C.mergeConnectivity(a2, b, boundary=1) a = C.addBC2Zone(a, 'match', 'BCMatch', elementRange=[1001, 1100], zoneDonor=a2, elementRangeDonor=[1001, 1100])
t[2][1][2] += [res] test.testT(t) # NGON 2D contenant des faces externes a = D.sphere((0, 0, 0), 1., 15) a = T.subzone(a, (1, 1, 1), (15, 15, 1)) a = C.convertArray2NGon(a) a = G.close(a) a = C.initVars(a, 'F', 1.) res = T.dual(a) t = C.newPyTree(['Base']) t[2][1][2] += [res] test.testT(t, 2) # NGON 3D a = G.cartHexa((0, 0, 0), (1, 1, 1), (11, 11, 11)) a = C.convertArray2NGon(a) a = G.close(a) res = T.dual(a) t = C.newPyTree(['Base']) t[2][1][2] += [res] test.testT(t, 3) a = G.cartTetra((0, 0, 0), (1, 1, 1), (11, 11, 11)) a = C.convertArray2NGon(a) a = G.close(a) res = T.dual(a) t = C.newPyTree(['Base']) t[2][1][2] += [res] test.testT(t, 4)
# BC referencees par des familles a = G.cart((0., 0., 0), (0.01, 0.01, 1.), (20, 20, 2)) a = C.addBC2Zone(a, 'walla', 'FamilySpecified:CARTER', 'imin') a = C.addBC2Zone(a, 'nref', 'FamilySpecified:LOIN', 'imax') t = C.newPyTree(['Base']) t[2][1][2] += [a] t[2][1] = C.addFamily2Base(t[2][1], 'CARTER', bndType='BCWall') t[2][1] = C.addFamily2Base(t[2][1], 'LOIN', bndType='BCFarfield') zones = C.extractBCOfType(t, 'BCWall') t = C.newPyTree(['Base']) t[2][1][2] += zones test.testT(t, 4) # BC sur un NGON a = G.cartNGon((0, 0, 0), (1, 1, 1), (10, 10, 10)) subzone = G.cartNGon((0, 0, 0), (1, 1, 1), (10, 10, 1)) hook = C.createHook(a, function='faceCenters') ids = C.identifyElements(hook, subzone) a = C.addBC2Zone(a, 'wall', 'BCWall', faceList=ids) ext = C.extractBCOfType(a, 'BCWall') test.testT(ext, 5) # BC sur un basic elements a = G.cartHexa((0, 0, 0), (1, 1, 1), (5, 5, 5)) subzone = G.cartHexa((0, 0, 0), (1, 1, 1), (5, 5, 1)) hook = C.createHook(a, function='faceCenters') ids = C.identifyElements(hook, subzone) a = C.addBC2Zone(a, 'wall', 'BCWall', faceList=ids) ext = C.extractBCOfType(a, 'BCWall') test.testT(ext, 6)
import Generator.PyTree as G import Converter.PyTree as C import Converter.Internal as Internal import numpy ns = 200 a = G.cart((0, 0, 0), (1, 1, 1), (ns, ns, ns)) # Get an array2 from a x1 = Internal.getNodeFromName2(a, 'CoordinateX') x2 = Internal.getNodeFromName2(a, 'CoordinateY') x3 = Internal.getNodeFromName2(a, 'CoordinateZ') b = ['x,y,z', [x1[1], x2[1], x3[1]], ns, ns, ns] #KCore.tester(b) a = G.cartHexa((0, 0, 0), (1, 1, 1), (ns, ns, ns)) # Get an array2 from a x1 = Internal.getNodeFromName2(a, 'CoordinateX') x2 = Internal.getNodeFromName2(a, 'CoordinateY') x3 = Internal.getNodeFromName2(a, 'CoordinateZ') c1 = Internal.getNodeFromName2(a, 'ElementConnectivity') c1 = c1[1].reshape((8, (ns - 1) * (ns - 1) * (ns - 1))) # cool b = ['x,y,z', [x1[1], x2[1], x3[1]], [c1], 'HEXA'] KCore.tester(b) a = G.cartNGon((0, 0, 0), (1, 1, 1), (ns, ns, ns)) C.convertPyTree2File(a, 'out.cgns') # Get an array2 from a x1 = Internal.getNodeFromName2(a, 'CoordinateX') x2 = Internal.getNodeFromName2(a, 'CoordinateY') x3 = Internal.getNodeFromName2(a, 'CoordinateZ')
# - adapts a cells with respect to b points (PyTree) - import Intersector.PyTree as XOR import Converter.PyTree as C import Generator.PyTree as G import KCore.test as test a = G.cartHexa((0., 0., 0.), (0.1, 0.1, 0.1), (5, 5, 5)) a = C.convertArray2Tetra(a, split='withBarycenters') a = C.convertArray2NGon(a) a = G.close(a) #C.convertArrays2File([a], 'a.plt') b = G.cartHexa((0., 0., 0.), (0.005, 0.005, 0.005), (5, 5, 5)) #C.convertArrays2File([b], 'b.plt') m = XOR.adaptCells(a, b, sensor_type=0) m = XOR.closeOctalCells(m) test.testT(m, 1) m = XOR.adaptCells(a, b, sensor_type=1) m = XOR.closeOctalCells(m) C.convertPyTree2File(m, 'out.cgns') test.testT(m, 2)
# - getBCs (pyTree) - import Converter.PyTree as C import Generator.PyTree as G import KCore.test as test a = G.cart((0,0,0),(1,1,1),(10,10,2)) a = C.addBC2Zone(a, 'overlap', 'BCOverlap', 'imin') a = C.addBC2Zone(a, 'match1', 'BCMatch', 'jmin', a, 'jmax', [1,2,3]) a = C.fillEmptyBCWith(a, 'wall', 'BCWall', dim=2) (BCs,BCNames,BCTypes) = C.getBCs(a) test.testO(BCNames, 1) a = G.cartHexa((0,0,0),(1,1,1),(10,10,2)) a = C.addBC2Zone(a, 'wall', 'BCWall', faceList=[1,2]) (BCs,BCNames,BCTypes) = C.getBCs(a) test.testO(BCNames, 2) a = G.cartNGon((0,0,0),(1,1,1),(10,10,2)) a = C.addBC2Zone(a, 'wall', 'BCWall', faceList=[1,2]) (BCs,BCNames,BCTypes) = C.getBCs(a) test.testO(BCNames, 3)
# - adapt the bounding box of a point cloud (array) - import Intersector.PyTree as XOR import Converter.PyTree as C import Generator.PyTree as G import KCore.test as test a = G.cartHexa((0.,0.,0.), (0.1,0.1,0.1), (5,5,5)) a = C.convertArray2NGon(a); a = G.close(a) m = XOR.adaptBox(a, box_ratio=10.) m = XOR.closeOctalCells(m) test.testT(m,1)
# - convertPyTree2Array (pyTree) - import Converter.PyTree as C import Generator.PyTree as G import KCore.test as test import Converter a = G.cart((0., 0., 0.), (0.1, 0.1, 0.1), (11, 11, 11)) a = C.initVars(a, 'F', 1.) a = C.initVars(a, 'centers:G', 2.) a = C.addBC2Zone(a, 'wall1', 'BCWall', 'imin') b = G.cartHexa((0., 0., 0.), (0.1, 0.1, 0.1), (11, 11, 11)) b[0] = 'cartHexa' t = C.newPyTree(['Base']) t[2][1][2] = t[2][1][2] + [a, b] t[2][1] = C.addState(t[2][1], 'Mach', 0.6) zones = C.convertPyTree2ZoneNames(t) # 1 - Get one field arrays = [] for i in zones: a = C.convertPyTree2Array(i + "/GridCoordinates/CoordinateX", t) b = C.convertPyTree2Array(i + "/GridCoordinates/CoordinateY", t) c = C.convertPyTree2Array(i + "/GridCoordinates/CoordinateZ", t) x = Converter.addVars([a, b, c]) arrays.append(x) test.testA(arrays, 1) # 2 - Get a global field arrays = [] for i in zones: a = C.convertPyTree2Array(i + "/GridCoordinates", t) arrays.append(a)
# - convertPyTree2Array (pyTree) - import Converter.PyTree as C import Generator.PyTree as G import Converter a = G.cart((0.,0.,0.),(0.1,0.1,0.1),(11,11,11)) a = C.initVars(a,'F',1.); a = C.initVars(a,'centers:G',2.) a = C.addBC2Zone(a, 'wall1', 'BCWall', 'imin') b = G.cartHexa((0.,0.,0.),(0.1,0.1,0.1),(11,11,11)); b[0] = 'cartHexa' t = C.newPyTree(['Base']); t[2][1][2] = t[2][1][2] + [a,b] t[2][1] = C.addState(t[2][1], 'Mach', 0.6) zones = C.convertPyTree2ZoneNames(t) # 1 - Get one field arrays = [] for i in zones: a = C.convertPyTree2Array(i+"/GridCoordinates/CoordinateX", t) b = C.convertPyTree2Array(i+"/GridCoordinates/CoordinateY", t) c = C.convertPyTree2Array(i+"/GridCoordinates/CoordinateZ", t) x = Converter.addVars([a,b,c]) arrays.append(x) Converter.convertArrays2File(arrays, "out.plt") # 2 - Get a global field arrays = [] for i in zones: a = C.convertPyTree2Array(i+"/GridCoordinates", t) arrays.append(a) Converter.convertArrays2File(arrays, "out2.plt")
# - isoSurfMC (pyTree) - import Post.PyTree as P import Converter.PyTree as C import Generator.PyTree as G a = G.cartHexa( (-20,-20,-20), (0.5,0.5,0.5), (50,50,50)) a = C.initVars(a, 'field={CoordinateX}*{CoordinateX}+{CoordinateY}*{CoordinateY}+{CoordinateZ}') iso = P.isoSurfMC(a, 'field', value=5.) C.convertPyTree2File(iso, 'out.cgns')
# 2D array a = G.cart((0,0,0), (1,1,1), (10,6,1)) b = P.exteriorFaces(a) test.testT(b,2) # 3D array a = G.cart((0,0,0), (1,1,1), (4,4,6)) b = P.exteriorFaces(a) test.testT(b,3) # TRI a = G.cartTetra((0,0,0), (1,1,1), (20,3,1)) b = P.exteriorFaces(a) test.testT(b,4) # QUAD a = G.cartHexa((0,0,0), (1,1,1), (20,3,1)) b = P.exteriorFaces(a) test.testT(b,5) # TETRA a = G.cartTetra((0,0,0), (1,1,1), (3,3,3)) b = P.exteriorFaces(a) test.testT(b,6) # HEXA a = G.cartHexa((0,0,0), (1,1,1), (3,3,3)) b = P.exteriorFaces(a) test.testT(b,7)
# - replace (pyTree) - import Generator.PyTree as G import CPlot.PyTree as CPlot import Converter.PyTree as C import time dt = 0.2 a = G.cart((0, 0, 0), (1, 1, 1), (30, 30, 30)) b = G.cartHexa((0, 0, 40), (1, 1, 1), (30, 30, 30)) t = C.newPyTree(['Base', a, b]) CPlot.display(t) time.sleep(dt) # Replace struct for i in range(10): a = G.cart((i, 0, 0), (1, 1, 1), (30, 30, 30)) CPlot.replace(t, 1, 0, a) CPlot.render() time.sleep(dt) # Replace non struct for i in range(10): a = G.cartHexa((i, 0, 40), (1, 1, 1), (30, 30, 30)) CPlot.replace(t, 1, 1, a) CPlot.render() time.sleep(dt)
# reorder a Cartesian structured mesh a = G.cart((0, 0, 0), (1, 1, 1), (8, 9, 20)) C._initVars(a, '{Density}={CoordinateX}**2+2*{CoordinateY}') C._initVars(a, 'centers:cellN', 1.) C._initVars(a, '{Density}={CoordinateX}**2+2*{CoordinateY}') a = C.addBC2Zone(a, 'wall1', 'BCWall', 'imax') a = C.addBC2Zone(a, 'overlap1', 'BCOverlap', 'jmax') t = C.newPyTree(['Base']) t[2][1][2].append(a) t[2][1] = C.addState(t[2][1], 'EquationDimension', 3) t = T.reorder(t, (2, 1, -3)) test.testT(t, 1) # reorder a TRI mesh a = G.cartTetra((0, 0, 0), (1, 1, 1), (8, 9, 1)) C._initVars(a, '{Density}={CoordinateX}**2+2*{CoordinateY}') #C._initVars(a,'centers:cellN',1.) t = C.newPyTree(['Base', 2, a]) t[2][1] = C.addState(t[2][1], 'EquationDimension', 2) t = T.reorder(t, (-1, )) test.testT(t, 2) # reorder a QUAD mesh a = G.cartHexa((0, 0, 0), (1, 1, 1), (8, 9, 1)) C._initVars(a, '{Density}={CoordinateX}**2+2*{CoordinateY}') #C._initVars(a, 'centers:cellN', 1.) t = C.newPyTree(['Base', 2, a]) t[2][1] = C.addState(t[2][1], 'EquationDimension', 2) t = T.reorder(t, (-1, )) test.testT(t, 3)
# - fillEmptyBC (pyTree) - # Non structure Element import Converter.PyTree as C import Generator.PyTree as G import KCore.test as test a = G.cartHexa((0., 0., 0.), (0.1, 0.1, 0.1), (10, 10, 10)) # Pour l'instant ajoute en tant que face list a = C.fillEmptyBCWith(a, 'wallv', 'BCWallViscous') t = C.newPyTree(['Base', a]) test.testT(t)
# - readNodesFromFilter (pyTree) - import Converter.PyTree as C import Converter.Filter as Filter import Generator.PyTree as G import KCore.test as test # Cree le fichier test a = G.cart((0, 0, 0), (1, 1, 1), (10, 10, 10)) b = G.cartHexa((12, 0, 0), (1, 1, 1), (10, 10, 10)) t = C.newPyTree(['Base', a, b]) C.convertPyTree2File(t, 'test.hdf') # Relit les noeuds par un filtre path = [ '/Base/cart/GridCoordinates/CoordinateX', '/Base/cartHexa/GridCoordinates/CoordinateX' ] f = {} # start/stride/count (nbre d'entrees)/block DataSpaceMMRY0 = [[0, 0, 0], [1, 1, 1], [2, 2, 2], [1, 1, 1]] DataSpaceFILE0 = [[1, 1, 1], [1, 1, 1], [2, 2, 2], [1, 1, 1]] DataSpaceGLOB0 = [[0]] f[path[0]] = DataSpaceMMRY0 + DataSpaceFILE0 + DataSpaceGLOB0 DataSpaceMMRY1 = [[0], [1], [2], [1]] DataSpaceFILE1 = [[0], [1], [2], [1]] DataSpaceGLOB1 = [[0]] f[path[1]] = DataSpaceMMRY1 + DataSpaceFILE1 + DataSpaceGLOB1 # Lit seulement les chemins fournis, retourne un dictionnaire des chemins lus a = Filter.readNodesFromFilter('test.hdf', f)