def extract(): if CTK.t == []: return type = VARS[0].get() if CTK.__MAINTREE__ == 1: CTK.__MAINACTIVEZONES__ = CPlot.getActiveZones() active = [] zones = Internal.getZones(CTK.t) for z in CTK.__MAINACTIVEZONES__: active.append(CTK.t[2][CTK.Nb[z] + 1][2][CTK.Nz[z]]) Z = None if type == 'cellN=-99999': Z = selectWithFormula(active, '{cellN} == -99999') elif type == 'cellN=1': Z = selectWithFormula(active, '{cellN} == 1') elif type == 'cellN=0': Z = selectWithFormula(active, '{cellN} == 0') elif type == 'cellN=2': Z = selectWithFormula(active, '{cellN} == 2') elif type == 'cellN<0': Z = selectWithFormula(active, '{cellN}<0') elif type == '0<cellN<1': Z = selectWithFormula(active, '({cellN}>0) & ({cellN}<1)') elif type == 'Interpolated points': Z = X.extractChimeraInfo(zones, type='interpolated', loc='centers') if Z == []: Z = None elif type == 'Extrapolated points': Z = X.extractChimeraInfo(zones, type='extrapolated', loc='centers') if Z == []: Z = None elif type == 'Orphan points': Z = X.extractChimeraInfo(zones, type='orphan', loc='centers') if Z == []: Z = None elif type == 'cf>1': Z = X.extractChimeraInfo(zones, type='cf>1', loc='centers') if Z == []: Z = None if Z is not None: CTK.TXT.insert('START', 'Filter ' + type + ' extracted.\n') C._addBase2PyTree(CTK.t, 'EXTRACT') b = Internal.getNodesFromName1(CTK.t, 'EXTRACT') base = b[0] base[2] += Z (CTK.Nb, CTK.Nz) = CPlot.updateCPlotNumbering(CTK.t) #C._fillMissingVariables(CTK.t) CTK.TKTREE.updateApp() CTK.display(CTK.t) else: CTK.TXT.insert('START', 'Nothing extracted.\n') CTK.TXT.insert('START', 'Error: ', 'Error')
def view(): if CTK.t == []: return type = VARS[0].get() if type == 'Mesh': CTK.display(CTK.t) return if CTK.__MAINTREE__ == 1: CTK.__MAINACTIVEZONES__ = CPlot.getActiveZones() tp = Internal.appendBaseName2ZoneName(CTK.t, separator=Internal.SEP1) active = [] zones = Internal.getZones(tp) for z in CTK.__MAINACTIVEZONES__: active.append(zones[z]) Z = None if type == 'cf>1': Z = P.selectCells(active, Filter1, [ 'interpCoefs1', 'interpCoefs2', 'interpCoefs3', 'interpCoefs4', 'interpCoefs5', 'interpCoefs6', 'interpCoefs7', 'interpCoefs8' ]) elif type == 'cellN=-99999': Z = selectWithFormula(active, '{cellN} == -99999') elif type == 'cellN=1': Z = selectWithFormula(active, '{cellN} == 1') elif type == 'cellN=0': Z = selectWithFormula(active, '{cellN} == 0') elif type == 'cellN=2': Z = selectWithFormula(active, '{cellN} == 2') elif type == 'cellN<0': Z = selectWithFormula(active, '{cellN} < 0') elif type == '0<cellN<1': Z = selectWithFormula(active, '({cellN}>0) & ({cellN}<1)') elif type == 'Orphan points': Z = X.extractChimeraInfo(active, 'orphan') elif type == 'Extrapolated points': Z = X.extractChimeraInfo(active, 'extrapolated') if Z is not None: CTK.TXT.insert('START', 'Filter ' + type + ' displayed.\n') CTK.dt = C.newPyTree(['Base']) CTK.dt[2][1][2] += Z CTK.display(CTK.dt, mainTree=CTK.CELLN) else: CTK.TXT.insert('START', 'Nothing to display.\n') CTK.TXT.insert('START', 'Error: ', 'Error')
a = G.cylinder((0, 0, 0), 1., 3., 360, 0, 1, (200, 30, 4)) a[0] = 'cylindre1' C._addBC2Zone(a, 'wall1', 'BCWall', 'jmin') C._addBC2Zone(a, 'ov1', 'BCOverlap', 'jmax') b = G.cylinder((4, 0, 0), 1., 3., 360, 0, 1, (200, 30, 4)) b[0] = 'cylindre2' C._addBC2Zone(b, 'wall1', 'BCWall', 'jmin') C._addBC2Zone(b, 'ov1', 'BCOverlap', 'jmax') t = C.newPyTree(['Corps1', 'Corps2']) t[2][1][2].append(a) t[2][2][2].append(b) t = X.connectMatch(t, dim=3) C._fillEmptyBCWith(t, 'nref', 'BCFarfield', dim=3) C._addState(t, 'EquationDimension', 3) C._initVars(t, 'F', 0.) C._initVars(t, 'centers:G', 1.) t = X.applyBCOverlaps(t, depth=1) t1 = X.setInterpolations(t, loc='cell', storage='direct') X._chimeraInfo(t1, type='interpolated') X._chimeraInfo(t1, type='extrapolated') X._chimeraInfo(t1, type='orphan') interpPts = X.extractChimeraInfo(t1, type='interpolated', loc='centers') test.testT(interpPts, 1) extrapPts = X.extractChimeraInfo(t1, type='extrapolated', loc='centers') test.testT(extrapPts, 2) cfExtrapPts = X.extractChimeraInfo(t1, type='cf>1.5', loc='centers') test.testO(cfExtrapPts, 3) orphanPts = X.extractChimeraInfo(t1, type='orphan', loc='centers') test.testT(orphanPts, 4)
# - chimeraInfo (pyTree) - import Converter.PyTree as C import Generator.PyTree as G import Connector.PyTree as X a = G.cylinder((0, 0, 0), 1., 3., 360, 0, 1, (200, 30, 4)) a[0] = 'cylindre1' C._addBC2Zone(a, 'wall1', 'BCWall', 'jmin') C._addBC2Zone(a, 'ov1', 'BCOverlap', 'jmax') b = G.cylinder((4, 0, 0), 1., 3., 360, 0, 1, (200, 30, 4)) b[0] = 'cylindre2' C._addBC2Zone(b, 'wall1', 'BCWall', 'jmin') C._addBC2Zone(b, 'ov1', 'BCOverlap', 'jmax') t = C.newPyTree(['Cyl1', a, 'Cyl2', b]) t = X.connectMatch(t, dim=3) C._fillEmptyBCWith(t, 'nref', 'BCFarfield', dim=3) C._initVars(t[2][2], 'centers:cellN', 2) t = X.setInterpolations(t, loc='cell', double_wall=1, storage='direct') X._chimeraInfo(t, type='orphan') orphanPts = X.extractChimeraInfo(t, type='orphan') C.convertPyTree2File(orphanPts, "orphanPts.cgns") X._chimeraInfo(t, type='extrapolated') out = X.extractChimeraInfo(t, type='cf>1.5') C.convertPyTree2File(out, "out.cgns")