Skip to content

Commit

Permalink
Improve midpoint sampling
Browse files Browse the repository at this point in the history
Fix some tube bifuraction cases. Use core box major/minor internally
  • Loading branch information
rchristie committed Oct 14, 2024
1 parent 09c3e60 commit 5bf3246
Show file tree
Hide file tree
Showing 6 changed files with 303 additions and 221 deletions.
11 changes: 2 additions & 9 deletions src/scaffoldmaker/meshtypes/meshtype_3d_tubenetwork1.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,6 @@ def generateBaseMesh(cls, region, options):
defaultCoreMajorCount = defaultAroundCount // 2 - defaultCoreBoxMinorCount + 2 * coreTransitionCount
annotationAroundCounts = options["Annotation numbers of elements around"]
annotationCoreBoxMinorCounts = options["Annotation numbers of elements across core box minor"]
annotationCoreMajorCounts = []
for i in range(len(annotationCoreBoxMinorCounts)):
aroundCount = annotationAroundCounts[i] if annotationAroundCounts[i] \
else defaultAroundCount
coreBoxMinorCount = annotationCoreBoxMinorCounts[i] if annotationCoreBoxMinorCounts[i] \
else defaultCoreBoxMinorCount
annotationCoreMajorCounts.append(aroundCount // 2 - coreBoxMinorCount + 2 * coreTransitionCount)

tubeNetworkMeshBuilder = TubeNetworkMeshBuilder(
networkMesh,
Expand All @@ -238,9 +231,9 @@ def generateBaseMesh(cls, region, options):
layoutAnnotationGroups=layoutAnnotationGroups,
annotationElementsCountsAlong=options["Annotation numbers of elements along"],
annotationElementsCountsAround=annotationAroundCounts,
defaultElementsCountAcrossMajor=defaultCoreMajorCount,
defaultElementsCountCoreBoxMinor=defaultCoreBoxMinorCount,
elementsCountTransition=coreTransitionCount,
annotationElementsCountsAcrossMajor=annotationCoreMajorCounts,
annotationElementsCountsCoreBoxMinor=annotationCoreBoxMinorCounts,
isCore=options["Core"],
useOuterTrimSurfaces=options["Use outer trim surfaces"])

Expand Down
17 changes: 6 additions & 11 deletions src/scaffoldmaker/meshtypes/meshtype_3d_wholebody2.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,13 +633,13 @@ class WholeBodyNetworkMeshBuilder(TubeNetworkMeshBuilder):
def __init__(self, networkMesh: NetworkMesh, targetElementDensityAlongLongestSegment: float,
defaultElementsCountAround: int, elementsCountThroughWall: int, layoutAnnotationGroups: list = [],
annotationElementsCountsAlong: list = [], annotationElementsCountsAround: list = [],
defaultElementsCountAcrossMajor: int = 4, elementsCountTransition: int = 1,
annotationElementsCountsAcrossMajor: list = [], isCore=False, useOuterTrimSurfaces=True):
defaultElementsCountCoreBoxMinor: int = 2, elementsCountTransition: int = 1,
annotationElementsCountsCoreBoxMinor: list = [], isCore=False, useOuterTrimSurfaces=True):
super(WholeBodyNetworkMeshBuilder, self).__init__(
networkMesh, targetElementDensityAlongLongestSegment, defaultElementsCountAround,
elementsCountThroughWall, layoutAnnotationGroups,
annotationElementsCountsAlong, annotationElementsCountsAround, defaultElementsCountAcrossMajor,
elementsCountTransition, annotationElementsCountsAcrossMajor, isCore, useOuterTrimSurfaces)
annotationElementsCountsAlong, annotationElementsCountsAround, defaultElementsCountCoreBoxMinor,
elementsCountTransition, annotationElementsCountsCoreBoxMinor, isCore, useOuterTrimSurfaces)

def generateMesh(self, generateData):
super(WholeBodyNetworkMeshBuilder, self).generateMesh(generateData)
Expand Down Expand Up @@ -872,11 +872,9 @@ def generateBaseMesh(cls, region, options):
annotationAlongCounts = []
annotationAroundCounts = []
# implementation currently uses major count including transition
annotationCoreMajorCounts = []
for layoutAnnotationGroup in layoutAnnotationGroups:
alongCount = 0
aroundCount = 0
coreMajorCount = 0
name = layoutAnnotationGroup.getName()
if "head" in name:
alongCount = elementsCountAlongHead
Expand All @@ -902,11 +900,8 @@ def generateBaseMesh(cls, region, options):
elif "foot" in name:
alongCount = elementsCountAlongFoot
aroundCount = elementsCountAroundLeg
if aroundCount:
coreMajorCount = aroundCount // 2 - coreBoxMinorCount + 2 * coreTransitionCount
annotationAlongCounts.append(alongCount)
annotationAroundCounts.append(aroundCount)
annotationCoreMajorCounts.append(coreMajorCount)
isCore = options["Use Core"]

tubeNetworkMeshBuilder = WholeBodyNetworkMeshBuilder(
Expand All @@ -917,9 +912,9 @@ def generateBaseMesh(cls, region, options):
layoutAnnotationGroups=layoutAnnotationGroups,
annotationElementsCountsAlong=annotationAlongCounts,
annotationElementsCountsAround=annotationAroundCounts,
defaultElementsCountAcrossMajor=annotationCoreMajorCounts[-1],
defaultElementsCountCoreBoxMinor=coreBoxMinorCount,
elementsCountTransition=coreTransitionCount,
annotationElementsCountsAcrossMajor=annotationCoreMajorCounts,
annotationElementsCountsCoreBoxMinor=[],
isCore=isCore)

meshDimension = 3
Expand Down
Loading

0 comments on commit 5bf3246

Please sign in to comment.