Skip to content

Commit 8340b92

Browse files
committed
code: added flag 3 - 6 feature
1 parent c088d8f commit 8340b92

File tree

5 files changed

+1179
-1130
lines changed

5 files changed

+1179
-1130
lines changed

generator/generate.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ def main():
4747
printOuterConditionValue(index,globaldata,hashtable)
4848
printOuterConditionValue(index,globaldata,hashtable)
4949

50+
for index, item in enumerate(hashtable[1:]):
51+
if(getFlag(index,globaldata)==1):
52+
globaldata = setPosDeltaFlags(index,globaldata,hashtable,10000) #Threshold for Flag 3 - 6
53+
5054
for index, item in enumerate(hashtable[1:]):
5155
if(getFlag(index,globaldata)==1):
5256
conditionValueFixForYPos(index,globaldata,hashtable,15)

generator/interior.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,4 +326,25 @@ def printPosDeltaConditions(index,globaldata,hashtable,threshold):
326326
initialConditionValueYNeg = getInteriorConditionValueofYNeg(index,globaldata,hashtable)
327327
dSPointYNeg = getDYNegPoints(index,globaldata,hashtable)
328328
if(initialConditionValueXNeg > threshold or initialConditionValueXPos > threshold or initialConditionValueYPos > threshold or initialConditionValueYNeg > threshold):
329-
print(index,len(dSPointXPos),initialConditionValueXPos,len(dSPointXNeg),initialConditionValueXNeg,len(dSPointYPos),initialConditionValueYPos,len(dSPointYNeg),initialConditionValueYNeg)
329+
print(index,len(dSPointXPos),initialConditionValueXPos,len(dSPointXNeg),initialConditionValueXNeg,len(dSPointYPos),initialConditionValueYPos,len(dSPointYNeg),initialConditionValueYNeg)
330+
331+
def setPosDeltaFlags(index,globaldata,hashtable,threshold):
332+
initialConditionValueXPos = getInteriorConditionValueofXPos(index,globaldata,hashtable)
333+
dSPointXPos = getDXPosPoints(index,globaldata,hashtable)
334+
initialConditionValueXNeg = getInteriorConditionValueofXNeg(index,globaldata,hashtable)
335+
dSPointXNeg = getDXNegPoints(index,globaldata,hashtable)
336+
initialConditionValueYPos = getInteriorConditionValueofYPos(index,globaldata,hashtable)
337+
dSPointYPos = getDYPosPoints(index,globaldata,hashtable)
338+
initialConditionValueYNeg = getInteriorConditionValueofYNeg(index,globaldata,hashtable)
339+
dSPointYNeg = getDYNegPoints(index,globaldata,hashtable)
340+
if(initialConditionValueXPos > threshold):
341+
globaldata = setFlagValue(index,7,1,globaldata)
342+
if(initialConditionValueXNeg > threshold):
343+
globaldata = setFlagValue(index,8,1,globaldata)
344+
if(initialConditionValueYPos > threshold):
345+
globaldata = setFlagValue(index,9,1,globaldata)
346+
if(initialConditionValueYNeg > threshold):
347+
globaldata = setFlagValue(index,10,1,globaldata)
348+
return globaldata
349+
350+

