Skip to content

Commit

Permalink
Merge pull request #29 from rchristie/heart1
Browse files Browse the repository at this point in the history
Add new heart1 scaffold
  • Loading branch information
rchristie authored Nov 16, 2018
2 parents bbfde9b + 713f890 commit 65c1ed8
Show file tree
Hide file tree
Showing 10 changed files with 1,686 additions and 124 deletions.
19 changes: 18 additions & 1 deletion scaffoldmaker/annotation/annotationgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,37 @@ def getGroup(self):
def getFieldElementGroup(self, mesh):
'''
:param mesh: The Zinc mesh to manage a sub group of.
:return: The Zinc meshGroup for adding elements of mesh in this AnnotationGroup.
:return: The Zinc element group field for mesh in this AnnotationGroup.
'''
elementGroup = self._group.getFieldElementGroup(mesh)
if not elementGroup.isValid():
elementGroup = self._group.createFieldElementGroup(mesh)
return elementGroup

def getFieldNodeGroup(self, nodeset):
'''
:param nodeset: The Zinc nodeset to manage a sub group of.
:return: The Zinc node group field for nodeset in this AnnotationGroup.
'''
nodeGroup = self._group.getFieldNodeGroup(nodeset)
if not nodeGroup.isValid():
nodeGroup = self._group.createFieldNodeGroup(nodeset)
return nodeGroup

def getMeshGroup(self, mesh):
'''
:param mesh: The Zinc mesh to manage a sub group of.
:return: The Zinc meshGroup for adding elements of mesh in this AnnotationGroup.
'''
return self.getFieldElementGroup(mesh).getMeshGroup()

def getNodesetGroup(self, nodeset):
'''
:param nodeset: The Zinc nodeset to manage a sub group of.
:return: The Zinc nodesetGroup for adding nodes from nodeset in this AnnotationGroup.
'''
return self.getFieldNodeGroup(nodeset).getNodesetGroup()

