Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit scale parameter #31

Merged
merged 2 commits into from
Nov 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 25 additions & 21 deletions scaffoldmaker/meshtypes/meshtype_3d_heartatria1.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,19 @@ def getDefaultOptions():
'Number of elements around atrial septum' : 3,
'Number of elements up atria' : 4,
'Number of elements inlet' : 2,
'Unit scale' : 1.0,
'Atria base inner major axis length' : 0.55,
'Atria base inner minor axis length' : 0.42,
'Atria base inner minor axis length' : 0.45,
'Atria major axis rotation degrees' : 40.0,
'Atria outer height' : 0.45,
'Atrial septum thickness' : 0.08,
'Atrial septum thickness' : 0.07,
'Atrial free wall thickness' : 0.02,
'Atrial base wall thickness' : 0.05,
'Atrial base wall thickness' : 0.07,
'Atrial base slope degrees' : 30.0,
'Aorta outer plus diameter' : 0.35,
'Atrial base front incline degrees' : 15.0,
'Atrial base back incline degrees' : 30.0,
'Atrial base side incline degrees' : 10.0,
'Atrial base back incline degrees' : 20.0,
'Atrial base side incline degrees' : 20.0,
'Atrial element size ratio anterior/posterior' : 1.5,
'Left pulmonary vein position up' : 0.6,
'Left pulmonary vein angle up degrees' : 10.0,
Expand Down Expand Up @@ -79,6 +80,7 @@ def getOrderedOptionNames():
'Number of elements around atrial septum',
'Number of elements up atria',
'Number of elements inlet',
'Unit scale',
'Atria base inner major axis length',
'Atria base inner minor axis length',
'Atria major axis rotation degrees',
Expand Down Expand Up @@ -137,6 +139,7 @@ def checkOptions(options):
if options['Number of elements inlet'] < 1:
options['Number of elements inlet'] = 1
for key in [
'Unit scale',
'Atria base inner major axis length',
'Atria base inner minor axis length',
'Atria outer height',
Expand Down Expand Up @@ -199,41 +202,42 @@ def generateBaseMesh(cls, region, options):
elementsCountAroundAtria = elementsCountAroundAtrialFreeWall + elementsCountAroundAtrialSeptum
elementsCountUpAtria = options['Number of elements up atria']
elementsCountInlet = options['Number of elements inlet']
aBaseInnerMajorMag = 0.5*options['Atria base inner major axis length']
aBaseInnerMinorMag = 0.5*options['Atria base inner minor axis length']
unitScale = options['Unit scale']

aBaseInnerMajorMag = unitScale*0.5*options['Atria base inner major axis length']
aBaseInnerMinorMag = unitScale*0.5*options['Atria base inner minor axis length']
aMajorAxisRadians = math.radians(options['Atria major axis rotation degrees'])
aOuterHeight = options['Atria outer height']
aortaOuterPlusRadius = 0.5*options['Aorta outer plus diameter']
aOuterHeight = unitScale*options['Atria outer height']
aortaOuterPlusRadius = unitScale*0.5*options['Aorta outer plus diameter']
aBaseFrontInclineRadians = math.radians(options['Atrial base front incline degrees'])
aBaseSideInclineRadians = math.radians(options['Atrial base side incline degrees'])
aBaseBackInclineRadians = math.radians(options['Atrial base back incline degrees'])
aElementSizeRatioAnteriorPosterior = options['Atrial element size ratio anterior/posterior']
#aortaAxis = [ 0.0, math.sin(aortaInclineRadians), math.cos(aortaInclineRadians) ]
aSeptumThickness = options['Atrial septum thickness']
aFreeWallThickness = options['Atrial free wall thickness']
aBaseWallThickness = options['Atrial base wall thickness']
aSeptumThickness = unitScale*options['Atrial septum thickness']
aFreeWallThickness = unitScale*options['Atrial free wall thickness']
aBaseWallThickness = unitScale*options['Atrial base wall thickness']
aBaseSlopeRadians = math.radians(options['Atrial base slope degrees'])
lpvPositionUp = options['Left pulmonary vein position up']
lpvAngleUpRadians = math.radians(options['Left pulmonary vein angle up degrees'])
lpvLengthFactor = options['Left pulmonary vein length factor']
lpvInnerRadius = 0.5*options['Left pulmonary vein inner diameter']
lpvWallThickness = options['Left pulmonary vein wall thickness']
lpvInnerRadius = unitScale*0.5*options['Left pulmonary vein inner diameter']
lpvWallThickness = unitScale*options['Left pulmonary vein wall thickness']
rpvPositionUp = options['Right pulmonary vein position up']
rpvAngleUpRadians = math.radians(options['Right pulmonary vein angle up degrees'])
rpvLengthFactor = options['Right pulmonary vein length factor']
rpvInnerRadius = 0.5*options['Right pulmonary vein inner diameter']
rpvWallThickness = options['Right pulmonary vein wall thickness']
rpvInnerRadius = unitScale*0.5*options['Right pulmonary vein inner diameter']
rpvWallThickness = unitScale*options['Right pulmonary vein wall thickness']
ivcPositionUp = options['Inferior vena cava position up']
ivcAngleUpRadians = math.radians(options['Inferior vena cava angle up degrees'])
ivcAngleLeftRadians = math.radians(options['Inferior vena cava angle left degrees'])
ivcLengthFactor = options['Inferior vena cava length factor']
ivcInnerRadius = 0.5*options['Inferior vena cava inner diameter']
ivcWallThickness = options['Inferior vena cava wall thickness']
ivcInnerRadius = unitScale*0.5*options['Inferior vena cava inner diameter']
ivcWallThickness = unitScale*options['Inferior vena cava wall thickness']
svcPositionUp = options['Superior vena cava position up']
svcAngleUpRadians = math.radians(options['Superior vena cava angle up degrees'])
svcLengthFactor = options['Superior vena cava length factor']
svcInnerRadius = 0.5*options['Superior vena cava inner diameter']
svcWallThickness = options['Superior vena cava wall thickness']
svcInnerRadius = unitScale*0.5*options['Superior vena cava inner diameter']
svcWallThickness = unitScale*options['Superior vena cava wall thickness']
useCrossDerivatives = options['Use cross derivatives']

fm = region.getFieldmodule()
Expand Down
37 changes: 21 additions & 16 deletions scaffoldmaker/meshtypes/meshtype_3d_heartventricles1.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,18 @@ def getDefaultOptions():
'Number of elements around RV free wall' : 7,
'Number of elements up LV apex' : 1,
'Number of elements up RV' : 4,
'Unit scale' : 1.0,
'Interventricular sulcus derivative factor' : 0.5,
'LV outer height' : 1.0,
'LV outer radius' : 0.5,
'LV outer diameter' : 1.0,
'LV free wall thickness' : 0.12,
'LV apex thickness' : 0.06,
'RV inner height fraction' : 0.75,
'RV inner height fraction' : 0.8,
'RV arc around degrees' : 155.0,
'RV arc apex fraction' : 0.6,
'RV free wall thickness' : 0.04,
'RV width' : 0.42,
'RV width growth factor' : 0.5,
'RV free wall thickness' : 0.05,
'RV width' : 0.4,
'RV width growth factor' : 0.65,
'RV side extension' : 0.12,
'RV side extension growth factor' : 0.5,
'Ventricular septum thickness' : 0.1,
Expand All @@ -63,9 +64,10 @@ def getOrderedOptionNames():
'Number of elements around RV free wall',
'Number of elements up LV apex',
'Number of elements up RV',
'Unit scale',
'Interventricular sulcus derivative factor',
'LV outer height',
'LV outer radius',
'LV outer diameter',
'LV free wall thickness',
'LV apex thickness',
'RV inner height fraction',
Expand Down Expand Up @@ -107,8 +109,9 @@ def checkOptions(options):
if options[key] < 3:
options[key] = 3
for key in [
'Unit scale',
'LV outer height',
'LV outer radius',
'LV outer diameter',
'LV free wall thickness',
'LV apex thickness',
'RV free wall thickness',
Expand Down Expand Up @@ -153,23 +156,25 @@ def generateBaseMesh(cls, region, options):
elementsCountUpLVApex = options['Number of elements up LV apex']
elementsCountUpRV = options['Number of elements up RV']
elementsCountUpLV = elementsCountUpLVApex + elementsCountUpRV
unitScale = options['Unit scale']
ivSulcusDerivativeFactor = options['Interventricular sulcus derivative factor']
lvOuterHeight = options['LV outer height']
lvOuterRadius = options['LV outer radius']
lvFreeWallThickness = options['LV free wall thickness']
lvApexThickness = options['LV apex thickness']

lvOuterHeight = unitScale*options['LV outer height']
lvOuterRadius = unitScale*0.5*options['LV outer diameter']
lvFreeWallThickness = unitScale*options['LV free wall thickness']
lvApexThickness = unitScale*options['LV apex thickness']
lvInnerHeight = lvOuterHeight - lvApexThickness
lvInnerRadius = lvOuterRadius - lvFreeWallThickness
rvInnerHeightFraction = options['RV inner height fraction']
rvArcAroundBaseRadians = math.radians(options['RV arc around degrees'])
rvArcApexFraction = options['RV arc apex fraction']
rvFreeWallThickness = options['RV free wall thickness']
rvWidth = options['RV width']
rvFreeWallThickness = unitScale*options['RV free wall thickness']
rvWidth = unitScale*options['RV width']
rvWidthGrowthFactor = options['RV width growth factor']
rvSideExtension = options['RV side extension']
rvSideExtension = unitScale*options['RV side extension']
rvSideExtensionGrowthFactor = options['RV side extension growth factor']
vSeptumThickness = options['Ventricular septum thickness']
vSeptumBaseRadialDisplacement = options['Ventricular septum base radial displacement']
vSeptumThickness = unitScale*options['Ventricular septum thickness']
vSeptumBaseRadialDisplacement = unitScale*options['Ventricular septum base radial displacement']
useCrossDerivatives = options['Use cross derivatives']

fm = region.getFieldmodule()
Expand Down
58 changes: 22 additions & 36 deletions scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ def getDefaultOptions():
# works best with particular numbers of elements up
options['Number of elements up LV apex'] = 1
options['Number of elements up RV'] = 4
# reduce LV outer height from default as adding to it
options['LV outer height'] = 0.9
# additional options
options['Atria base inner major axis length'] = 0.55
options['Atria base inner minor axis length'] = 0.45
options['Atria major axis rotation degrees'] = 40.0
options['Atrial septum thickness'] = 0.06
options['Atrial base wall thickness'] = 0.05
options['Atrial septum thickness'] = 0.07
options['Atrial base wall thickness'] = 0.07
options['Atrial base slope degrees'] = 30.0
options['Base height'] = 0.15
options['Base thickness'] = 0.06
Expand Down Expand Up @@ -171,49 +173,33 @@ def generateBaseMesh(cls, region, options):
elementsCountAroundAtrialFreeWall = options['Number of elements around atrial free wall']
elementsCountAroundAtrialSeptum = options['Number of elements around atrial septum']
elementsCountAroundAtria = elementsCountAroundAtrialFreeWall + elementsCountAroundAtrialSeptum
# from heartventricles1:
ivSulcusDerivativeFactor = options['Interventricular sulcus derivative factor']
lvOuterHeight = options['LV outer height']
lvOuterRadius = options['LV outer radius']
lvFreeWallThickness = options['LV free wall thickness']
#lvApexThickness = options['LV apex thickness']
#lvInnerHeight = lvOuterHeight - lvApexThickness
lvInnerRadius = lvOuterRadius - lvFreeWallThickness
#rvInnerHeightFraction = options['RV inner height fraction']
rvArcAroundBaseRadians = math.radians(options['RV arc around degrees'])
#rvArcApexFraction = options['RV arc apex fraction']
rvFreeWallThickness = options['RV free wall thickness']
rvWidth = options['RV width']
#rvWidthGrowthFactor = options['RV width growth factor']
rvSideExtension = options['RV side extension']
#rvSideExtensionGrowthFactor = options['RV side extension growth factor']
vSeptumThickness = options['Ventricular septum thickness']
vSeptumBaseRadialDisplacement = options['Ventricular septum base radial displacement']
# from heartventricles1 and heartatria1:
unitScale = options['Unit scale']
# from heartatria1:
aBaseInnerMajorMag = 0.5*options['Atria base inner major axis length']
aBaseInnerMinorMag = 0.5*options['Atria base inner minor axis length']
aBaseInnerMajorMag = unitScale*0.5*options['Atria base inner major axis length']
aBaseInnerMinorMag = unitScale*0.5*options['Atria base inner minor axis length']
aMajorAxisRadians = math.radians(options['Atria major axis rotation degrees'])
aSeptumThickness = options['Atrial septum thickness']
aBaseWallThickness = options['Atrial base wall thickness']
aSeptumThickness = unitScale*options['Atrial septum thickness']
aBaseWallThickness = unitScale*options['Atrial base wall thickness']
aBaseSlopeRadians = math.radians(options['Atrial base slope degrees'])
# new:
baseHeight = options['Base height']
baseThickness = options['Base thickness']
fibrousRingThickness = options['Fibrous ring thickness']
baseHeight = unitScale*options['Base height']
baseThickness = unitScale*options['Base thickness']
fibrousRingThickness = unitScale*options['Fibrous ring thickness']
lvOutletFrontInclineRadians = math.radians(options['LV outlet front incline degrees'])
lvOutletInnerRadius = 0.5*options['LV outlet inner diameter']
lvOutletWallThickness = options['LV outlet wall thickness']
lvOutletInnerRadius = unitScale*0.5*options['LV outlet inner diameter']
lvOutletWallThickness = unitScale*options['LV outlet wall thickness']
lvOutletOuterRadius = lvOutletInnerRadius + lvOutletWallThickness
rvOutletLeftInclineRadians = math.radians(options['RV outlet left incline degrees'])
rvOutletInnerRadius = 0.5*options['RV outlet inner diameter']
rvOutletWallThickness = options['RV outlet wall thickness']
rvOutletInnerRadius = unitScale*0.5*options['RV outlet inner diameter']
rvOutletWallThickness = unitScale*options['RV outlet wall thickness']
rvOutletOuterRadius = rvOutletInnerRadius + rvOutletWallThickness
vOutletElementLength = options['Ventricles outlet element length']
vOutletSpacingy = options['Ventricles outlet spacing y']
vOutletSpacingz = options['Ventricles outlet spacing z']
vOutletElementLength = unitScale*options['Ventricles outlet element length']
vOutletSpacingy = unitScale*options['Ventricles outlet spacing y']
vOutletSpacingz = unitScale*options['Ventricles outlet spacing z']
vRotationRadians = math.radians(options['Ventricles rotation degrees'])
vTranslationx = options['Ventricles translation x']
vTranslationy = options['Ventricles translation y']
vTranslationx = unitScale*options['Ventricles translation x']
vTranslationy = unitScale*options['Ventricles translation y']
useCrossDerivatives = False

fm = region.getFieldmodule()
Expand Down