generator/load.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ def loadWall(geometrydata):
2727
walldata.insert(4,index+1)
2828
walldata.insert(5,0)
2929
walldata.insert(6,1)
30+
walldata.insert(7,0)
31+
walldata.insert(8,0)
32+
walldata.insert(9,0)
33+
walldata.insert(10,0)
3034
globaldata.append(walldata)
3135
index+=1
3236
# Last Point
@@ -38,6 +42,10 @@ def loadWall(geometrydata):
3842
walldata.insert(4,1)
3943
walldata.insert(5,0)
4044
walldata.insert(6,1)
45+
walldata.insert(7,0)
46+
walldata.insert(8,0)
47+
walldata.insert(9,0)
48+
walldata.insert(10,0)
4149
globaldata.append(walldata)
4250
index+=1
4351
# Other Points
@@ -49,6 +57,10 @@ def loadWall(geometrydata):
4957
walldata.insert(4,index+1)
5058
walldata.insert(5,0)
5159
walldata.insert(6,1)
60+
walldata.insert(7,0)
61+
walldata.insert(8,0)
62+
walldata.insert(9,0)
63+
walldata.insert(10,0)
5264
globaldata.append(walldata)
5365
index+=1
5466
print("Wall Point Processed")
@@ -91,6 +103,10 @@ def loadInterior(data,hashtable,globaldata,index):
91103
cleandata.pop(0)
92104
cleandata.insert(0,cleandata[len(cleandata)-1])
93105
cleandata.pop(-1)
106+
cleandata.insert(0,0)
107+
cleandata.insert(0,0)
108+
cleandata.insert(0,0)
109+
cleandata.insert(0,0)
94110
cleandata.insert(0,1)
95111
cleandata.insert(0,1)
96112
cleandata.insert(0,0)
@@ -107,6 +123,10 @@ def loadInterior(data,hashtable,globaldata,index):
107123
cleandata.pop(0)
108124
cleandata.insert(0,cleandata[len(cleandata)-1])
109125
cleandata.pop(-1)
126+
cleandata.insert(0,0)
127+
cleandata.insert(0,0)
128+
cleandata.insert(0,0)
129+
cleandata.insert(0,0)
110130
cleandata.insert(0,1)
111131
cleandata.insert(0,1)
112132
cleandata.insert(0,0)

generator/misc.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ def cleanNeighbours(globaldata): # Verified
55
print("Beginning Duplicate Neighbour Detection")
66
for i in range(len(globaldata)):
77
printProgressBar(i, len(globaldata) - 1, prefix = 'Progress:', suffix = 'Complete', length = 50)
8-
noneighours = int(globaldata[i][7]) # Nuber of neighbours
8+
noneighours = int(globaldata[i][11]) # Number of neighbours
99
cordneighbours = globaldata[i][-noneighours:]
1010

1111
# TODO - Ask, why get the same thing as above?
1212
cordneighbours = [str(float(i.split(",")[0])) + "," + str(float(i.split(",")[1])) for i in cordneighbours]
1313

1414
cordneighbours = dict.fromkeys(cordneighbours).keys()
1515
noneighours = len(cordneighbours)
16-
globaldata[i] = globaldata[i][:7] + [noneighours] + list(cordneighbours)
16+
globaldata[i] = globaldata[i][:11] + [noneighours] + list(cordneighbours)
1717
# with open("duplication_removal.txt", "w") as text_file:
1818
# for item1 in globaldata:
1919
# text_file.writelines(["%s " % item for item in item1])
@@ -31,10 +31,10 @@ def getIndexOf(pointxy,hashtable):
3131
def getNeighbours(indexval,list):
3232
val = []
3333
pointdata = list[indexval]
34-
numbneigh = int(pointdata[7])
34+
numbneigh = int(pointdata[11])
3535
try:
3636
for i in range(numbneigh):
37-
val = val + [str(pointdata[i+8])]
37+
val = val + [str(pointdata[i+12])]
3838
except Exception:
3939
pass
4040
return val
@@ -156,6 +156,10 @@ def getRightPoint(cord,globaldata,hashtable):
156156
else:
157157
return hashtable.index(rightpt)
158158

159+
def setFlagValue(index,flagindex,value,globaldata):
160+
globaldata[index][flagindex] = value
161+
return globaldata
162+
159163
def takeFirst(elem):
160164
return elem[0]
161165

@@ -167,12 +171,12 @@ def euclideanDistance(a,b):
167171
return (float(math.sqrt(((bx-ax)**2)+((by-ay)**2))),a)
168172

169173
def appendNeighbours(neighbours,index,globaldata):
170-
nbhcount = int(globaldata[index][7])
174+
nbhcount = int(globaldata[index][11])
171175
nbhs = globaldata[index][-nbhcount:]
172176
nbhs = nbhs + neighbours
173177
nbhcount = nbhcount + len(neighbours)
174-
globaldata[index][7] = nbhcount
175-
globaldata[index] = globaldata[index][:8] + nbhs
178+
globaldata[index][11] = nbhcount
179+
globaldata[index] = globaldata[index][:12] + nbhs
176180
return "Done"
177181

178182
def cleanWallPoints(neighbours,wallpoint):

0 commit comments

Comments
 (0)