def addSubelements(self):
'''
Call after group is complete and faces have been defined to add faces and
Expand Down
401 changes: 401 additions & 0 deletions scaffoldmaker/meshtypes/meshtype_3d_heart1.py

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions scaffoldmaker/meshtypes/meshtype_3d_heart2.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,13 @@ def getOrderedOptionNames():

@staticmethod
def checkOptions(options):
MeshType_3d_heartventriclesbase2.checkOptions(options)
MeshType_3d_heartatria2.checkOptions(options)
dependentChanges = MeshType_3d_heartventriclesbase2.checkOptions(options) \
or MeshType_3d_heartatria2.checkOptions(options)
# only works with particular numbers of elements around
options['Number of elements around atrial septum'] = 2
# set dependent outer diameter used in atria2
options['LV outlet outer diameter'] = options['LV outlet inner diameter'] + 2.0*options['LV outlet wall thickness']
return dependentChanges

@classmethod
def generateBaseMesh(cls, region, options):
Expand Down
108 changes: 70 additions & 38 deletions scaffoldmaker/meshtypes/meshtype_3d_heartatria1.py

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions scaffoldmaker/meshtypes/meshtype_3d_heartatria2.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ def getOrderedOptionNames():

@staticmethod
def checkOptions(options):
'''
:return: True if dependent options changed, otherwise False. This
happens where two or more options must change together to be valid.
Here the number of elements around atrial free wall must be an even number,
but the parameter is number of elements around atria, which depends on
number of elements around atrial septum.
'''
dependentChanges = False
if options['Number of elements around atria'] < 6:
options['Number of elements around atria'] = 6
if options['Number of elements around atrial septum'] < 1:
Expand All @@ -98,6 +106,7 @@ def checkOptions(options):
# need even number of elements around free wall
if ((options['Number of elements around atria'] - options['Number of elements around atrial septum']) % 2) == 1:
options['Number of elements around atria'] += 1
dependentChanges = True
if options['Number of elements up atria'] < 3:
options['Number of elements up atria'] = 3
for key in [
Expand Down Expand Up @@ -138,6 +147,7 @@ def checkOptions(options):
'Refine number of elements through atrial wall']:
if options[key] < 1:
options[key] = 1
return dependentChanges

@classmethod
def generateBaseMesh(cls, region, options):
Expand Down
114 changes: 64 additions & 50 deletions scaffoldmaker/meshtypes/meshtype_3d_heartventricles1.py

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions scaffoldmaker/meshtypes/meshtype_3d_heartventricles2.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ def getOrderedOptionNames():

@staticmethod
def checkOptions(options):
'''
:return: True if dependent options changed, otherwise False.
'''
dependentChanges = False
for key in [
'Refine number of elements surface',
'Refine number of elements through LV wall',
Expand Down Expand Up @@ -112,6 +116,7 @@ def checkOptions(options):
options['RV arc around degrees'] = 45.0
elif options['RV arc around degrees'] > 270.0:
options['RV arc around degrees'] = 270.0
return dependentChanges

@classmethod
def generateBaseMesh(cls, region, options):
Expand Down
1,135 changes: 1,104 additions & 31 deletions scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase2.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def getDefaultOptions():
options['Number of elements around LV free wall'] = 5
options['Number of elements around ventricular septum'] = 7
options['Number of elements around atria'] = 8
options['Number of elements around atrial septum'] = 2
# works best with particular numbers of elements up
options['Number of elements up LV apex'] = 1
options['Number of elements up ventricular septum'] = 4
Expand All @@ -64,6 +65,7 @@ def getDefaultOptions():
def getOrderedOptionNames():
optionNames = MeshType_3d_heartventricles2.getOrderedOptionNames()
optionNames.insert(4, 'Number of elements around atria')
optionNames.insert(5, 'Number of elements around atrial septum')
optionNames += [
'Atria base inner major axis length',
'Atria base inner minor axis length',
Expand Down Expand Up @@ -93,11 +95,15 @@ def getOrderedOptionNames():

@staticmethod
def checkOptions(options):
MeshType_3d_heartventricles2.checkOptions(options)
'''
:return: True if dependent options changed, otherwise False.
'''
dependentChanges = MeshType_3d_heartventricles2.checkOptions(options)
# only works with particular numbers of elements around
options['Number of elements around LV free wall'] = 5
options['Number of elements around ventricular septum'] = 7
options['Number of elements around atria'] = 8
options['Number of elements around atrial septum'] = 2
for key in [
'Atria base inner major axis length',
'Atria base inner minor axis length',
Expand All @@ -119,6 +125,7 @@ def checkOptions(options):
options['Atria major axis rotation degrees'] = -75.0
elif options['Atria major axis rotation degrees'] > 75.0:
options['Atria major axis rotation degrees'] = 75.0
return dependentChanges

@classmethod
def generateBaseMesh(cls, region, options):
Expand All @@ -136,8 +143,8 @@ def generateBaseMesh(cls, region, options):
elementsCountUpLV = elementsCountUpLVApex + elementsCountUpVSeptum
elementsCountUpRV = elementsCountUpVSeptum + 1
elementsCountAroundRV = elementsCountAroundVSeptum + 2
elementsCountAtrialSeptum = 2 # elementsCountAroundVSeptum - 5
elementsCountAroundAtria = options['Number of elements around atria']
elementsCountAtrialSeptum = options['Number of elements around atrial septum']
lvOuterHeight = options['LV outer height']
lvOuterRadius = options['LV outer radius']
lvFreeWallThickness = options['LV free wall thickness']
Expand Down
2 changes: 2 additions & 0 deletions scaffoldmaker/scaffolds.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from scaffoldmaker.meshtypes.meshtype_3d_box1 import MeshType_3d_box1
from scaffoldmaker.meshtypes.meshtype_3d_boxhole1 import MeshType_3d_boxhole1
from scaffoldmaker.meshtypes.meshtype_3d_centrallinetube1 import MeshType_3d_centrallinetube1
from scaffoldmaker.meshtypes.meshtype_3d_heart1 import MeshType_3d_heart1
from scaffoldmaker.meshtypes.meshtype_3d_heart2 import MeshType_3d_heart2
from scaffoldmaker.meshtypes.meshtype_3d_heartatria1 import MeshType_3d_heartatria1
from scaffoldmaker.meshtypes.meshtype_3d_heartatria2 import MeshType_3d_heartatria2
Expand All @@ -35,6 +36,7 @@ def __init__(self):
MeshType_3d_box1,
MeshType_3d_boxhole1,
MeshType_3d_centrallinetube1,
MeshType_3d_heart1,
MeshType_3d_heart2,
MeshType_3d_heartatria1,
MeshType_3d_heartatria2,
Expand Down

0 comments on commit 65c1ed8

Please sign in to comment.