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')
# - checkPyTree (pyTree) - import Converter.PyTree as C import Generator.PyTree as G import Connector.PyTree as X import Converter.Internal as Internal import KCore.test as test a = G.cart( (0,0,0), (1,1,1), (10,10,10) ) b = G.cart( (9,0,0), (1,1,1), (10,10,10) ) a = C.addBC2Zone(a, 'wall1', 'BCWall', 'imin') t = C.newPyTree(['Base']); t[2][1][2] += [a,b] t = X.connectMatch(t) # check nodes conformity errors = Internal.checkPyTree(t, level=1) # check unique base names errors += Internal.checkPyTree(t, level=2) # check unique zone names errors += Internal.checkPyTree(t, level=3) # check unique BC names errors += Internal.checkPyTree(t, level=4) # check BC ranges errors += Internal.checkPyTree(t, level=5) # check opposite ranges errors += Internal.checkPyTree(t, level=6) # check family definition errors += Internal.checkPyTree(t, level=7) # check types errors += Internal.checkPyTree(t, level=8) test.testO(errors, 1)
# - correctPyTree (pyTree) - import Converter.PyTree as C import Generator.PyTree as G import Connector.PyTree as X import Converter.Internal as Internal import KCore.test as test # Correct a = G.cart( (0,0,0), (1,1,1), (10,10,10) ) b = G.cart( (9,0,0), (1,1,1), (10,10,10) ) a = C.addBC2Zone(a, 'wall1', 'BCWall', 'imin') t = C.newPyTree(['Base']); t[2][1][2] += [a,b] t = X.connectMatch(t) print(Internal.checkPyTree(t)) t = Internal.correctPyTree(t) test.testT(t, 1) # Wrong range for BCWall and wrong range for donor a = G.cart( (0,0,0), (1,1,1), (10,10,10) ) b = G.cart( (0,0,0), (1,1,1), (10,10,10) ); b[0] = 'toto' a = C.initVars(a, '{centers:Density}={centers:CoordinateX}') a = C.addBC2Zone(a, 'wall', 'BCWall', wrange=[1,1,1,11,1,10]) a = C.addBC2Zone(a, 'match', 'BCMatch', wrange=[1,1,1,10,1,10], zoneDonor=b, rangeDonor=[1,1,1,10,1,11], trirac=[1,2,3]) t = C.newPyTree(['Base', a]) t = Internal.correctPyTree(t) test.testT(t, 2)
# - checkPyTree (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), (10,10,10)) b = G.cart((9,0,0), (1,1,1), (10,10,10)) c = G.cartTetra((9,9,0), (1,1,1), (10,10,10)) a = C.addBC2Zone(a, 'wall1', 'BCWall', 'imin') t = C.newPyTree(['Base',a,b,c]) t = X.connectMatch(t) errors = [] # check unique base names errors += Internal.checkPyTree(t, level=2) # check unique zone names errors += Internal.checkPyTree(t, level=3) # check unique BC names errors += Internal.checkPyTree(t, level=4) # check BC ranges errors += Internal.checkPyTree(t, level=5) # check opposite ranges errors += Internal.checkPyTree(t, level=6) # check family definition errors += Internal.checkPyTree(t, level=7) # check CGNSTypes errors += Internal.checkPyTree(t, level=8) # check element nodes errors += Internal.checkPyTree(t, level=9); print errors #>> []
# - correctPyTree (pyTree) - import Converter.PyTree as C import Generator.PyTree as G import Connector.PyTree as X import Converter.Internal as Internal import KCore.test as test # Correct a = G.cart((0, 0, 0), (1, 1, 1), (10, 10, 10)) b = G.cart((9, 0, 0), (1, 1, 1), (10, 10, 10)) a = C.addBC2Zone(a, 'wall1', 'BCWall', 'imin') t = C.newPyTree(['Base']) t[2][1][2] += [a, b] t = X.connectMatch(t) print Internal.checkPyTree(t) t = Internal.correctPyTree(t) test.testT(t, 1) # Wrong range for BCWall and wrong range for donor a = G.cart((0, 0, 0), (1, 1, 1), (10, 10, 10)) b = G.cart((0, 0, 0), (1, 1, 1), (10, 10, 10)) b[0] = 'toto' a = C.initVars(a, 'centers:Density={centers:CoordinateX}') a = C.addBC2Zone(a, 'wall', 'BCWall', range=[1, 1, 1, 11, 1, 10]) a = C.addBC2Zone(a, 'match', 'BCMatch', range=[1, 1, 1, 10, 1, 10], zoneDonor=b, rangeDonor=[1, 1, 1, 10, 1, 11], trirac=[1, 2, 3])