Example #1
0
def runCheckPyTree():
    if CTK.t == []: return
    errors = []
    v = VARS[3].get()
    if v == 'All conformity' or v == ' > Node conformity':
        errors += Internal.checkPyTree(CTK.t, level=1)
    if v == 'All conformity' or v == ' > Unique base name':
        errors += Internal.checkPyTree(CTK.t, level=2)
    if v == 'All conformity' or v == ' > Unique zone name':
        errors += Internal.checkPyTree(CTK.t, level=3)
    if v == 'All conformity' or v == ' > Unique BC name':
        errors += Internal.checkPyTree(CTK.t, level=4)
    if v == 'All conformity' or v == ' > Valid BC ranges':
        errors += Internal.checkPyTree(CTK.t, level=5)
    if v == 'All conformity' or v == ' > Valid BC match':
        errors += Internal.checkPyTree(CTK.t, level=6)
    if v == 'All conformity' or v == ' > Referenced families':
        errors += Internal.checkPyTree(CTK.t, level=7)
    if v == 'All conformity' or v == ' > Valid CGNS types':
        errors += Internal.checkPyTree(CTK.t, level=8)
    if v == 'All conformity' or v == ' > Valid element nodes':
        errors += Internal.checkPyTree(CTK.t, level=9)
    if v == 'All conformity' or v == ' > Valid CGNS flowfield name':
        errors += Internal.checkPyTree(CTK.t, level=10)
    if v == 'Multigrid compatibility':
        MGlevel = CTK.varsFromWidget(VARS[2].get(), type=2)
        minBlk = CTK.varsFromWidget(VARS[0].get(), type=2)
        minBC = CTK.varsFromWidget(VARS[1].get(), type=2)
        if len(MGlevel) > 0 and len(minBlk) > 0 and len(minBC) > 0:
            errors += Internal.checkMultigrid(CTK.t,
                                              level=MGlevel[0],
                                              nbMinCoarseB=minBlk[0],
                                              nbMinCoarseW=minBC[0])
    if (v == 'Maximum number of nodes'):
        minBlk = CTK.varsFromWidget(VARS[0].get(), type=2)
        if len(minBlk) > 0:
            errors = Internal.checkSize(CTK.t, sizeMax=minBlk[0])

    if len(errors) == 0: errors = [0, 'No error found.']
    Panels.displayErrors(errors, header='Checking pyTree')
    CTK.TXT.insert('START', 'pyTree checked.\n')
# - checkSize (pyTree) -
import Converter.PyTree as C
import Generator.PyTree as G
import Connector.PyTree as X
import Converter.Internal as Internal

a = G.cart((0, 0, 0), (1, 1, 1), (11, 11, 11))
b = G.cart((10, 0, 0), (1, 1, 1), (11, 11, 11))
a = C.addBC2Zone(a, 'wall1', 'BCWall', 'imin')
t = C.newPyTree(['Base', a, b])
t = X.connectMatch(t)
C.convertPyTree2File(t, 'out.cgns')

# check nodes conformity
errors = Internal.checkSize(t, sizeMax=500)
print(errors)