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

a = D.sphere6((0, 0, 0), 1., 10)
a = C.convertArray2Hexa(a)
a = T.join(a)
a = G.close(a)

a = C.initVars(a, '{alpha}=0.5*{CoordinateX}')
a = T.deformNormals(a, 'alpha', niter=2)
C.convertPyTree2File(a, 'out.cgns')
# - moveCamera (pyTree) -
import Geom.PyTree as D
import CPlot.PyTree as CPlot
import Converter.PyTree as C
import Transform.PyTree as T
import Generator.PyTree as G

# Model
a = D.sphere((0, 0, 0), 1., N=20)
a = C.convertArray2Hexa(a)
a = G.close(a)
CPlot.display(a, posCam=(3, -1, 0.7), posEye=(0, 0, 0))

t = 0.
for i in range(1000):
    # change model
    C._initVars(a, '{df}=0.1*cos(%f)*sin(10*pi*{CoordinateX})' % (t))
    b = T.deformNormals(a, 'df')
    # Move camera
    CPlot.moveCamera([(3, -1, 0.7), (3, 5, 0.7), (3, 7, 0.7)], N=1000, pos=i)
    CPlot.display(b)
    t += 0.05
# - deformNormals (pyTree) -
import Converter.PyTree as C
import Generator.PyTree as G
import Geom.PyTree as D
import Transform.PyTree as T
import Connector.PyTree as X
import KCore.test as test

# Zone structuree
a = G.cart((0, 0, 0), (0.1, 0.1, 1.), (11, 11, 1))
a = C.fillEmptyBCWith(a, 'wall', 'BCWall', dim=2)
a = C.initVars(a, '{F}={CoordinateX}+{CoordinateY}**2')
a = C.initVars(a, '{G}=1.')
a = C.initVars(a, '{alpha}=0.5')
a = T.deformNormals(a, 'alpha', niter=1)
test.testT(a, 1)

# Liste de zones structuree
a = D.sphere6((0, 0, 0), 1., 20)
a = C.addBC2Zone(a, 'wall1', 'BCWall', 'imin')
a = X.connectMatch(a, dim=2)
a = C.initVars(a, '{F}={CoordinateX}+{CoordinateY}**2')
a = C.initVars(a, '{G}=1.')
a = C.initVars(a, '{alpha}=0.5')
a = T.deformNormals(a, 'alpha', niter=1)
test.testT(a, 2)

# Zone non structuree
a = D.sphere((0, 0, 0), 1., 50)
a = C.initVars(a, '{F}={CoordinateX}+{CoordinateY}**2')
a = C.initVars(a, '{G}=1.')