Ejemplo n.º 1
0
def fillMissingVariables():
    if CTK.t == []: return
    CTK.saveTree()
    C._fillMissingVariables(CTK.t)
    CTK.TXT.insert('START', 'Missing variables filled.\n')
    CTK.TKTREE.updateApp()
    CTK.display(CTK.t)
Ejemplo n.º 2
0
def view(event=None):
    if CTK.t == []: return

    BCTypes = []
    selection = WIDGETS['BCLB'].curselection()
    for s in selection:
        t = WIDGETS['BCLB'].get(s)
        if t not in Internal.KNOWNBCS: t = 'FamilySpecified:' + t
        BCTypes.append(t)
    if 'FamilySpecified:-All BC-' in BCTypes: BCTypes = ['*']

    if CTK.__MAINTREE__ == 1:
        CTK.__MAINACTIVEZONES__ = CPlot.getActiveZones()

    tp = Internal.appendBaseName2ZoneName(CTK.t,
                                          updateRef=False,
                                          separator=Internal.SEP1)
    CTK.dt = C.newPyTree(['Base', 'Edges'])
    active = []
    for z in CTK.__MAINACTIVEZONES__:
        active.append(tp[2][CTK.Nb[z] + 1][2][CTK.Nz[z]])

    Z = []
    for t in BCTypes:
        Z += C.extractBCOfType(active, t, topTree=tp)
        if t == 'BCWall':  # Dans ce cas, affiche tous les types de BCWall
            Z += C.extractBCOfType(active, 'BCWallInviscid')
            Z += C.extractBCOfType(active, 'BCWallViscous')
            Z += C.extractBCOfType(active, 'BCWallViscousIsoThermal')
    CTK.dt[2][1][2] += Z

    if VARS[7].get() == '1':  # display les edges des zones en +
        exts = []
        for z in active:
            ztype = Internal.getZoneType(z)
            if ztype == 1:
                zp = P.exteriorFacesStructured(z)
                exts += zp
            else:
                #zp = P.exteriorFaces(z)
                #zp = P.sharpEdges(zp)
                zp = []
                exts += zp

        CTK.dt[2][2][2] += exts
        C._fillMissingVariables(CTK.dt)  # bug exteriorFaces

        # Activate
        lenZ = len(CTK.dt[2][1][2])
        lenExts = len(CTK.dt[2][2][2])
        active = [(i, 1) for i in range(lenZ + lenExts)]
        for i in range(lenZ):
            active[i] = (i, 1)
        for i in range(lenExts):
            active[i + lenZ] = (i + lenZ, 0)

        CTK.display(CTK.dt, mainTree=CTK.DEFINEDBC)
        CPlot.setActiveZones(active)
        CPlot.setState(edgifyDeactivatedZones=1)
    else:
        lenZ = len(CTK.dt[2][1][2])
        active = [(i, 1) for i in range(lenZ)]
        C._fillMissingVariables(CTK.dt)  # si BCDataSet != fields
        CTK.display(CTK.dt, mainTree=CTK.DEFINEDBC)
        CPlot.setActiveZones(active)
        CPlot.setState(edgifyDeactivatedZones=0)