예제 #1
0
# - addChild (pyTree) -
import Converter.PyTree as C
import Converter.Internal as Internal
import Generator.PyTree as G
import KCore.test as test

node = Internal.createBaseNode('Base', 3)
child1 = G.cart((0., 0., 0.), (1, 1, 1), (10, 10, 10))
child2 = G.cart((0., 0., 0.), (1, 1, 1), (10, 10, 10))
child3 = G.cart((0., 0., 0.), (1, 1, 1), (10, 10, 10))

# add child nodes
Internal.addChild(node, child1, pos=-1)  # at the end
Internal.addChild(node, child2, pos=0)  # first
test.testT(node, 1)

# add children nodes
node = Internal.createBaseNode('Base', 3)
Internal.addChild(node, child1)  # at the end
Internal.addChild(node, [child2, child3], pos=-1)  # at the end
test.testT(node, 2)

node = Internal.createBaseNode('Base', 3)
Internal.addChild(node, child1)  # at the end
Internal.addChild(node, [child2, child3], pos=0)  # first
test.testT(node, 3)
DataSpaceGLOB = [[NbVtx]]

Filter = dict()
Filter[path[0]] = DataSpaceMMRY + DataSpaceFILE + DataSpaceGLOB
Filter[path[1]] = DataSpaceMMRY + DataSpaceFILE + DataSpaceGLOB
if rank == 0:
    print(rank, Filter)
comm.barrier()
if rank == 1:
    print(rank, Filter)
comm.barrier()

# ------------------------------------------------------------------------
# 5/ Partial write
dt = I.newCGNSTree()
dn = I.addChild(dt, ['SuperName', CoordX, [], 'DataArray_t'])
I._addChild(dn, ['SuperGirl', CoordY, [], 'DataArray_t'])
C.printTree(dt)

st = I.newCGNSTree()
sn = I.addChild(st, ['SuperName', None, [], 'DataArray_t'])
I._addChild(sn, ['SuperGirl', None, [], 'DataArray_t'])
C.printTree(st)

if (rank == 0):
    C.convertPyTree2File(st, filenameout)
comm.barrier()

C.convertPyTree2FilePartial(dt, filenameout, comm, Filter)

# ------------------------------------------------------------------------