# - projectAllDirs (pyTree) -
import Geom.PyTree as D
import Converter.PyTree as C
import Generator.PyTree as G
import Transform.PyTree as T

a = D.sphere((0, 0, 0), 1., 20)
b = G.cart((1.1, -0.1, -0.1), (0.1, 0.1, 0.1), (1, 5, 5))
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'
C.convertPyTree2File([a, b, c], 'out.cgns')
import Geom.PyTree as D
import Converter.PyTree as C
import Generator.PyTree as G
import Transform.PyTree as T
import KCore.test as test

# Structure
a = D.sphere((0, 0, 0), 1., 20)
a = C.addBC2Zone(a, 'wall1', 'BCWall', 'imin')
a = C.addBC2Zone(a, 'match1', 'BCMatch', 'jmin', a, 'jmax', [1, 2])
a = C.addVars(a, 'F')
a = C.addVars(a, 'centers:G')
b = G.cart((1.1, -0.1, -0.1), (0.1, 0.1, 0.1), (1, 5, 5))
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].append(c)
test.testT(t, 1)

# Non structure sur structure
a = D.sphere((0, 0, 0), 1., 20)
a = C.addBC2Zone(a, 'wall1', 'BCWall', 'imin')
a = C.addBC2Zone(a, 'match1', 'BCMatch', 'jmin', a, 'jmax', [1, 2])
a = C.addVars(a, 'F')
a = C.addVars(a, 'centers:G')
b = G.cartTetra((1.1, -0.1, -0.1), (0.1, 0.1, 0.1), (1, 5, 5))
b = G.getNormalMap(b)
b = C.center2Node(b, ['centers:sx', 'centers:sy', 'centers:sz'])
c = T.projectAllDirs(b, a, ['sx', 'sy', 'sz'])