From 3b926e7f3608530485dd59c0574c672c49dde5a2 Mon Sep 17 00:00:00 2001 From: Richard Christie Date: Mon, 12 Mar 2018 12:26:26 +1300 Subject: [PATCH 1/7] Correct README file text --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 2379d64e..bde688f5 100644 --- a/README.rst +++ b/README.rst @@ -1,4 +1,4 @@ -Mesh Generator +Scaffold Maker ============== -Generating meshes via scripts using OpenCMISS-Zinc. +Anatomical scaffold generator using OpenCMISS-Zinc. From 8dc9cabe06f9b9b25d54f1574275259a419e2081 Mon Sep 17 00:00:00 2001 From: Richard Christie Date: Mon, 12 Mar 2018 12:27:49 +1300 Subject: [PATCH 2/7] Close LV, tweak neighbour derivative maps --- .../meshtype_3d_heartventriclesbase1.py | 40 +++++++++++-------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py b/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py index b2e99755..36bad634 100644 --- a/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py +++ b/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py @@ -666,6 +666,8 @@ def generateMesh(region, options): [ nidl + 5, nidl + 6, rvOutletNodeId[1][0], rvOutletNodeId[1][-1], nidl + nowl + 5, nidl + nowl + 6, rvOutletNodeId[0][0], rvOutletNodeId[0][-1] ], # 6-node collapsed element on inside of RV-LV join. xi2=1 face collapsed to a line by merging edges adjacent to corner node 7 [ nidl + 6, nidl + 7, rvOutletNodeId[1][-1], nidl + nowl + 6, nidl + nowl + 7, rvOutletNodeId[0][-1] ], + # 4 node collapsed / tetrahedral element + [ nidl + 7, rvOutletNodeId[1][-1], nidl + nowl + 7, lv_nid1 ], # 7-node collapsed element [ nidl + 7, nidl + 8, laNodeId[0][2], nidl + nowl + 7, nidl + nowl + 8, lv_nid1, laNodeId[1][2] ], [ nidl + 8, nidl + 9, laNodeId[0][2], laNodeId[0][3], nidl + nowl + 8, nidl + nowl + 9, laNodeId[1][2], laNodeId[1][3] ], @@ -715,16 +717,30 @@ def generateMesh(region, options): remapEftNodeValueLabel(eft1, [ 3, 4 ], Node.VALUE_LABEL_D_DS1, [ ]) remapEftNodeValueLabel(eft1, [ 2 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, [1]) ]) remapEftNodeValueLabel(eft1, [ 3, 6 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, [1]), (Node.VALUE_LABEL_D_DS2, []) ]) - remapEftNodeValueLabel(eft1, [ 4 ], Node.VALUE_LABEL_D_DS2, [ ]) + remapEftNodeValueLabel(eft1, [ 4 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS2, []) ]) remapEftNodeValueLabel(eft1, [ 4, 8 ], Node.VALUE_LABEL_D_DS3, [ ]) remapEftNodeValueLabel(eft1, [ 5 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS3, [1]) ]) remapEftNodeValueLabel(eft1, [ 6 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS3, []) ]) - remapEftNodeValueLabel(eft1, [ 8 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS3, [1]) ]) + remapEftNodeValueLabel(eft1, [ 8 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS3, [1]) ]) tricubichermite.setEftLinearDerivativeXi3(eft1, 3, 7, 3, 7, 1) tricubichermite.setEftLinearDerivativeXi1(eft1, 7, 8, 7, 8, 1) ln_map = [ 1, 2, 3, 3, 4, 5, 6, 3 ] remapEftLocalNodes(eft1, 6, ln_map) elif e == 7: + eft1 = tricubichermite.createEftNoCrossDerivatives() + setEftScaleFactorIds(eft1, [1], []) + # remap parameters before collapsing nodes + remapEftNodeValueLabel(eft1, [ 1, 2, 3, 4 ], Node.VALUE_LABEL_D_DS1, [ ]) + remapEftNodeValueLabel(eft1, [ 1, 2, 3, 4, 5, 7 ], Node.VALUE_LABEL_D_DS2, [ ]) + remapEftNodeValueLabel(eft1, [ 1, 3 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS1, [1]) ]) + remapEftNodeValueLabel(eft1, [ 4 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS2, []), (Node.VALUE_LABEL_D_DS3, []) ]) + remapEftNodeValueLabel(eft1, [ 5 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS1, [1]), (Node.VALUE_LABEL_D_DS3, []) ]) + remapEftNodeValueLabel(eft1, [ 5, 7 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS2, []) ]) + remapEftNodeValueLabel(eft1, [ 6 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS2, [1]) ]) + remapEftNodeValueLabel(eft1, [ 7 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS3, []) ]) + ln_map = [ 1, 1, 1, 1, 2, 3, 2, 4 ] + remapEftLocalNodes(eft1, 4, ln_map) + elif e == 8: eft1 = tricubichermite.createEftNoCrossDerivatives() setEftScaleFactorIds(eft1, [1], []) # remap parameters before collapsing nodes @@ -734,7 +750,7 @@ def generateMesh(region, options): remapEftNodeValueLabel(eft1, [ 4, 8 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS2, []) ]) ln_map = [ 1, 2, 1, 3, 4, 5, 6, 7 ] remapEftLocalNodes(eft1, 7, ln_map) - elif e == 11: + elif e == 12: eft1 = tricubichermite.createEftNoCrossDerivatives() setEftScaleFactorIds(eft1, [1], []) # remap parameters before collapsing nodes @@ -748,48 +764,40 @@ def generateMesh(region, options): remapEftNodeValueLabel(eft1, [ 8 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS1, [1]), (Node.VALUE_LABEL_D_DS3, [1]) ]) ln_map = [ 1, 2, 3, 4, 2, 2, 5, 5 ] remapEftLocalNodes(eft1, 5, ln_map) - elif e == 12: + elif e == 13: eft1 = tricubichermite.createEftNoCrossDerivatives() setEftScaleFactorIds(eft1, [1], []) # remap parameters before collapsing nodes remapEftNodeValueLabel(eft1, [ 1, 2, 5, 6 ], Node.VALUE_LABEL_D_DS1, [ ]) remapEftNodeValueLabel(eft1, [ 1, 2, 5, 6 ], Node.VALUE_LABEL_D_DS3, [ ]) remapEftNodeValueLabel(eft1, [ 1 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS2, [1]) ]) - remapEftNodeValueLabel(eft1, [ 2 ], Node.VALUE_LABEL_D_DS2, [ ]) + remapEftNodeValueLabel(eft1, [ 2 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS2, [1]) ]) remapEftNodeValueLabel(eft1, [ 5 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS3, []) ]) remapEftNodeValueLabel(eft1, [ 6 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS3, []) ]) - remapEftNodeValueLabel(eft1, [ 3 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS2, [1]), (Node.VALUE_LABEL_D_DS3, [1]) ]) remapEftNodeValueLabel(eft1, [ 3 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS2, []) ]) - remapEftNodeValueLabel(eft1, [ 4 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, []) ]) remapEftNodeValueLabel(eft1, [ 4 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS2, []), (Node.VALUE_LABEL_D_DS3, []) ]) - remapEftNodeValueLabel(eft1, [ 7 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS3, [1]) ]) remapEftNodeValueLabel(eft1, [ 7 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS2, []) ]) remapEftNodeValueLabel(eft1, [ 7 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS3, []) ]) - remapEftNodeValueLabel(eft1, [ 8 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS2, [1]) ]) remapEftNodeValueLabel(eft1, [ 8 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, []) ]) - #remapEftNodeValueLabel(eft1, [ 8 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS2, []) ]) - ln_map = [ 1, 1, 2, 3, 1, 1, 4, 5 ] remapEftLocalNodes(eft1, 5, ln_map) - elif e == 13: + elif e == 14: eft1 = tricubichermite.createEftNoCrossDerivatives() setEftScaleFactorIds(eft1, [1], []) # remap parameters before collapsing nodes - # following uses D2_DS1DS3 as a temporary swap variable remapEftNodeValueLabel(eft1, [ 1 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS2, []) ]) - #remapEftNodeValueLabel(eft1, [ 2 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS2, []) ]) remapEftNodeValueLabel(eft1, [ 1 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS2, []) ]) remapEftNodeValueLabel(eft1, [ 2 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS2, []), (Node.VALUE_LABEL_D_DS3, []) ]) remapEftNodeValueLabel(eft1, [ 3 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, [ 1 ]) ]) remapEftNodeValueLabel(eft1, [ 4, 8 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS2, []) ]) + # following uses D2_DS1DS3 as a temporary swap variable remapEftNodeValueLabel(eft1, [ 5 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D2_DS1DS3, []) ]) remapEftNodeValueLabel(eft1, [ 5 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, []) ]) remapEftNodeValueLabel(eft1, [ 5 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS2, []) ]) - #remapEftNodeValueLabel(eft1, [ 5 ], Node.VALUE_LABEL_D2_DS1DS3, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS3, []) ]) remapEftNodeValueLabel(eft1, [ 5 ], Node.VALUE_LABEL_D2_DS1DS3, [ (Node.VALUE_LABEL_D_DS3, []) ]) remapEftNodeValueLabel(eft1, [ 6 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS2, [ 1 ]) ]) remapEftNodeValueLabel(eft1, [ 6 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, []) ]) @@ -875,7 +883,7 @@ def generateMesh(region, options): tricubichermite.setEftLinearDerivativeXi3(eft1, 4, 8, 4, 8, 1) remapEftNodeValueLabel(eft1, [ 6 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, [1]), (Node.VALUE_LABEL_D_DS2, []) ]) remapEftNodeValueLabel(eft1, [ 6 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS3, []) ]) - remapEftNodeValueLabel(eft1, [ 8 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS3, [1]) ]) + remapEftNodeValueLabel(eft1, [ 8 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS3, [1]) ]) elif e == 9: # supraventricular crest 1, by RA-LV outlet junction eft1 = tricubichermite.createEftNoCrossDerivatives() From 71e866b46379c100e05d92766e5f59769202c7b4 Mon Sep 17 00:00:00 2001 From: Richard Christie Date: Mon, 12 Mar 2018 16:10:59 +1300 Subject: [PATCH 3/7] Close LV outlet --- .../meshtype_3d_heartventriclesbase1.py | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py b/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py index 36bad634..b9af3b9c 100644 --- a/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py +++ b/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py @@ -677,7 +677,9 @@ def generateMesh(region, options): [ nidl + 5, nidl + 6, lvOutletNodeId[1][3], lvOutletNodeId[1][4], rvOutletNodeId[1][-1] ], # 5-node square pyramid [ rvOutletNodeId[1][-1], nidl + 6, nidl + 7, lvOutletNodeId[1][4], lv_nid1 ], - [ nidl + 6, nidl + 7, laNodeId[0][1], laNodeId[0][2],lvOutletNodeId[1][-2], lv_nid1, laNodeId[1][1], laNodeId[1][2] ] + [ nidl + 6, nidl + 7, laNodeId[0][1], laNodeId[0][2],lvOutletNodeId[1][-2], lv_nid1, laNodeId[1][1], laNodeId[1][2] ], + # 6-node LV outlet closure septum side + [ nidl + 1, laNodeId[0][1], laNodeId[0][0], nidl + 2, lvOutletNodeId[1][0], laNodeId[1][1] ] ] for e in range(len(nids)): @@ -803,6 +805,23 @@ def generateMesh(region, options): remapEftNodeValueLabel(eft1, [ 6 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, []) ]) scaleEftNodeValueLabels(eft1, [ 7 ], [ Node.VALUE_LABEL_D_DS1 ], [ 1 ]) remapEftNodeValueLabel(eft1, [ 7 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, []) ]) + elif e == 15: + eft1 = tricubichermite.createEftNoCrossDerivatives() + setEftScaleFactorIds(eft1, [1], []) + # remap parameters before collapsing nodes + #remapEftNodeValueLabel(eft1, [ 1 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS2, []) ]) + remapEftNodeValueLabel(eft1, [ 1 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS2, []) ]) + #remapEftNodeValueLabel(eft1, [ 5 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS1, [1]), (Node.VALUE_LABEL_D_DS2, []) ]) + remapEftNodeValueLabel(eft1, [ 5 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS1, [1]) ]) + remapEftNodeValueLabel(eft1, [ 1, 5 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS1, []) ]) + remapEftNodeValueLabel(eft1, [ 2, 4 ], Node.VALUE_LABEL_D_DS2, [ ]) + remapEftNodeValueLabel(eft1, [ 2, 6 ], Node.VALUE_LABEL_D_DS3, [ ]) + remapEftNodeValueLabel(eft1, [ 3 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS3, []) ]) + remapEftNodeValueLabel(eft1, [ 6, 8 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS3, []) ]) + remapEftNodeValueLabel(eft1, [ 7, 8 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS1, [1]) ]) + remapEftNodeValueLabel(eft1, [ 7 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS3, [1]) ]) + ln_map = [ 1, 2, 3, 2, 4, 2, 5, 6 ] + remapEftLocalNodes(eft1, 6, ln_map) elementtemplate1 = mesh.createElementtemplate() elementtemplate1.setElementShapeType(Element.SHAPE_TYPE_CUBE) From 4fcf5ff47ad0d3523199c885796dd9f3ce3cfc3e Mon Sep 17 00:00:00 2001 From: Richard Christie Date: Tue, 13 Mar 2018 10:48:27 +1300 Subject: [PATCH 4/7] Improve conformance of LV closure elements Aligned collapsed sides. --- .../meshtype_3d_heartventriclesbase1.py | 43 +++++++++++-------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py b/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py index b9af3b9c..4ec52e1c 100644 --- a/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py +++ b/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py @@ -667,7 +667,7 @@ def generateMesh(region, options): # 6-node collapsed element on inside of RV-LV join. xi2=1 face collapsed to a line by merging edges adjacent to corner node 7 [ nidl + 6, nidl + 7, rvOutletNodeId[1][-1], nidl + nowl + 6, nidl + nowl + 7, rvOutletNodeId[0][-1] ], # 4 node collapsed / tetrahedral element - [ nidl + 7, rvOutletNodeId[1][-1], nidl + nowl + 7, lv_nid1 ], + [ rvOutletNodeId[1][-1], nidl + 7, nidl + nowl + 7, lv_nid1 ], # 7-node collapsed element [ nidl + 7, nidl + 8, laNodeId[0][2], nidl + nowl + 7, nidl + nowl + 8, lv_nid1, laNodeId[1][2] ], [ nidl + 8, nidl + 9, laNodeId[0][2], laNodeId[0][3], nidl + nowl + 8, nidl + nowl + 9, laNodeId[1][2], laNodeId[1][3] ], @@ -676,7 +676,7 @@ def generateMesh(region, options): # 5-node collapsed element at cusp of LV and RV outlets, on LV freewall end of septum [ nidl + 5, nidl + 6, lvOutletNodeId[1][3], lvOutletNodeId[1][4], rvOutletNodeId[1][-1] ], # 5-node square pyramid - [ rvOutletNodeId[1][-1], nidl + 6, nidl + 7, lvOutletNodeId[1][4], lv_nid1 ], + [ nidl + 6, nidl + 7, rvOutletNodeId[1][-1], lvOutletNodeId[1][4], lv_nid1 ], [ nidl + 6, nidl + 7, laNodeId[0][1], laNodeId[0][2],lvOutletNodeId[1][-2], lv_nid1, laNodeId[1][1], laNodeId[1][2] ], # 6-node LV outlet closure septum side [ nidl + 1, laNodeId[0][1], laNodeId[0][0], nidl + 2, lvOutletNodeId[1][0], laNodeId[1][1] ] @@ -732,15 +732,19 @@ def generateMesh(region, options): eft1 = tricubichermite.createEftNoCrossDerivatives() setEftScaleFactorIds(eft1, [1], []) # remap parameters before collapsing nodes - remapEftNodeValueLabel(eft1, [ 1, 2, 3, 4 ], Node.VALUE_LABEL_D_DS1, [ ]) - remapEftNodeValueLabel(eft1, [ 1, 2, 3, 4, 5, 7 ], Node.VALUE_LABEL_D_DS2, [ ]) - remapEftNodeValueLabel(eft1, [ 1, 3 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS1, [1]) ]) + remapEftNodeValueLabel(eft1, [ 1 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS2, [1]) ]) + remapEftNodeValueLabel(eft1, [ 1 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS2, [1]) ]) + remapEftNodeValueLabel(eft1, [ 1, 5 ], Node.VALUE_LABEL_D_DS3, [ ]) + remapEftNodeValueLabel(eft1, [ 2, 4, 5, 7 ], Node.VALUE_LABEL_D_DS2, [ ]) + remapEftNodeValueLabel(eft1, [ 3, 4 ], Node.VALUE_LABEL_D_DS1, [ ]) + remapEftNodeValueLabel(eft1, [ 2, 3 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, []) ]) + remapEftNodeValueLabel(eft1, [ 3 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS1, [1]) ]) remapEftNodeValueLabel(eft1, [ 4 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS2, []), (Node.VALUE_LABEL_D_DS3, []) ]) remapEftNodeValueLabel(eft1, [ 5 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS1, [1]), (Node.VALUE_LABEL_D_DS3, []) ]) - remapEftNodeValueLabel(eft1, [ 5, 7 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS2, []) ]) - remapEftNodeValueLabel(eft1, [ 6 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS2, [1]) ]) + remapEftNodeValueLabel(eft1, [ 6 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS2, [1]) ]) + remapEftNodeValueLabel(eft1, [ 7 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS2, []) ]) remapEftNodeValueLabel(eft1, [ 7 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS3, []) ]) - ln_map = [ 1, 1, 1, 1, 2, 3, 2, 4 ] + ln_map = [ 1, 2, 2, 2, 1, 3, 1, 4] remapEftLocalNodes(eft1, 4, ln_map) elif e == 8: eft1 = tricubichermite.createEftNoCrossDerivatives() @@ -757,10 +761,12 @@ def generateMesh(region, options): setEftScaleFactorIds(eft1, [1], []) # remap parameters before collapsing nodes remapEftNodeValueLabel(eft1, [ 1, 3 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS1, []) ]) - remapEftNodeValueLabel(eft1, [ 2, 5, 6 ], Node.VALUE_LABEL_D_DS3, [ ]) + remapEftNodeValueLabel(eft1, [ 2, 6 ], Node.VALUE_LABEL_D_DS3, [ ]) remapEftNodeValueLabel(eft1, [ 4 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS1, [1]), (Node.VALUE_LABEL_D_DS3, []) ]) remapEftNodeValueLabel(eft1, [ 5, 6, 7, 8 ], Node.VALUE_LABEL_D_DS1, [ ]) remapEftNodeValueLabel(eft1, [ 5, 6 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS2, []), (Node.VALUE_LABEL_D_DS3, []) ]) + remapEftNodeValueLabel(eft1, [ 5 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS1, []) ]) + remapEftNodeValueLabel(eft1, [ 7 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, [1]), (Node.VALUE_LABEL_D_DS2, []) ]) remapEftNodeValueLabel(eft1, [ 7 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS1, [1]) ]) remapEftNodeValueLabel(eft1, [ 8 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, [1]), (Node.VALUE_LABEL_D_DS2, []) ]) remapEftNodeValueLabel(eft1, [ 8 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS1, [1]), (Node.VALUE_LABEL_D_DS3, [1]) ]) @@ -770,22 +776,23 @@ def generateMesh(region, options): eft1 = tricubichermite.createEftNoCrossDerivatives() setEftScaleFactorIds(eft1, [1], []) # remap parameters before collapsing nodes - remapEftNodeValueLabel(eft1, [ 1, 2, 5, 6 ], Node.VALUE_LABEL_D_DS1, [ ]) - remapEftNodeValueLabel(eft1, [ 1, 2, 5, 6 ], Node.VALUE_LABEL_D_DS3, [ ]) - remapEftNodeValueLabel(eft1, [ 1 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS2, [1]) ]) - remapEftNodeValueLabel(eft1, [ 2 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS2, [1]) ]) + remapEftNodeValueLabel(eft1, [ 1, 2, 3, 4 ], Node.VALUE_LABEL_D_DS2, [ ]) + remapEftNodeValueLabel(eft1, [ 1, 4 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS2, []), (Node.VALUE_LABEL_D_DS3, []) ]) + remapEftNodeValueLabel(eft1, [ 2 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS1, [1]) ]) + remapEftNodeValueLabel(eft1, [ 3 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS2, []) ]) + remapEftNodeValueLabel(eft1, [ 5, 6 ], Node.VALUE_LABEL_D_DS1, [ ]) remapEftNodeValueLabel(eft1, [ 5 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS3, []) ]) + remapEftNodeValueLabel(eft1, [ 5 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS1, [1]), (Node.VALUE_LABEL_D_DS2, []) ]) + # following uses D2_DS2DS3 as a temporary swap variable + remapEftNodeValueLabel(eft1, [ 6 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D2_DS2DS3, []) ]) remapEftNodeValueLabel(eft1, [ 6 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS3, []) ]) - remapEftNodeValueLabel(eft1, [ 3 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS2, [1]), (Node.VALUE_LABEL_D_DS3, [1]) ]) - remapEftNodeValueLabel(eft1, [ 3 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS2, []) ]) - remapEftNodeValueLabel(eft1, [ 4 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, []) ]) - remapEftNodeValueLabel(eft1, [ 4 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS2, []), (Node.VALUE_LABEL_D_DS3, []) ]) + remapEftNodeValueLabel(eft1, [ 6 ], Node.VALUE_LABEL_D2_DS2DS3, [ (Node.VALUE_LABEL_D_DS2, []) ]) remapEftNodeValueLabel(eft1, [ 7 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS3, [1]) ]) remapEftNodeValueLabel(eft1, [ 7 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS2, []) ]) remapEftNodeValueLabel(eft1, [ 7 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS3, []) ]) remapEftNodeValueLabel(eft1, [ 8 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS2, [1]) ]) remapEftNodeValueLabel(eft1, [ 8 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, []) ]) - ln_map = [ 1, 1, 2, 3, 1, 1, 4, 5 ] + ln_map = [ 1, 2, 1, 2, 3, 3, 4, 5 ] remapEftLocalNodes(eft1, 5, ln_map) elif e == 14: eft1 = tricubichermite.createEftNoCrossDerivatives() From 6049e3b280369f5c4b540c2b779e813994c5cebb Mon Sep 17 00:00:00 2001 From: Richard Christie Date: Wed, 14 Mar 2018 12:09:56 +1300 Subject: [PATCH 5/7] Add LV outlet elements --- .../meshtype_3d_heartventriclesbase1.py | 45 ++++++- .../utils/eftfactory_bicubichermitelinear.py | 111 ++++++++++++++++++ 2 files changed, 151 insertions(+), 5 deletions(-) create mode 100644 scaffoldmaker/utils/eftfactory_bicubichermitelinear.py diff --git a/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py b/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py index 4ec52e1c..8c600a2c 100644 --- a/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py +++ b/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py @@ -11,6 +11,7 @@ from scaffoldmaker.utils.interpolation import * from scaffoldmaker.utils.zinc_utils import * from scaffoldmaker.utils.eftfactory_tricubichermite import eftfactory_tricubichermite +from scaffoldmaker.utils.eftfactory_bicubichermitelinear import eftfactory_bicubichermitelinear from opencmiss.zinc.element import Element, Elementbasis from opencmiss.zinc.field import Field from opencmiss.zinc.node import Node @@ -90,7 +91,7 @@ def generateMesh(region, options): """ elementsCountUp = options['Number of elements up'] elementsCountAround = options['Number of elements around'] - print('elementsCountAround', elementsCountAround) + #print('elementsCountAround', elementsCountAround) elementsCountAcrossSeptum = options['Number of elements across septum'] lvWallThickness = options['LV wall thickness'] lvWallThicknessRatioBase = options['LV wall thickness ratio base'] @@ -344,7 +345,7 @@ def generateMesh(region, options): qx = ox*laUnitMajorX + oy*laUnitMajorY qy = ox*laUnitMinorX + oy*laUnitMinorY cruxLeftRadians = math.atan2(atriaOuterMajorMag*qy, atriaOuterMinorMag*qx) - print('qx', qx, ' qy', qy, ' cruxLeftDegrees', cruxLeftRadians*180.0/math.pi) + #print('qx', qx, ' qy', qy, ' cruxLeftDegrees', cruxLeftRadians*180.0/math.pi) cosRadiansAround = math.cos(laSeptumRadians) sinRadiansAround = math.sin(laSeptumRadians) @@ -422,7 +423,7 @@ def generateMesh(region, options): coordinates.setNodeParameters(cache, -1, Node.VALUE_LABEL_D_DS3, 1, dx_ds3) nodeIdentifier += 1 - if True: + if False: # show axes of left atrium node = nodes.createNode(nodeIdentifier, nodetemplateFull) cache.setNode(node) @@ -466,7 +467,7 @@ def generateMesh(region, options): cruxRightRadians = math.atan2(atriaOuterMajorMag*qy, atriaOuterMinorMag*qx) if cruxRightRadians < math.pi: cruxRightRadians += 2.0*math.pi - print('qx', qx, ' qy', qy, ' cruxRightDegrees', cruxRightRadians*180.0/math.pi) + #print('qx', qx, ' qy', qy, ' cruxRightDegrees', cruxRightRadians*180.0/math.pi) raRadians = [0.0]*elementsCountAroundAtria raRadians[0] = raSeptumRadians @@ -538,7 +539,7 @@ def generateMesh(region, options): coordinates.setNodeParameters(cache, -1, Node.VALUE_LABEL_D_DS3, 1, dx_ds3) nodeIdentifier += 1 - if True: + if False: # show axes of right atrium node = nodes.createNode(nodeIdentifier, nodetemplateFull) cache.setNode(node) @@ -955,5 +956,39 @@ def generateMesh(region, options): print('create element rv', elementIdentifier, result, result2, result3, nids[e]) elementIdentifier += 1 + # LV outlet ring elements: linear in xi3 + + bicubichermitelinear3 = eftfactory_bicubichermitelinear(mesh, useCrossDerivatives, linearAxis = 3) + + # wedge shape, collapsed across xi3 at xi2 == 0 + eft_lvring = bicubichermitelinear3.createEftNoCrossDerivatives() + ln_map = [ 1, 2, 3, 4, 1, 2, 5, 6 ] + remapEftLocalNodes(eft_lvring, 6, ln_map) + lvring_nids = [ nidl + 2, nidl + 3, nidl + 4, nidl + 5, nidl + 6, laNodeId[0][1] ] + for e in range(elementsCountAroundOutlet): + e2 = (e + 1) % elementsCountAroundOutlet + eft1 = eft_lvring + if e >= 4: + eft1 = bicubichermitelinear3.createEftNoCrossDerivatives() + setEftScaleFactorIds(eft1, [1], []) + if e == 4: + remapEftNodeValueLabel(eft1, [ 1 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS2, []) ]) + localNodes = [ 2, 6 ] if (e == 4) else [ 1, 5 ] + remapEftNodeValueLabel(eft1, localNodes, Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS1, [1]) ]) + remapEftNodeValueLabel(eft1, localNodes[0:1], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS2, [1]) ]) + remapEftNodeValueLabel(eft1, localNodes[1:], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS3, []) ]) + ln_map = [ 1, 2, 3, 4, 1, 2, 5, 6 ] + remapEftLocalNodes(eft1, 6, ln_map) + + elementtemplate1 = mesh.createElementtemplate() + elementtemplate1.setElementShapeType(Element.SHAPE_TYPE_CUBE) + result = elementtemplate1.defineField(coordinates, -1, eft1) + + element = mesh.createElement(elementIdentifier, elementtemplate1) + nids = [ lvring_nids[e], lvring_nids[e2], lvOutletNodeId[0][e], lvOutletNodeId[0][e2], lvOutletNodeId[1][e], lvOutletNodeId[1][e2] ] + result2 = element.setNodesByIdentifier(eft1, nids) + print('create element lv outlet', elementIdentifier, result, result2, nids) + elementIdentifier += 1 + fm.endChange() diff --git a/scaffoldmaker/utils/eftfactory_bicubichermitelinear.py b/scaffoldmaker/utils/eftfactory_bicubichermitelinear.py new file mode 100644 index 00000000..438a032e --- /dev/null +++ b/scaffoldmaker/utils/eftfactory_bicubichermitelinear.py @@ -0,0 +1,111 @@ +''' +Definitions of standard element field templates using bicubic Hermite x linear Lagrange basis. + +@author: Richard Christie +''' +from scaffoldmaker.utils.eft_utils import * +from opencmiss.zinc.element import Elementbasis, Elementfieldtemplate +from opencmiss.zinc.node import Node +from opencmiss.zinc.status import OK as ZINC_OK + +class eftfactory_bicubichermitelinear: + ''' + Factory class for creating element field templates for a 3-D mesh using bicubic Hermite x linear Lagrange basis. + ''' + + def __init__(self, mesh, useCrossDerivatives, linearAxis = 3, + d_ds1 = Node.VALUE_LABEL_D_DS1, d_ds2 = Node.VALUE_LABEL_D_DS2): + ''' + :param mesh: Zinc mesh to create element field templates in. + :param useCrossDerivatives: Set to True if you want cross derivative terms. + :param linearAxis: 1, 2, or 3. + :param d_ds1: Node derivative to use in Hermite axis 1: Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2. + :param d_ds2: Node derivative to use in Hermite axis 2, > d_ds1: Node.VALUE_LABEL_D_DS2 or Node.VALUE_LABEL_D_DS3. + ''' + assert mesh.getDimension() == 3, 'eftfactory_bicubichermitelinear: not a 3-D Zinc mesh' + assert linearAxis in [ 1, 2, 3 ], 'eftfactory_bicubichermitelinear: linearAxis must be 1, 2 or 3' + assert d_ds1 in [ Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2 ], 'eftfactory_bicubichermitelinear: invalid d_ds1' + assert d_ds2 in [ Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D_DS3 ] and (d_ds2 > d_ds1), 'eftfactory_bicubichermitelinear: invalid d_ds2' + self._mesh = mesh + self._useCrossDerivatives = useCrossDerivatives + self._linearAxis = linearAxis + self._d_ds1 = d_ds1 + self._d_ds2 = d_ds2 + self._d2_ds1ds2 = Node.VALUE_LABEL_D2_DS2DS3 if (d_ds1 == Node.VALUE_LABEL_D_DS2) \ + else Node.VALUE_LABEL_D2_DS1DS3 if (d_ds2 == Node.VALUE_LABEL_D_DS3) \ + else Node.VALUE_LABEL_D2_DS1DS2 + self._fieldmodule = mesh.getFieldmodule() + self._basis = self._fieldmodule.createElementbasis(3, Elementbasis.FUNCTION_TYPE_CUBIC_HERMITE) + self._basis.setFunctionType(linearAxis, Elementbasis.FUNCTION_TYPE_LINEAR_LAGRANGE) + + def _remapDefaultNodeDerivatives(self): + ''' + Remap the Hermite node derivatives to those chosen in __init__. + Use only on first create. + ''' + # must do d_ds2 first! + if self._d_ds2 != Node.VALUE_LABEL_D_DS2: + remapEftNodeValueLabel(eft, range(1, 9), Node.VALUE_LABEL_D_DS2, [ (self._d_ds2, []) ]) + if self._d_ds1 != Node.VALUE_LABEL_D_DS1: + remapEftNodeValueLabel(eft, range(1, 9), Node.VALUE_LABEL_D_DS1, [ (self._d_ds1, []) ]) + if self._d2_ds1ds2 != Node.VALUE_LABEL_D2_DS1DS2: + remapEftNodeValueLabel(eft, range(1, 9), Node.VALUE_LABEL_D2_DS1DS2, [ (self._d2_ds1ds2, []) ]) + + def createEftBasic(self): + ''' + Create the basic biicubic Hermite x linear Lagrange element template with 1:1 mappings to + node derivatives ds1 & ds2, with or without cross derivatives accordinate as initialised. + :return: Element field template + ''' + if not self._useCrossDerivatives: + return self.createEftNoCrossDerivatives() + eft = self._mesh.createElementfieldtemplate(self._basis) + self._remapDefaultNodeDerivatives() + assert eft.validate(), 'eftfactory_bicubichermitelinear.createEftBasic: Failed to validate eft' + return eft + + def createEftNoCrossDerivatives(self): + ''' + Create a basic tricubic hermite element template with 1:1 mappings to + node derivatives ds1 & ds2, without cross derivatives. + :return: Element field template + ''' + eft = self._mesh.createElementfieldtemplate(self._basis) + for n in range(8): + eft.setFunctionNumberOfTerms(n*4 + 4, 0) + self._remapDefaultNodeDerivatives() + assert eft.validate(), 'eftfactory_bicubichermitelinear.createEftNoCrossDerivatives: Failed to validate eft' + return eft + + def createEftSplitXi1RightStraight(self): + ''' + Create an element field template suitable for the inner elements of the + join between left and right chambers, with xi1 bifurcating to right. + Straight through version. + Only works with linearAxis 2. + :return: Element field template + ''' + assert linearAxis == 2, 'eftfactory_bicubichermitelinear.createEftSplitXi1RightStraight: Not linearAxis 2' + eft = self.createEftNoCrossDerivatives() + setEftScaleFactorIds(eft, [1], []) + remapEftNodeValueLabel(eft, [ 5, 7 ], self._d_ds1, [ (self._d_ds1, []), (self._d_ds2, [1]) ]) + remapEftNodeValueLabel(eft, [ 6, 8 ], self._d_ds1, [ (self._d_ds1, []), (self._d_ds2, []) ]) + assert eft.validate(), 'eftfactory_bicubichermitelinear.createEftSplitXi1RightStraight: Failed to validate eft' + return eft + + def createEftSplitXi1RightOut(self): + ''' + Create an element field template suitable for the outer elements of the + join between left and right chambers, with xi1 bifurcating to right. + Right out version i.e. xi1 heading to right. h-shape. + Only works with linearAxis 2. + :return: Element field template + ''' + assert linearAxis == 2, 'eftfactory_bicubichermitelinear.createEftSplitXi1RightOut: Not linearAxis 2' + eft = self.createEftNoCrossDerivatives() + setEftScaleFactorIds(eft, [1], []) + remapEftNodeValueLabel(eft, [ 1, 3 ], self._d_ds1, [ (self._d_ds1, [1]) ]) + remapEftNodeValueLabel(eft, [ 1, 3 ], self._d_ds2, [ (self._d_ds1, [1]), (self._d_ds2, [1]) ]) + remapEftNodeValueLabel(eft, [ 5, 7 ], self._d_ds2, [ (self._d_ds1, [1]), (self._d_ds2, []) ]) + assert eft.validate(), 'eftfactory_bicubichermitelinear.createEftSplitXi1RightOut: Failed to validate eft' + return eft From 643ac08fcf9d498e69190214521b102f719a62ca Mon Sep 17 00:00:00 2001 From: Richard Christie Date: Wed, 14 Mar 2018 14:19:36 +1300 Subject: [PATCH 6/7] Fix derivatives on LV bridge --- .../meshtype_3d_heartventriclesbase1.py | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py b/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py index 8c600a2c..3d8dc86c 100644 --- a/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py +++ b/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py @@ -207,6 +207,8 @@ def generateMesh(region, options): elif n1 == (elementsCountAroundOutlet - 1): cruxLeftNodeId = nodeIdentifier cruxLeft = [ x[0], x[1], x[2] ] + elif n1 == (elementsCountAroundOutlet - 1): + cruxLeftInner = [ x[0], x[1], x[2] ] nodeIdentifier += 1 # RV outlet - for bicubic-linear tube connection @@ -406,14 +408,17 @@ def generateMesh(region, options): laDeltaRadians[n1]*(-sinRadiansAround*laOuterMajorY + cosRadiansAround*laOuterMinorY), 0.0 ] dx_ds3 = [ outer[0] - inner[0], outer[1] - inner[1], outer[2] - inner[2] ] - dx_ds2 = [ - dx_ds3[1]*dx_ds1[2] - dx_ds3[2]*dx_ds1[1], - dx_ds3[2]*dx_ds1[0] - dx_ds3[0]*dx_ds1[2], - dx_ds3[0]*dx_ds1[1] - dx_ds3[1]*dx_ds1[0] ] - mag = math.sqrt(dx_ds2[0]*dx_ds2[0] + dx_ds2[1]*dx_ds2[1] + dx_ds2[2]*dx_ds2[2]) - for i in range(3): - # GRC check scaling here: - dx_ds2[i] *= inner[2]/mag + if (n3 == 0) and (n1 == 1): + dx_ds2 = [ cruxLeftInner[0] - inner[0], cruxLeftInner[1] - inner[1], 0.0 ] + else: + dx_ds2 = [ + dx_ds3[1]*dx_ds1[2] - dx_ds3[2]*dx_ds1[1], + dx_ds3[2]*dx_ds1[0] - dx_ds3[0]*dx_ds1[2], + dx_ds3[0]*dx_ds1[1] - dx_ds3[1]*dx_ds1[0] ] + mag = math.sqrt(dx_ds2[0]*dx_ds2[0] + dx_ds2[1]*dx_ds2[1] + dx_ds2[2]*dx_ds2[2]) + for i in range(3): + # GRC check scaling here: + dx_ds2[i] *= inner[2]/mag if n1 == 0: # GRC check scaling here: dx_ds2 = [ 0.0, 0.0, inner[2] ] @@ -972,11 +977,10 @@ def generateMesh(region, options): eft1 = bicubichermitelinear3.createEftNoCrossDerivatives() setEftScaleFactorIds(eft1, [1], []) if e == 4: - remapEftNodeValueLabel(eft1, [ 1 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS2, []) ]) + remapEftNodeValueLabel(eft1, [ 1, 5 ], Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS2, []) ]) localNodes = [ 2, 6 ] if (e == 4) else [ 1, 5 ] remapEftNodeValueLabel(eft1, localNodes, Node.VALUE_LABEL_D_DS1, [ (Node.VALUE_LABEL_D_DS1, [1]) ]) - remapEftNodeValueLabel(eft1, localNodes[0:1], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS2, [1]) ]) - remapEftNodeValueLabel(eft1, localNodes[1:], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS3, []) ]) + remapEftNodeValueLabel(eft1, [ localNodes[1], 8 if (e == 4) else 7 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS3, []) ]) ln_map = [ 1, 2, 3, 4, 1, 2, 5, 6 ] remapEftLocalNodes(eft1, 6, ln_map) From 7b24bc3b0e893a3012dcd664956920f598b0c5ad Mon Sep 17 00:00:00 2001 From: Richard Christie Date: Thu, 15 Mar 2018 08:05:01 +1300 Subject: [PATCH 7/7] Fix supraventricular crest element mapping --- scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py b/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py index 3d8dc86c..265997b5 100644 --- a/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py +++ b/scaffoldmaker/meshtypes/meshtype_3d_heartventriclesbase1.py @@ -943,7 +943,7 @@ def generateMesh(region, options): remapEftNodeValueLabel(eft1, [ 4 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, [1]) ]) tricubichermite.setEftLinearDerivativeXi3(eft1, 4, 8, 4, 8, 1) remapEftNodeValueLabel(eft1, [ 7 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS3, [1]) ]) - remapEftNodeValueLabel(eft1, [ 7 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS2, []) ]) + remapEftNodeValueLabel(eft1, [ 7 ], Node.VALUE_LABEL_D_DS3, [ (Node.VALUE_LABEL_D_DS2, []), (Node.VALUE_LABEL_D_DS3, [1]) ]) remapEftNodeValueLabel(eft1, [ 8 ], Node.VALUE_LABEL_D_DS2, [ (Node.VALUE_LABEL_D_DS1, []) ]) elementtemplate1 = mesh.createElementtemplate()