Exemplo n.º 1
0
import Converter.PyTree as C
import Connector.PyTree as X
import Generator.PyTree as G
import KCore.test as test
import Geom.PyTree as D
import Converter

# transfers at centers
a = D.sphere((5.,5.,5.),1)
C._initVars(a,"centers:cellN=2.")
C._initVars(a,"centers:Density=0.")
indicesI,XI,YI,ZI = X.getInterpolatedPoints(a,loc='centers') 

zdnr = G.cart((0.,0.,0.),(1,1,1),(11,11,11))
C._initVars(zdnr,"centers:Density=1.")
C._initVars(zdnr,"centers:cellN=1.")
zdnrc = C.node2Center(zdnr)
adt = C.createHook(zdnrc,'adt')
fields = X.transferFields(zdnrc, XI, YI, ZI, hook=adt, variables=['Density'])
C.freeHook(adt)
test.testA(fields,1)

# transfers at nodes
a = D.sphere((5.,5.,5.),1)
C._initVars(a,"cellN=2.")
C._initVars(a,"Density=0.")
indicesI,XI,YI,ZI = X.getInterpolatedPoints(a,loc='nodes') 

zdnr = G.cart((0.,0.,0.),(1,1,1),(11,11,11))
C._initVars(zdnr,"Density=1.")
C._initVars(zdnr,"cellN=1.")
Exemplo n.º 2
0
# - getInterpolatedPoints (pyTree) -
import Converter.PyTree as C
import Connector.PyTree as X
import Generator.PyTree as G

a = G.cart((0, 0, 0), (1, 1, 1), (11, 11, 1))
C._initVars(a, "cellN=(2.*({CoordinateX}<0.5)+({CoordinateX}>0.5))")
res = X.getInterpolatedPoints(a, loc='nodes')
print(res)