示例#1
0
# - readPyTreeFromPaths (pyTree) -
import Converter.PyTree as C
import Converter.Filter as Filter
import Generator.PyTree as G
import KCore.test as test

LOCAL = test.getLocal()

# Cree le fichier test
a = G.cart((0, 0, 0), (1, 1, 1), (10, 10, 10))
b = G.cart((12, 0, 0), (1, 1, 1), (10, 10, 10))
t = C.newPyTree(['Base', a, b])
C.convertPyTree2File(t, LOCAL + '/test.adf')

t = Filter.convertFile2SkeletonTree(LOCAL + '/test.adf', maxDepth=3)

# Complete t par leur paths
Filter._readPyTreeFromPaths(
    t, LOCAL + '/test.adf',
    ['/Base/cart/GridCoordinates', 'Base/cart.0/GridCoordinates'])
test.testT(t, 1)
# - readPyTreeFromPaths (pyTree) -
import Converter.PyTree as C
import Converter.Filter as Filter
import Converter.Internal as Internal
import Generator.PyTree as G

# Cree le fichier test
a = G.cart((0, 0, 0), (1, 1, 1), (10, 10, 10))
b = G.cart((12, 0, 0), (1, 1, 1), (10, 10, 10))
t = C.newPyTree(['Base', a, b])
C.convertPyTree2File(t, 'test.hdf')

t = Filter.convertFile2SkeletonTree('test.hdf', maxDepth=3)

# Complete t par leur paths
Filter._readPyTreeFromPaths(
    t, 'test.hdf',
    ['/Base/cart/GridCoordinates', 'Base/cart.0/GridCoordinates'])
Internal.printTree(t)
C.convertPyTree2File(t, 'out.hdf')
示例#3
0
# - HDF read/write with links -
import Generator.PyTree as G
import Converter.PyTree as C
import Converter.Internal as Internal
import Converter.Filter as Filter

a = G.cart((0,0,0),(1,1,1),(50,50,50))
C._initVars(a, 'Density=1.')
t = C.newPyTree(['Base',a])

# Save file with links
links=[['.','coord.hdf','/Base/cart/GridCoordinates','/Base/cart/GridCoordinates']]
C.convertPyTree2File(t, 'main.hdf', links=links)

# full read of main returning links
LC=[]
t = C.convertFile2PyTree('main.hdf', links=LC); print(LC)

# Read links with skeleton
LC=[]
t = Filter.convertFile2SkeletonTree('main.hdf', links=LC); print(LC)