From 677db9e667ec0b0de830ec2cf0713840708d1499 Mon Sep 17 00:00:00 2001 From: Mabelle Lin Date: Fri, 12 Nov 2021 17:25:30 +1300 Subject: [PATCH] Calculate thickness proportions from input relative thicknesses --- src/scaffoldmaker/meshtypes/meshtype_3d_stomach1.py | 6 ++++-- tests/test_stomach.py | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/scaffoldmaker/meshtypes/meshtype_3d_stomach1.py b/src/scaffoldmaker/meshtypes/meshtype_3d_stomach1.py index 9acc17a5..5deefe77 100644 --- a/src/scaffoldmaker/meshtypes/meshtype_3d_stomach1.py +++ b/src/scaffoldmaker/meshtypes/meshtype_3d_stomach1.py @@ -1990,8 +1990,10 @@ def generateBaseMesh(cls, region, options): idxMat = [] if elementsCountThroughWall > 1: - thicknessProportions = [0.0, mucosaRelThickness, submucosaRelThickness, circularRelThickness, - longitudinalRelThickness, longitudinalRelThickness] + thicknessProportionsUI = [0.0, mucosaRelThickness, submucosaRelThickness, circularRelThickness, + longitudinalRelThickness, longitudinalRelThickness] + thicknessProportions = [thicknessProportion / sum(thicknessProportionsUI) + for thicknessProportion in thicknessProportionsUI] xi3List = [] xi3 = 0.0 for i in range(len(thicknessProportions) - 1): diff --git a/tests/test_stomach.py b/tests/test_stomach.py index 90c1dbe2..b6429a73 100644 --- a/tests/test_stomach.py +++ b/tests/test_stomach.py @@ -71,8 +71,8 @@ def test_stomach1(self): coordinates = fieldmodule.findFieldByName("coordinates").castFiniteElement() self.assertTrue(coordinates.isValid()) minimums, maximums = evaluateFieldNodesetRange(coordinates, nodes) - assertAlmostEqualList(self, minimums, [-18.238549598577396, -16.033751319943754, -8.905924748773598], 1.0E-6) - assertAlmostEqualList(self, maximums, [18.285156743233415, 15.214807824088728, 8.905433142848109], 1.0E-6) + assertAlmostEqualList(self, minimums, [-18.214909076136756, -16.010042251585798, -8.882419863214968], 1.0E-6) + assertAlmostEqualList(self, maximums, [18.262047678184306, 15.214807824088728, 8.881936264327805], 1.0E-6) with ChangeManager(fieldmodule): one = fieldmodule.createFieldConstant(1.0) @@ -84,10 +84,10 @@ def test_stomach1(self): fieldcache = fieldmodule.createFieldcache() result, surfaceArea = surfaceAreaField.evaluateReal(fieldcache, 1) self.assertEqual(result, RESULT_OK) - self.assertAlmostEqual(surfaceArea, 2557.832902256128, delta=1.0E-6) + self.assertAlmostEqual(surfaceArea, 2548.511860089027, delta=1.0E-6) result, volume = volumeField.evaluateReal(fieldcache, 1) self.assertEqual(result, RESULT_OK) - self.assertAlmostEqual(volume, 809.0349219398828, delta=1.0E-6) + self.assertAlmostEqual(volume, 769.8802118839903, delta=1.0E-6) # check some annotationGroups: expectedSizes3d = {