Skip to content

Commit

Permalink
Fix EFT issues for bifurcations
Browse files Browse the repository at this point in the history
  • Loading branch information
oneway1225 committed Sep 6, 2024
1 parent 06d7c33 commit 6439219
Showing 1 changed file with 10 additions and 30 deletions.
40 changes: 10 additions & 30 deletions src/scaffoldmaker/utils/tubenetworkmesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,8 @@ def __init__(self, inSegments: list, outSegments: list):
# list[box index] giving list[(segment number, node index across major axis, node index across minor axis)]
self._segmentNodeToBoxIndex = []
# list[segment number][node index across major axis][node index across minor axis] to boxIndex
self._triplePointLocationsList = []
# list[[node Id, location], ...] used to match ETFs at triple points

def _calculateTrimSurfaces(self):
"""
Expand Down Expand Up @@ -2337,7 +2339,8 @@ def _generateTransitionElements(self, s, n2, mesh, elementtemplate, coordinates,
nodeLayouts.append(nodeLayoutTransitionTriplePoint if n1 in triplePointIndexesList
else nodeLayoutTransition)
for n1 in [e1, n1p]:
nids.append(boxBoundaryNodeIds[n1])
nid = boxBoundaryNodeIds[n1]
nids.append(nid)
n3c, n1c = boxBoundaryNodeToBoxId[n1]
boxIndex = self._segmentNodeToBoxIndex[s][n3c][n1c]
nodeParameters.append(self._getBoxCoordinates(boxIndex))
Expand Down Expand Up @@ -2366,35 +2369,12 @@ def _generateTransitionElements(self, s, n2, mesh, elementtemplate, coordinates,
nodeLayout = nodeLayout8Way
elif n1 in triplePointIndexesList: # triple-point node
location = oLocation
if self._segmentsCount == 3: # bifurcation
sequence = self._sequence
condition1 = oLocation > 0
condition2 = oLocation < 0
if self._segmentsIn.count(True) == 0:
condition = condition1 if sequence == [0, 2, 1] else condition2
location *= -1 if s == 2 or (s == 1 and condition) else 1
elif self._segmentsIn.count(True) == 1:
condition = condition1 if sequence == [0, 2, 1] else condition2
location *= -1 if s == 2 and condition else 1
elif self._segmentsIn.count(True) == 2:
condition = condition2 if sequence == [0, 2, 1] else condition1
location *= -1 if s == 1 and condition else 1
elif self._segmentsIn.count(True) == 3:
condition = condition2 if sequence == [0, 2, 1] else condition1
location *= -1 if (s == 1 and condition) or (s == 2) else 1
elif self._segmentsCount == 4: # trifurcation
sequence = self._sequence
s0 = (s - 1) % self._segmentsCount
s1 = (s + 1) % self._segmentsCount
if sequence == [0, 1, 3, 2]:
if self._segmentsIn == [True, False, False, False] and self._segmentsIn[s1]:
location = (oLocation) * -1
elif self._segmentsIn == [True, True, False, False] and \
self._segmentsIn[s] != self._segmentsIn[s1]:
location = abs(oLocation)
elif sequence == [0, 1, 2, 3] and \
(self._segmentsIn[s1] or all(not self._segmentsIn[n] for n in [s, s0, s1])):
location = abs(oLocation)
if ((s < segmentNodesCount - 1) and n1 == n1p or
not any(nid in sl for sl in self._triplePointLocationsList)):
self._triplePointLocationsList.append([nid, location])
if s > 0:
for sl in self._triplePointLocationsList:
location = sl[1] if nid == sl[0] else location
nodeLayout = generateData.getNodeLayoutTransitionTriplePoint(location)
else:
nodeLayout = nodeLayoutTransition
Expand Down

0 comments on commit 6439219

Please sign in to comment.