Ejemplo n.º 1
0
import Intersector.PyTree as XOR
import KCore.test as test

mesh = G.cart((0, 0, 0), (1, 1, 1), (20, 20, 20))
source = G.cart((8, 8, 8), (0.2, 0.2, 0.2), (20, 20, 20))
#C.convertPyTree2File(mesh, 'm.cgns')
#C.convertPyTree2File(source, 's.cgns')

t = C.newPyTree(['Base', mesh])
t = T.splitNParts(t, 2, multigrid=0, dirs=[1, 2, 3])

zones = I.getZones(t)
p1 = zones[0]
p1 = C.convertArray2Tetra(p1, split='withBarycenters')
p1 = C.convertArray2NGon(p1)

p2 = C.convertArray2NGon(zones[1])

mesh = XOR.booleanUnion(p1, p2)  #conformize the join
#C.convertPyTree2File(mesh, 'u.cgns')

m1 = XOR.adaptCells(mesh, source, sensor_type=0)
m1 = XOR.closeOctalCells(m1)
#C.convertPyTree2File(m1, 'out.cgns')
test.testT(m1, 1)

m2 = XOR.adaptCells(mesh, source, sensor_type=2)
m2 = XOR.closeOctalCells(m2)
#C.convertPyTree2File(m2, 'out1.cgns')
test.testT(m2, 2)
import Geom.PyTree as D
import Converter.PyTree as C
import Intersector.PyTree as XOR

# octree
s = D.sphere((0, 0, 0), 1., 100)
snear = 0.1
t = G.octree([s], [snear], dfar=5., balancing=1, ratio=2)

# ngon converion
t = C.convertArray2NGon(t)
# ngon conformization
t = C.conformizeNGon(t)
t = G.close(t)
# ngon close cells
t = XOR.closeOctalCells(t)
#t = XOR.reorientExternalFaces(t)

# ngon converion of the sphere
s = C.convertArray2NGon(s)
# ngon converion to the nuga format
s = XOR.convertNGON2DToNGON3D(s)
#s = XOR.reorientExternalFaces(s)

# Boolean operation
x = XOR.diffSurf(t, s, tol=0., preserve_right=1,
                 agg_mode=2)  # agg_mode=2 : full mode aggregation

x = XOR.agglomerateSmallCells(x, 0., 10.)

t = C.newPyTree(['Base', 2])
Ejemplo n.º 3
0
# - boolean difference (array) -
import Intersector.PyTree as XOR
import Converter.PyTree as C
import Transform.PyTree as T

M1 = C.convertFile2PyTree('boolNG_M1.tp')
M1 = C.convertArray2NGon(M1)
M1 = C.conformizeNGon(M1)
M1 = XOR.closeOctalCells(M1)


M2 = C.convertFile2PyTree('boolNG_M2.tp')
M2 = C.convertArray2NGon(M2)
M2 = C.conformizeNGon(M2)
M2 = XOR.closeOctalCells(M2)

tol = -0.5e-3


M = T.join(M1,M2)
M = XOR.selfX(M)

C.convertPyTree2File(M, 'out.cgns')
# - 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)

Ejemplo n.º 5
0
# - adapt the bounding box of a point cloud (array) -

import Converter.PyTree as C
import Generator.PyTree as G
import Intersector.PyTree as XOR

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) # optional : to close the polyhedral cells

C.convertPyTree2File(m, 'out.cgns')