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
def triangleBalance3(globaldata, wallpoints, configData, badPoints, hashtable=None): WALL_THRESHOLD = int( configData["triangulate"]["leftright"]["wallThreshold"]) AGGRESSIVE_MAX_NEIGHBOURS = -int( configData["triangulate"]["leftright"]["aggressiveMaxNeighbours"]) previousType = 0 for _, idx in enumerate(tqdm(badPoints)): if idx > 0: flag = int(core.getFlag(idx, globaldata)) xposf, xnegf, _, _ = core.getFlags(idx, globaldata) ## Wall Points if flag == 0: previousType = 0 if xposf == 1 or xposf == 2: nbhs = core.convertIndexToPoints( core.getNeighbours(idx, globaldata), globaldata) # if idx not in core.getWallEndPoints(globaldata): if True: nbhs = nbhs + core.getLeftandRightPoint( idx, globaldata) nbhs = list(set(nbhs)) globaldata = fixWallXPosGeneral(idx, globaldata, nbhs, AGGRESSIVE_MAX_NEIGHBOURS, WALL_THRESHOLD, True, wallpoints, configData, hashtable) if xnegf == 1 or xnegf == 2: nbhs = core.convertIndexToPoints( core.getNeighbours(idx, globaldata), globaldata) # if idx not in core.getWallEndPoints(globaldata): if True: nbhs = nbhs + core.getLeftandRightPoint( idx, globaldata) nbhs = list(set(nbhs)) globaldata = fixWallXNegGeneral(idx, globaldata, nbhs, AGGRESSIVE_MAX_NEIGHBOURS, WALL_THRESHOLD, True, wallpoints, configData, hashtable) elif previousType == 0: break return globaldata
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
def main(): # Command Line Arguments parser = argparse.ArgumentParser() parser.add_argument("-i", "--input", const=str, nargs="?") args = parser.parse_args() log.info("Loading Data") file1 = open(args.input or "preprocessorfile.txt", "r") data = file1.read() globaldata = ["start"] splitdata = data.split("\n") splitdata = splitdata[:-1] log.info("Processed Pre-Processor File") log.info("Converting to readable format") for _, itm in enumerate(tqdm(splitdata)): itm = itm.split(" ") itm.pop(-1) entry = itm globaldata.append(entry) globaldata = core.cleanNeighbours(globaldata) wallpoints = core.getWallPointArray(globaldata) wallpointsData = core.generateWallPolygons(wallpoints) print(len(wallpointsData)) x, y = wallpointsData[0].exterior.xy fig, axs = plt.subplots() axs.fill(x, y, alpha=0.5, fc='r', ec='none') plt.show() #if not interactive. log.info("Running Non Aero Checks") for idx in trange(1, len(globaldata)): nbhs = core.getNeighbours(idx, globaldata) for itm in nbhs: cord = core.getPointXY(itm, globaldata) if core.isNonAeroDynamic(idx, cord, globaldata, wallpointsData): log.warning("Point %s has a non aero point with index %s", idx, itm) log.info("Done")
def main(): # Command Line Arguments parser = argparse.ArgumentParser() parser.add_argument("-i", "--input", const=str, nargs="?") args = parser.parse_args() print("Loading Data") file1 = open(args.input or "preprocessorfile.txt", "r") data = file1.read() globaldata = ["start"] splitdata = data.split("\n") splitdata = splitdata[:-1] print("Processed Pre-Processor File") print("Converting to readable format") for idx, itm in enumerate(splitdata): printProgressBar(idx, len(splitdata) - 1, prefix="Progress:", suffix="Complete", length=50) itm = itm.split(" ") itm.pop(-1) entry = itm globaldata.append(entry) globaldata = core.cleanNeighbours(globaldata) wallpoints = core.getWallPointArray(globaldata) wallpointsIndex = core.getWallPointArrayIndex(globaldata) # result = core.findAverageWallDistance(globaldata,wallpointsIndex) # print(result) # temp.writeNormalsToText(globaldata) # temp.writeConditionValues(globaldata) temp.writeSrikanthStyle(globaldata) exit() wallpointsData = core.generateWallPolygons(wallpoints) while True: ptidx = input("Which point do you want to check? ") if ptidx == "exit": break ptidx = int(ptidx) print("Point Index:", ptidx) print("Point Co ordinate:", core.getPointXY(ptidx, globaldata)) flag = core.getFlag(ptidx, globaldata) flag = int(flag) if flag == 0: flagd = "Wall Point" elif flag == 1: flagd = "Interior Point" else: flagd = "Outer Point" print("Point Type:", flagd) nbhs = core.getNeighbours(ptidx, globaldata) print("Total Number of Neighbours:", len(nbhs)) print("Neighbour Array") print(nbhs) if (flag == 0): print(core.getConditionNumberLegacy(ptidx, globaldata)) xpos = core.getXPosPoints(ptidx, globaldata) xneg = core.getXNegPoints(ptidx, globaldata) print("xpos", len(xpos), "xneg", len(xneg)) else: print(core.getConditionNumberLegacy(ptidx, globaldata)) xpos = core.getDXPosPointsLegacy(ptidx, globaldata) xneg = core.getDXNegPointsLegacy(ptidx, globaldata) ypos = core.getDYPosPointsLegacy(ptidx, globaldata) yneg = core.getDYNegPointsLegacy(ptidx, globaldata) print("xpos", len(xpos), "xneg", len(xneg), "ypos", len(ypos), "yneg", len(yneg))
def main(): # Command Line Arguments parser = argparse.ArgumentParser() parser.add_argument("-i", "--input", const=str, nargs="?") args = parser.parse_args() log.info("Loading Data") log.debug("Arguments") log.debug(args) globaldata = core.getKeyVal("globaldata") configData = core.getConfig() globaldata.insert(0,"start") # print(len(globaldata)) globaldata = core.cleanNeighbours(globaldata) wallpoints = core.getWallPointArrayIndex(globaldata) wallpoints = core.flattenList(wallpoints) # wallpoints = core.convertToShapely(wallpoints) shiftFlag = int(configData["shift"]["shiftFlag"]) # Get interiorpts list interiorpts = core.getInteriorPointArrayIndex(globaldata) # print(interiorpts) # If the interior point has a wallpoint as neighbour log.info("Scanning Interior Points for Possible Shifting") for idx in tqdm(interiorpts): if core.containsWallPoints(globaldata, idx, wallpoints): # print(idx) toplx,toply,bottomrx,bottomry = core.getBoundingPointsOfQuadrant(idx, globaldata) nbhcords = core.getNeighbours(idx,globaldata) mainptx, mainpty = core.getPoint(idx,globaldata) bestwallpt = 0 mindist = 1000.0 # Get all neighbouring for itm in nbhcords: if core.getFlag(itm,globaldata) == 0: wallptx, wallpty = core.getPoint(itm, globaldata) if mindist > core.distance(mainptx, mainpty, wallptx, wallpty): mindist = core.distance(mainptx, mainpty, wallptx, wallpty) bestwallpt = itm # Safety Case if bestwallpt == 0: continue else: itm = bestwallpt # Calculate normal for that wall point nx, ny = core.normalCalculation(itm, globaldata, True, configData) slope = ny/nx wallptx, wallpty = core.getPoint(itm, globaldata) leftsidey = slope * (toplx - wallptx) + wallpty rightsidey = slope * (bottomrx - wallptx) + wallpty lowersidex = (bottomry - wallpty) / slope + wallptx uppersidex = (toply - wallpty) / slope + wallptx # Check if the quadrant and normal intersect if shiftFlag == 0: maxdist = 0.0 if leftsidey <= toply and leftsidey >= bottomry: # If yes, change x, y of interior point to lie on the normal if maxdist < core.distance(wallptx, wallpty, toplx, leftsidey): maxdist = core.distance(wallptx, wallpty, toplx, leftsidey) globaldata[idx][1] = toplx globaldata[idx][2] = leftsidey globaldata = core.setNormals(idx, globaldata, (nx, ny)) if rightsidey <= toply and rightsidey >= bottomry: if maxdist < core.distance(wallptx, wallpty, bottomrx, rightsidey): maxdist = core.distance(wallptx, wallpty, bottomrx, rightsidey) globaldata[idx][1] = bottomrx globaldata[idx][2] = rightsidey globaldata = core.setNormals(idx, globaldata, (nx, ny)) if uppersidex <= bottomrx and uppersidex >= toplx: if maxdist < core.distance(wallptx, wallpty, toplx, leftsidey): maxdist = core.distance(wallptx, wallpty, toplx, leftsidey) globaldata[idx][1] = uppersidex globaldata[idx][2] = toply globaldata = core.setNormals(idx, globaldata, (nx, ny)) if lowersidex <= bottomrx and lowersidex >= toplx: if maxdist < core.distance(wallptx, wallpty, lowersidex, bottomry): maxdist = core.distance(wallptx, wallpty, lowersidex, bottomry) globaldata[idx][1] = lowersidex globaldata[idx][2] = bottomry globaldata = core.setNormals(idx, globaldata, (nx, ny)) elif shiftFlag == 1: mindist = 1000.0 if leftsidey <= toply and leftsidey >= bottomry: # If yes, change x, y of interior point to lie on the normal if mindist > core.distance(wallptx, wallpty, toplx, leftsidey): mindist = core.distance(wallptx, wallpty, toplx, leftsidey) globaldata[idx][1] = toplx globaldata[idx][2] = leftsidey globaldata = core.setNormals(idx, globaldata, (nx, ny)) if rightsidey <= toply and rightsidey >= bottomry: if mindist > core.distance(wallptx, wallpty, bottomrx, rightsidey): mindist = core.distance(wallptx, wallpty, bottomrx, rightsidey) globaldata[idx][1] = bottomrx globaldata[idx][2] = rightsidey globaldata = core.setNormals(idx, globaldata, (nx, ny)) if uppersidex <= bottomrx and uppersidex >= toplx: if mindist > core.distance(wallptx, wallpty, toplx, leftsidey): mindist = core.distance(wallptx, wallpty, toplx, leftsidey) globaldata[idx][1] = uppersidex globaldata[idx][2] = toply globaldata = core.setNormals(idx, globaldata, (nx, ny)) if lowersidex <= bottomrx and lowersidex >= toplx: if mindist > core.distance(wallptx, wallpty, lowersidex, bottomry): mindist = core.distance(wallptx, wallpty, lowersidex, bottomry) globaldata[idx][1] = lowersidex globaldata[idx][2] = bottomry globaldata = core.setNormals(idx, globaldata, (nx, ny)) # print(idx) # break # else: # continue # print(nx, ny) globaldata.pop(0) core.setKeyVal("globaldata",globaldata) log.info("Writing file to disk") with open("preprocessorfile_shift.txt", "w") as text_file: for item1 in globaldata: text_file.writelines(["%s " % item for item in item1]) text_file.writelines("\n") log.info("Geometry Shifted Converted")
def generateReportConnectivity(globaldata): resultInterior = { "total": 0, "leastxpos": 0, "maxxpos": 0, "leastxneg": 0, "maxxneg": 0, "leastypos": 0, "maxypos": 0, "leastyneg": 0, "maxyneg": 0, "xposavg": 0, "xnegavg": 0, "yposavg": 0, "ynegavg": 0, "_init": False } resultOuter = { "total": 0, "leastxpos": 0, "maxxpos": 0, "leastxneg": 0, "maxxneg": 0, "xposavg": 0, "xnegavg": 0, "_init": False } resultWall = { "total": 0, "leastxpos": 0, "maxxpos": 0, "leastxneg": 0, "maxxneg": 0, "xposavg": 0, "xnegavg": 0, "_init": False } inxpos, inxneg, inypos, inyneg, ouxpos, ouxneg, waxpos, waxneg, interior, outer, wall = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 for idx, _ in enumerate(globaldata): if (idx > 1): flag = core.getFlag(idx, globaldata) ## Interior Point if (flag == 1): nbhs = core.convertIndexToPoints( core.getNeighbours(idx, globaldata), globaldata) curcord = core.getPointXY(idx, globaldata) xpos, xneg, ypos, yneg, _ = core.deltaNeighbourCalculationLegacy( nbhs, curcord, False, False) interior = interior + 1 inxpos = inxpos + xpos inxneg = inxneg + xneg inypos = inypos + ypos inyneg = inyneg + yneg if (resultInterior["_init"] == True): if (xpos < resultInterior["leastxpos"]): resultInterior["leastxpos"] = xpos if (resultInterior["maxxpos"] < xpos): resultInterior["maxxpos"] = xpos if (xneg < resultInterior["leastxneg"]): resultInterior["leastxneg"] = xneg if (resultInterior["maxxneg"] < xneg): resultInterior["maxxneg"] = xneg if (ypos < resultInterior["leastypos"]): resultInterior["leastypos"] = ypos if (resultInterior["maxypos"] < ypos): resultInterior["maxypos"] = ypos if (yneg < resultInterior["leastyneg"]): resultInterior["leastyneg"] = yneg if (resultInterior["maxyneg"] < yneg): resultInterior["maxyneg"] = yneg else: resultInterior["_init"] = True resultInterior["leastxpos"] = xpos resultInterior["leastxneg"] = xneg resultInterior["leastypos"] = ypos resultInterior["leastyneg"] = yneg #Wall Points if (flag == 0): nbhs = core.convertIndexToPoints( core.getNeighbours(idx, globaldata), globaldata) curcord = core.getPointXY(idx, globaldata) xpos, xneg, _, _, _ = core.deltaNeighbourCalculationLegacy( nbhs, curcord, False, False) wall = wall + 1 waxpos = waxpos + xpos waxneg = waxneg + xneg if (resultWall["_init"] == True): if (xpos < resultWall["leastxpos"]): resultWall["leastxpos"] = xpos if (resultWall["maxxpos"] < xpos): resultWall["maxxpos"] = xpos if (xneg < resultWall["leastxneg"]): resultWall["leastxneg"] = xneg if (resultWall["maxxneg"] < xneg): resultWall["maxxneg"] = xneg else: resultWall["_init"] = True resultWall["leastxpos"] = xpos resultWall["leastxneg"] = xneg #Outer Points if (flag == 2): nbhs = core.convertIndexToPoints( core.getNeighbours(idx, globaldata), globaldata) curcord = core.getPointXY(idx, globaldata) xpos, xneg, _, _, _ = core.deltaNeighbourCalculationLegacy( nbhs, curcord, False, False) outer = outer + 1 ouxpos = ouxpos + xpos ouxneg = ouxneg + xneg if (resultOuter["_init"] == True): if (xpos < resultOuter["leastxpos"]): resultOuter["leastxpos"] = xpos if (resultOuter["maxxpos"] < xpos): resultOuter["maxxpos"] = xpos if (xneg < resultOuter["leastxneg"]): resultOuter["leastxneg"] = xneg if (resultOuter["maxxneg"] < xneg): resultOuter["maxxneg"] = xneg else: resultOuter["_init"] = True resultOuter["leastxpos"] = xpos resultOuter["leastxneg"] = xneg resultInterior["xposavg"] = float(round(inxpos / interior, 2)) resultInterior["xnegavg"] = float(round(inxneg / interior, 2)) resultInterior["yposavg"] = float(round(inypos / interior, 2)) resultInterior["ynegavg"] = float(round(inyneg / interior, 2)) resultInterior["total"] = interior resultOuter["xposavg"] = float(round(ouxpos / outer, 2)) resultOuter["xnegavg"] = float(round(ouxneg / outer, 2)) resultOuter["total"] = outer resultWall["xposavg"] = float(round(waxpos / wall, 2)) resultWall["xnegavg"] = float(round(waxneg / wall, 2)) resultWall["total"] = wall return resultWall, resultInterior, resultOuter
def main(): # Command Line Arguments parser = argparse.ArgumentParser() parser.add_argument("-i", "--input", const=str, nargs="?") args = parser.parse_args() np.seterr(divide='ignore') print("Loading Data") loaded = False try: file1 = open(args.input, "r") data = file1.read() globaldata = ["start"] splitdata = data.split("\n") splitdata = splitdata[:-1] print("Processed Pre-Processor File") print("Converting to readable format") for _, itm in enumerate(tqdm(splitdata)): itm = itm.split(" ") itm.pop(-1) entry = itm globaldata.append(entry) globaldata = core.cleanNeighbours(globaldata) wallpoints = core.getWallPointArray(globaldata) wallpointsData = core.generateWallPolygons(wallpoints) wallpointsall = list( map(int, core.flattenList(core.getWallPointArrayIndex(globaldata)))) loaded = True except: loaded = False conf = core.getConfig() # interiorpts = [] # interiorpts.extend(range(1, len(globaldata))) # interiorpts = core.convertPointToShapelyPoint(core.convertIndexToPoints(interiorpts,globaldata)) # interiorpts = MultiPoint(interiorpts) # interiortriangles = triangulate(interiorpts) # polydata = balance.getPolygon(interiortriangles) # plot 'preprocessorfile.txt' using 2:3:(sprintf("%d", $1)) with labels notitle core.clearScreen() while True and loaded: print("Type 'exit! to quit (Does not save changes).") print("Type 'exit to quit (Saves changes).") print("Type 'wcc' to run Wall Connectivity Check on all Wall Points.") print( "Type 'wcc!' to run Wall Connectivity Check on all Wall Points and return nearest point." ) print( "Type 'wcc!!' to run Wall Connectivity Check on all Wall Points and generate a corresponding sensor file." ) print( "Type 'wcc!!!' to run Wall Connectivity Check on all Wall Points and try fixing sparsity. (Wall Mode)" ) print( "Type 'wcc!!!!' to run Wall Connectivity Check on all Wall Points and try fixing sparsity. (Interior Mode)" ) print( "Type 'wcc!!!!!' to run Wall Connectivity Check on all Wall Points and just print them." ) print( "Type 'wcc!!!!!!' to run Wall Connectivity Check on all Wall Points and just print a interior point which can be bsplined." ) print( "Type 'icc' to run Interior Connectivity Check on all Interior Points." ) print("Type 'cache' to push the file you read into cache.") print("Type 'integrity' to check wall.json integrity") print("Type 'integrity!' to check wall.json integrity and fix it") print("Type 'full' to perform one full refinement") print("Type 'fullno' to perform one full refinement (excluding outer)") print("Type 'customrefine' to perform custom refinement") print("Type 'customrefine!' to perform custom box refinement") print("Type 'old' to convert preprocessorfile to old format") print( "Type 'bad2' to print all points with 2 in it's split connectivity" ) print( "Type 'bad1' to print all points with 1 in it's split connectivity" ) print("Type 'split' to output the different type of points in a file") print("Type 'blank' to blank multiple non leaf points") print("Type 'config' to start Config Manager") print("Type 'plot' to start Plot Manager") print("Type 'config' to start Config Manager") print("Type 'hills' to start Hills and Valleys Manager") print("Type 'normals' to write normals to 'file.dat'") print( "Type 'normals!' to write normals (including custom) to 'file.dat'" ) print( "Type 'maxnbhs' to output the maximum number of neighbours in the file." ) ptidx = input("Which point do you want to fix? ").lower() if ptidx == "exit!": exit() if ptidx == "exit": break elif ptidx == "hills": core.hills_manager() elif ptidx == "wcc": core.clearScreen() globaldata, _ = core.connectivityCheck(globaldata, wallpointsall, conf) core.wallConnectivityCheck(globaldata) elif ptidx == "wcc!": core.clearScreen() globaldata, _ = core.connectivityCheck(globaldata, wallpointsall, conf) core.wallConnectivityCheckNearest(globaldata) elif ptidx == "wcc!!": core.clearScreen() globaldata, _ = core.connectivityCheck(globaldata, wallpointsall, conf) core.wallConnectivityCheckSensor(globaldata) elif ptidx == "wcc!!!": core.clearScreen() globaldata, _ = core.connectivityCheck(globaldata, wallpointsall, conf) core.sparseNullifier(globaldata, flagCheck=0) elif ptidx == "wcc!!!!": core.clearScreen() globaldata, _ = core.connectivityCheck(globaldata, wallpointsall, conf) core.sparseNullifier(globaldata, flagCheck=1) elif ptidx == "wcc!!!!!": core.clearScreen() globaldata, _ = core.connectivityCheck(globaldata, wallpointsall, conf) core.wallConnectivityCheck(globaldata, verbose=True) elif ptidx == "wcc!!!!!!": core.clearScreen() globaldata, _ = core.connectivityCheck(globaldata, wallpointsall, conf) core.wallSmoother(globaldata, conf) elif ptidx == "icc": core.clearScreen() core.interiorConnectivityCheck(globaldata, offset=len(wallpointsall)) elif ptidx == "cache": core.clearScreen() core.pushCache(globaldata) elif ptidx == "integrity": core.clearScreen() core.verifyIntegrity() elif ptidx == "integrity!": core.clearScreen() core.fixWallIntegrity() elif ptidx == "full": core.clearScreen() core.fullRefine(globaldata) elif ptidx == "fullno": core.clearScreen() core.fullRefineOuter(globaldata) elif ptidx == "customrefine": core.clearScreen() core.refineCustom(globaldata) elif ptidx == "customrefine!": core.clearScreen() core.refineCustomBox(globaldata) elif ptidx == "old": core.clearScreen() core.oldMode(globaldata) elif ptidx == "bad2": core.clearScreen() globaldata, _ = core.connectivityCheck(globaldata, None, conf) core.printBadness(2, globaldata) elif ptidx == "bad1": core.clearScreen() globaldata, _ = core.connectivityCheck(globaldata, None, conf) core.printBadness(1, globaldata) elif ptidx == "split": core.clearScreen() core.splitWrite(globaldata) elif ptidx == "config": core.clearScreen() core.configManager() elif ptidx == "blank": core.clearScreen() core.blankMultiple(globaldata, conf) elif ptidx == "plot": core.clearScreen() core.plotManager(globaldata, wallpoints) elif ptidx == "normals": temp.writeNormalsToText(globaldata, conf) core.clearScreen() elif ptidx == "normals!": temp.writeNormalsAllCustom(globaldata, conf) core.clearScreen() elif ptidx == "maxnbhs": core.clearScreen() core.maxNeighbours(globaldata) elif ptidx == "clear": core.clearScreen() isPointIndex = False try: ptidx = int(ptidx) isPointIndex = True except ValueError: isPointIndex = False pass if isPointIndex == True: core.clearScreen() print("Point Index:", ptidx) print("Point Co ordinate:", core.getPointXY(ptidx, globaldata)) flag = core.getFlag(ptidx, globaldata) flag = int(flag) if flag == 0: flagd = "Wall Point" elif flag == 1: flagd = "Interior Point" else: flagd = "Outer Point" print("Point Type:", flagd) nbhs = core.getNeighbours(ptidx, globaldata) print("Total Number of Neighbours:", len(nbhs)) print("Neighbour Array") print(nbhs) if (flag == 0): print(core.getConditionNumberNew(ptidx, globaldata, conf)) xpos = core.getXPosPoints(ptidx, globaldata, conf) xneg = core.getXNegPoints(ptidx, globaldata, conf) ypos = core.getYPosPoints(ptidx, globaldata, conf) yneg = core.getYNegPoints(ptidx, globaldata, conf) print("xpos", len(xpos), "xneg", len(xneg)) else: print(core.getConditionNumberNew(ptidx, globaldata, conf)) xpos = core.getXPosPoints(ptidx, globaldata, conf) xneg = core.getXNegPoints(ptidx, globaldata, conf) ypos = core.getYPosPoints(ptidx, globaldata, conf) yneg = core.getYNegPoints(ptidx, globaldata, conf) print("xpos", len(xpos), "xneg", len(xneg), "ypos", len(ypos), "yneg", len(yneg)) nx, ny = core.getNormals(ptidx, globaldata, conf) leaf = core.isLeafPoint(ptidx, globaldata) print("Leaf Point: {}".format(leaf)) print("nx = {} ny = {}".format(nx, ny)) print("Select Point Repair Option") print("(1) Exit") print("(2) Exit without saving any changes") print("(3) Go Back") print("(4) Find nearest distance to wall points") print("(5) Print Detailed Connectivity") print("(6) Adapt the point") print("(7) Blank the point") whatkind = int(input("What option do you want to select? ")) if whatkind == 1: core.clearScreen() break elif whatkind == 2: exit() elif whatkind == 3: core.clearScreen() elif whatkind == 4: core.clearScreen() px, py = core.getPoint(ptidx, globaldata) print("Nearest Distance: {}".format( min(core.wallDistance((px, py), wallpointsData)))) elif whatkind == 5: core.clearScreen() print("xpos connectivity: {}, no. of xpos: {}".format( core.convertPointsToIndex(xpos, globaldata), len(xpos))) print("xneg connectivity: {}, no. of xneg: {}".format( core.convertPointsToIndex(xneg, globaldata), len(xneg))) print("ypos connectivity: {}, no. of ypos: {}".format( core.convertPointsToIndex(ypos, globaldata), len(ypos))) print("yneg connectivity: {}, no. of yneg: {}".format( core.convertPointsToIndex(yneg, globaldata), len(yneg))) elif whatkind == 6: core.clearScreen() core.adaptPoint(ptidx, globaldata) elif whatkind == 7: core.clearScreen() core.blankPoint(ptidx, globaldata) else: core.clearScreen() break if loaded: globaldata.pop(0) with open("preprocessorfile_tools.txt", "w") as text_file: for item1 in globaldata: text_file.writelines(["%s " % item for item in item1]) text_file.writelines("\n") else: while True: print("Type 'integrity' to check wall.json integrity") print("Type 'integrity!' to check wall.json integrity and fix it") print("Type 'config' to start Config Manager") print("Type 'hills' to start Hills and Valleys Manager") print("Type 'exit' to exit") ptidx = input("Enter command: ").lower() if ptidx == "integrity": core.clearScreen() core.verifyIntegrity() elif ptidx == "integrity!": core.clearScreen() core.fixWallIntegrity() elif ptidx == "config": core.clearScreen() core.configManager() elif ptidx == "hills": core.clearScreen() core.hills_manager() elif ptidx == "exit": exit()