diff --git a/src/scaffoldmaker/utils/tubemesh.py b/src/scaffoldmaker/utils/tubemesh.py index d39749a1..b1c4c493 100644 --- a/src/scaffoldmaker/utils/tubemesh.py +++ b/src/scaffoldmaker/utils/tubemesh.py @@ -252,7 +252,7 @@ def extrudeSurfaceCoordinates(xSurf, d1Surf, d2Surf, d3Surf, :param d1Surf: Derivatives on surface around tube :param d2Surf: Derivatives on surface along tube :param d3Surf: Derivatives on surface through wall - :param wallThicknessList: Wall thickness for each element along tube + :param wallThicknessList: Wall thickness for each node along tube :param relativeThicknessList: Relative wall thickness for each element through wall :param elementsCountAround: Number of elements around tube :param elementsCountAlong: Number of elements along tube @@ -292,8 +292,10 @@ def extrudeSurfaceCoordinates(xSurf, d1Surf, d2Surf, d3Surf, # Calculate curvature along elements around prevIdx = n - 1 if (n1 != 0) else (n2 + 1)*elementsCountAround - 1 nextIdx = n + 1 if (n1 < elementsCountAround - 1) else n2*elementsCountAround - kappam = interp.getCubicHermiteCurvatureSimple(xSurf[prevIdx], d1Surf[prevIdx], xSurf[n], d1Surf[n], 1.0) - kappap = interp.getCubicHermiteCurvatureSimple(xSurf[n], d1Surf[n], xSurf[nextIdx], d1Surf[nextIdx], 0.0) + kappam = interp.getCubicHermiteCurvature(xSurf[prevIdx], d1Surf[prevIdx], xSurf[n], d1Surf[n], + vector.normalise(d3Surf[n]), 1.0) + kappap = interp.getCubicHermiteCurvature(xSurf[n], d1Surf[n], xSurf[nextIdx], d1Surf[nextIdx], + vector.normalise(d3Surf[n]), 0.0) if not transitElementList[n1] and not transitElementList[(n1-1)%elementsCountAround]: curvatureAround = 0.5*(kappam + kappap) elif transitElementList[n1]: @@ -336,20 +338,15 @@ def extrudeSurfaceCoordinates(xSurf, d1Surf, d2Surf, d3Surf, xList.append(x) # dx_ds1 - factor = 1.0 + wallThickness * xi3 * curvatureAroundSurf[n] + factor = 1.0 - wallOutwardDisplacement * (xi3 if outward else (1.0 - xi3)) * curvatureAroundSurf[n] d1 = [factor*c for c in d1Surf[n]] d1List.append(d1) # dx_ds2 - curvature = curvatureAlong[n] - distance = vector.magnitude([x[i] - xSurf[n][i] for i in range(3)]) - if outward: - factor = 1.0 - curvature * distance - else: - factor = 1.0 + curvature * distance - d2 = [factor*c for c in d2Surf[n]] + factor = 1.0 - wallOutwardDisplacement * (xi3 if outward else (1.0 - xi3)) * curvatureAlong[n] + d2 = [factor * c for c in d2Surf[n]] d2List.append(d2) - curvatureList.append(curvature) + curvatureList.append(curvatureAlong[n]) # dx_ds3 d3 = [c * wallThickness * (relativeThicknessList[n3] if relativeThicknessList else 1.0/elementsCountThroughWall) for c in norm] diff --git a/tests/test_bladder.py b/tests/test_bladder.py index 0fd430b3..4c57569f 100644 --- a/tests/test_bladder.py +++ b/tests/test_bladder.py @@ -75,10 +75,10 @@ def test_bladder1(self): fieldcache = fieldmodule.createFieldcache() result, surfaceArea = surfaceAreaField.evaluateReal(fieldcache, 1) self.assertEqual(result, RESULT_OK) - self.assertAlmostEqual(surfaceArea, 3.6740101958977296, delta=1.0E-8) + self.assertAlmostEqual(surfaceArea, 3.6692194413389085, delta=1.0E-8) result, volume = volumeField.evaluateReal(fieldcache, 1) self.assertEqual(result, RESULT_OK) - self.assertAlmostEqual(volume, 0.02543636759208289, delta=1.0E-8) + self.assertAlmostEqual(volume, 0.025324264242304235, delta=1.0E-8) # result, flatSurfaceArea = flatSurfaceAreaField.evaluateReal(fieldcache, 1) # self.assertEqual(result, RESULT_OK) # self.assertAlmostEqual(flatSurfaceArea, 32905.65612644931, delta=1.0E-3) diff --git a/tests/test_bladderurethra.py b/tests/test_bladderurethra.py index 3fa50269..c67ce708 100644 --- a/tests/test_bladderurethra.py +++ b/tests/test_bladderurethra.py @@ -88,10 +88,10 @@ def test_bladderurethra1(self): fieldcache = fieldmodule.createFieldcache() result, surfaceArea = surfaceAreaField.evaluateReal(fieldcache, 1) self.assertEqual(result, RESULT_OK) - self.assertAlmostEqual(surfaceArea, 4564.851396969593, delta=1.0E-6) + self.assertAlmostEqual(surfaceArea, 4564.518506192725, delta=1.0E-6) result, volume = volumeField.evaluateReal(fieldcache, 1) self.assertEqual(result, RESULT_OK) - self.assertAlmostEqual(volume, 2221.1973927759996, delta=1.0E-6) + self.assertAlmostEqual(volume, 2218.8526070746825, delta=1.0E-6) result, flatSurfaceArea = flatSurfaceAreaField.evaluateReal(fieldcache, 1) self.assertEqual(result, RESULT_OK) self.assertAlmostEqual(flatSurfaceArea, 4087.7670057497376, delta=1.0E-3) diff --git a/tests/test_cecum.py b/tests/test_cecum.py index 527ea9b2..fa7812a4 100644 --- a/tests/test_cecum.py +++ b/tests/test_cecum.py @@ -70,7 +70,7 @@ def test_cecum1(self): self.assertTrue(coordinates.isValid()) minimums, maximums = evaluateFieldNodesetRange(coordinates, nodes) assertAlmostEqualList(self, minimums, [-49.01658984455258, -46.89686037622053, -2.343256155753525], 1.0E-6) - assertAlmostEqualList(self, maximums, [42.18085849205387, 54.902119877312636, 180.0], 1.0E-6) + assertAlmostEqualList(self, maximums, [42.18085849205387, 54.90211871346987, 180.0], 1.0E-6) with ChangeManager(fieldmodule): one = fieldmodule.createFieldConstant(1.0) @@ -82,10 +82,10 @@ def test_cecum1(self): fieldcache = fieldmodule.createFieldcache() result, surfaceArea = surfaceAreaField.evaluateReal(fieldcache, 1) self.assertEqual(result, RESULT_OK) - self.assertAlmostEqual(surfaceArea, 65960.86557108756, delta=1.0E-6) + self.assertAlmostEqual(surfaceArea, 65905.04907630144, delta=1.0E-6) result, volume = volumeField.evaluateReal(fieldcache, 1) self.assertEqual(result, RESULT_OK) - self.assertAlmostEqual(volume, 127907.08806524028, delta=1.0E-6) + self.assertAlmostEqual(volume, 127866.92887366761, delta=1.0E-6) if __name__ == "__main__": diff --git a/tests/test_colon.py b/tests/test_colon.py index 969a4d03..7640c071 100644 --- a/tests/test_colon.py +++ b/tests/test_colon.py @@ -164,10 +164,10 @@ def test_colon1(self): fieldcache = fieldmodule.createFieldcache() result, surfaceArea = surfaceAreaField.evaluateReal(fieldcache, 1) self.assertEqual(result, RESULT_OK) - self.assertAlmostEqual(surfaceArea, 174848.22676409548, delta=1.0E-6) + self.assertAlmostEqual(surfaceArea, 174749.05868939584, delta=1.0E-6) result, volume = volumeField.evaluateReal(fieldcache, 1) self.assertEqual(result, RESULT_OK) - self.assertAlmostEqual(volume, 313689.5754456567, delta=1.0E-6) + self.assertAlmostEqual(volume, 314670.65237072564, delta=1.0E-6) def test_mousecolon1(self): """ diff --git a/tests/test_colonsegment.py b/tests/test_colonsegment.py index 8f85ed7c..55f58781 100644 --- a/tests/test_colonsegment.py +++ b/tests/test_colonsegment.py @@ -78,10 +78,10 @@ def test_humancolonsegment1(self): fieldcache = fieldmodule.createFieldcache() result, surfaceArea = surfaceAreaField.evaluateReal(fieldcache, 1) self.assertEqual(result, RESULT_OK) - self.assertAlmostEqual(surfaceArea, 21035.8818469729, delta=1.0E-6) + self.assertAlmostEqual(surfaceArea, 21032.6788157990, delta=1.0E-6) result, volume = volumeField.evaluateReal(fieldcache, 1) self.assertEqual(result, RESULT_OK) - self.assertAlmostEqual(volume, 39781.704358310606, delta=1.0E-6) + self.assertAlmostEqual(volume, 39836.60239335828, delta=1.0E-6) def test_mousecolonsegment1(self): """ diff --git a/tests/test_esophagus.py b/tests/test_esophagus.py index 0aacaccc..b3d43748 100644 --- a/tests/test_esophagus.py +++ b/tests/test_esophagus.py @@ -82,10 +82,10 @@ def test_esophagus1(self): fieldcache = fieldmodule.createFieldcache() result, surfaceArea = surfaceAreaField.evaluateReal(fieldcache, 1) self.assertEqual(result, RESULT_OK) - self.assertAlmostEqual(surfaceArea, 13994.064785386161, delta=1.0E-6) + self.assertAlmostEqual(surfaceArea, 13952.301236699395, delta=1.0E-6) result, volume = volumeField.evaluateReal(fieldcache, 1) self.assertEqual(result, RESULT_OK) - self.assertAlmostEqual(volume, 35763.04473815047, delta=1.0E-6) + self.assertAlmostEqual(volume, 35523.4403218177, delta=1.0E-6) # check some annotationGroups: expectedSizes3d = { diff --git a/tests/test_smallintestine.py b/tests/test_smallintestine.py index 9320fe22..0eee9d40 100644 --- a/tests/test_smallintestine.py +++ b/tests/test_smallintestine.py @@ -142,10 +142,10 @@ def test_smallintestine1(self): fieldcache = fieldmodule.createFieldcache() result, surfaceArea = surfaceAreaField.evaluateReal(fieldcache, 1) self.assertEqual(result, RESULT_OK) - self.assertAlmostEqual(surfaceArea, 143.8506801217898, delta=1.0E-6) + self.assertAlmostEqual(surfaceArea, 143.8501823770281, delta=1.0E-6) result, volume = volumeField.evaluateReal(fieldcache, 1) self.assertEqual(result, RESULT_OK) - self.assertAlmostEqual(volume, 13.608918623618687, delta=1.0E-6) + self.assertAlmostEqual(volume, 13.608455265457282, delta=1.0E-6) result, flatSurfaceArea = flatSurfaceAreaField.evaluateReal(fieldcache, 1) self.assertEqual(result, RESULT_OK) self.assertAlmostEqual(flatSurfaceArea, 144.42091907104523, delta=1.0E-3)