Exemple #1
0
def fixWallXNegGeneral(idx, globaldata, nbhs, control, conditionNumber,
                       aggressive, wallpoints, configData, hashtable):
    if control > 0:
        return globaldata
    else:
        control = control + 1
        mynbhs = core.convertIndexToPoints(core.getNeighbours(idx, globaldata),
                                           globaldata)
        mychecknbhs = core.getXNegPointsWithInput(idx, globaldata, mynbhs,
                                                  configData)
        finalnbhs = list(set(nbhs) - set(mynbhs))
        finalnbhs = core.getXNegPointsWithInput(idx, globaldata, finalnbhs,
                                                configData)
        # print(finalnbhs)
        conditionSet = []
        for itm in finalnbhs:
            checkset = [itm] + mychecknbhs
            newcheck = core.getConditionNumberWithInput(
                idx, globaldata, checkset, configData)
            if newcheck < conditionNumber:
                if not core.isNonAeroDynamicEvenBetter(idx, itm, globaldata,
                                                       wallpoints):
                    conditionSet.append([itm, newcheck])
        if len(conditionSet) > 0:
            conditionSet.sort(key=lambda x: x[1])
            globaldata = core.appendNeighbours(idx, globaldata,
                                               conditionSet[0][0], hashtable)
            fixWallXNegGeneral(idx, globaldata, nbhs, control, conditionNumber,
                               aggressive, wallpoints, configData, hashtable)
        else:
            if aggressive == True:
                leftright = core.getLeftandRightPoint(idx, globaldata)
                currnbhs = core.convertIndexToPoints(
                    core.getNeighbours(idx, globaldata), globaldata)
                nbhofnbh = []
                leftright = leftright + currnbhs
                for itm in leftright:
                    itm_real = core.getIndexFromPoint(itm, globaldata,
                                                      hashtable)
                    layernbhs = core.convertIndexToPoints(
                        core.getNeighbours(itm_real, globaldata), globaldata)
                    nbhofnbh = nbhofnbh + layernbhs
                nbhofnbh = list(
                    set(nbhofnbh) - set([core.getPointXY(idx, globaldata)]))
                fixWallXNegGeneral(idx, globaldata, nbhofnbh, control,
                                   conditionNumber, False, wallpoints,
                                   configData, hashtable)
            else:
                return globaldata
    return globaldata
Exemple #2
0
def fixYneg(idx, globaldata, nbhs, control, conditionNumber, aggressive,
            polygonData, wallpoints, configData):
    if control > 0:
        return globaldata
    else:
        control = control + 1
        mynbhs = core.convertIndexToPoints(core.getNeighbours(idx, globaldata),
                                           globaldata)
        mychecknbhs = core.getYNegPointsWithInputLegacy(
            idx, globaldata, mynbhs, configData)
        finalnbhs = list(set(nbhs) - set(mynbhs))
        finalnbhs = core.getYNegPointsWithInputLegacy(idx, globaldata,
                                                      finalnbhs, configData)
        finalnbhs = core.getAeroPointsFromSet(idx, finalnbhs, globaldata,
                                              wallpoints)
        # print(finalnbhs)
        conditionSet = []
        for itm in finalnbhs:
            checkset = [itm] + mychecknbhs
            newcheck = core.getConditionNumberDictionary(
                idx, globaldata, checkset, configData)
            if newcheck < conditionNumber:
                if not core.isNonAeroDynamicEvenBetter(idx, itm, globaldata,
                                                       wallpoints):
                    conditionSet.append([itm, newcheck])
        if len(conditionSet) > 0:
            conditionSet.sort(key=lambda x: x[1])
            globaldata = core.appendNeighbours(idx, globaldata,
                                               conditionSet[0][0])
            fixYneg(idx, globaldata, nbhs, control, conditionNumber,
                    aggressive, polygonData, wallpoints, configData)
        else:
            if aggressive == True:
                directnbhs = getNeighboursFromTriangle(idx, globaldata,
                                                       polygonData)
                nbhofnbh = []
                for itm in directnbhs:
                    itm_real = core.getIndexFromPoint(itm, globaldata)
                    layernbhs = getNeighboursFromTriangle(
                        itm_real, globaldata, polygonData)
                    nbhofnbh = nbhofnbh + layernbhs
                nbhofnbh = list(set(nbhofnbh))
                fixYneg(idx, globaldata, nbhofnbh, control, conditionNumber,
                        False, polygonData, wallpoints, configData)
            else:
                return globaldata
    return globaldata