def recover(event=None): if CTK.t == []: return if CTK.__MAINTREE__ <= 0: CTK.TXT.insert('START', 'Fail on a temporary tree.\n') CTK.TXT.insert('START', 'Error: ', 'Error'); return # Zone BC to recover name = VARS[1].get() names = name.split(';') BCs = []; BCNames = []; BCTypes = [] for v in names: v = v.lstrip(); v = v.rstrip() sname = v.split('/', 1) bases = Internal.getNodesFromName1(CTK.t, sname[0]) if bases != []: nodes = Internal.getNodesFromType1(bases[0], 'Zone_t') for z in nodes: if z[0] == sname[1]: BCs.append(z) r = sname[1].split('/') BCNames.append(r[1]) n = Internal.getNodeFromName1(z, 'BCType') if n is not None: BCTypes.append(Internal.getValue(n)) else: BCTypes.append('UserDefined') CTK.saveTree() nzs = CPlot.getSelectedZones() if CTK.__MAINTREE__ <= 0 or nzs == []: zones = Internal.getZones(CTK.t) else: zones = [] for nz in nzs: nob = CTK.Nb[nz]+1; noz = CTK.Nz[nz] zones.append(CTK.t[2][nob][2][noz]) fail = False for z in zones: zdim = Internal.getZoneDim(z) if zdim[3] == 'NGON': C._recoverBCs(z, (BCs, BCNames, BCTypes)) else: fail = True if not fail: CTK.TXT.insert('START', 'BCs recovered.\n') else: CTK.TXT.insert('START', 'BC recover fails. Need NGON zone.\n') CTK.TXT.insert('START', 'Warning: ', 'Warning') CTK.TKTREE.updateApp()
# - recoverBCs (pyTree) - import Converter.PyTree as C import Generator.PyTree as G a = G.cart((0, 0, 0), (1, 1, 1), (10, 10, 2)) a = C.addBC2Zone(a, 'overlap', 'BCOverlap', 'imin') a = C.addBC2Zone(a, 'match1', 'BCMatch', 'jmin', a, 'jmax', [1, 2, 3]) a = C.fillEmptyBCWith(a, 'wall', 'BCWall', dim=2) (BCs, BCNames, BCTypes) = C.getBCs(a) b = C.convertArray2NGon(a) C._recoverBCs(b, (BCs, BCNames, BCTypes)) C.convertPyTree2File(b, 'out.cgns')