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

Fix unused scale factor bugs #126

Merged
merged 2 commits into from
Mar 22, 2021
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
2 changes: 0 additions & 2 deletions src/scaffoldmaker/meshtypes/meshtype_3d_heart1.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,6 @@ def generateBaseMesh(cls, region, options):
elif e == (elementsCountAroundLeftAtriumFreeWall - 1):
# general linear map d3 adjacent to collapsed sulcus
eft1 = bicubichermitelinear.createEftNoCrossDerivatives()
setEftScaleFactorIds(eft1, [1], [])
scalefactors = [ -1.0 ]
remapEftNodeValueLabel(eft1, [ 6, 8 ], Node.VALUE_LABEL_D_DS3, [ ( Node.VALUE_LABEL_D_DS1, [] ), ( Node.VALUE_LABEL_D_DS3, []) ])

result = elementtemplate1.defineField(coordinates, -1, eft1)
Expand Down
2 changes: 1 addition & 1 deletion src/scaffoldmaker/meshtypes/meshtype_3d_heartatria2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1014,8 +1014,8 @@ def generateBaseMesh(cls, region, options):
meshGroups = [ laMeshGroup if (i == 0) else raMeshGroup ]
if (e2 == 0) and (((i == 0) and (e1 == e1FreeWallStart)) or ((i == 1) and (e1 == elementsCountAroundAtria + 1))):
eft1 = tricubichermite.createEftNoCrossDerivatives()
setEftScaleFactorIds(eft1, [1], [])
if i == 0:
setEftScaleFactorIds(eft1, [1], [])
remapEftNodeValueLabel(eft1, [ 5 ], Node.VALUE_LABEL_D_DS3, [ ( Node.VALUE_LABEL_D_DS1, [1] ), ( Node.VALUE_LABEL_D_DS3, []) ])
else:
remapEftNodeValueLabel(eft1, [ 6 ], Node.VALUE_LABEL_D_DS3, [ ( Node.VALUE_LABEL_D_DS1, [] ), ( Node.VALUE_LABEL_D_DS3, []) ])
Expand Down
4 changes: 2 additions & 2 deletions src/scaffoldmaker/meshtypes/meshtype_3d_heartventricles1.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,10 +910,10 @@ def generateBaseMesh(cls, region, options):
elif e1 == (elementsCountAroundRVFreeWall - 1):
# general linear map d3 adjacent to collapsed anterior interventricular sulcus
eft1 = tricubichermite.createEftNoCrossDerivatives()
setEftScaleFactorIds(eft1, [1], [])
scalefactors = [ -1.0 ]
if e2 == elementsCountUpLVApex:
# collapsed RV corner uses outside d/dxi2 = d1
setEftScaleFactorIds(eft1, [1], [])
scalefactors = [ -1.0 ]
remapEftNodeValueLabel(eft1, [ 2 ], Node.VALUE_LABEL_D_DS2, [ ( Node.VALUE_LABEL_D_DS1, [] ) ])
remapEftNodeValueLabel(eft1, [ 5 ], Node.VALUE_LABEL_D_DS3, [ ( Node.VALUE_LABEL_D_DS2, [1] ), ( Node.VALUE_LABEL_D_DS3, []) ])
remapEftNodeValueLabel(eft1, [ 6 ], Node.VALUE_LABEL_D_DS3, [ ( Node.VALUE_LABEL_D_DS1, [] ), ( Node.VALUE_LABEL_D_DS2, [1] ), ( Node.VALUE_LABEL_D_DS3, []) ])
Expand Down
15 changes: 12 additions & 3 deletions src/scaffoldmaker/meshtypes/meshtype_3d_heartventricles3.py
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,6 @@ def generateBaseMesh(cls, region, options):
rvNodeId = rvShield.nodeId
n1ln, n2ln = lvShield.convertRimIndex(0)
n1rn, n2rn = rvShield.convertRimIndex(elementsCountAroundFull)
scalefactors = [ -1.0 ]
for ix in range(elementsCountAroundFull):
n1lp, n2lp = n1ln, n2ln
n1ln, n2ln = lvShield.convertRimIndex(ix + 1)
Expand All @@ -954,10 +953,12 @@ def generateBaseMesh(cls, region, options):
nids = [ rvNodeId[0][n2rp][n1rp], rvNodeId[0][n2rn][n1rn], lvNodeId[0][n2lp][n1lp], lvNodeId[0][n2ln][n1ln],
rvNodeId[1][n2rp][n1rp], rvNodeId[1][n2rn][n1rn], lvNodeId[1][n2lp][n1lp], lvNodeId[1][n2ln][n1ln] ]
eft1 = tricubichermite.createEftNoCrossDerivatives()
setEftScaleFactorIds(eft1, [1], [])
scalefactors = None

if ix <= lvShield.elementsCountUpRegular:
nids = [ nids[1], nids[3], nids[0], nids[2], nids[5], nids[7], nids[4], nids[6] ]
setEftScaleFactorIds(eft1, [1], [])
scalefactors = [ -1.0 ]
if ix == lvShield.elementsCountUpRegular:
remapEftNodeValueLabel(eft1, [ 2, 6 ], Node.VALUE_LABEL_D_DS2, [ ( Node.VALUE_LABEL_D_DS1, [1] ) ])
remapEftNodeValueLabel(eft1, [ 2 ], Node.VALUE_LABEL_D_DS1, [ ( Node.VALUE_LABEL_D_DS2, [] ), ( Node.VALUE_LABEL_D_DS3, [1] ) ])
Expand All @@ -974,19 +975,27 @@ def generateBaseMesh(cls, region, options):
elif ix >= (elementsCountAroundFull - 1 - lvShield.elementsCountUpRegular):
nids = [ nids[2], nids[0], nids[3], nids[1], nids[6], nids[4], nids[7], nids[5] ]
if ix == (elementsCountAroundFull - 1 - lvShield.elementsCountUpRegular):
setEftScaleFactorIds(eft1, [1], [])
scalefactors = [ -1.0 ]
remapEftNodeValueLabel(eft1, [ 1 ], Node.VALUE_LABEL_D_DS1, [ ( Node.VALUE_LABEL_D_DS2, [1] ), ( Node.VALUE_LABEL_D_DS3, [] ) ])
remapEftNodeValueLabel(eft1, [ 5 ], Node.VALUE_LABEL_D_DS1, [ ( Node.VALUE_LABEL_D_DS2, [1] ) ])
remapEftNodeValueLabel(eft1, [ 1, 5 ], Node.VALUE_LABEL_D_DS2, [ ( Node.VALUE_LABEL_D_DS1, [] ) ])
remapEftNodeValueLabel(eft1, [ 3 ], Node.VALUE_LABEL_D_DS1, [ ( Node.VALUE_LABEL_D_DS1, [] ), ( Node.VALUE_LABEL_D_DS3, [] ) ])
else:
remapEftNodeValueLabel(eft1, [ 1, 3 ], Node.VALUE_LABEL_D_DS1, [ ( Node.VALUE_LABEL_D_DS1, [] ), ( Node.VALUE_LABEL_D_DS3, [] ) ])
if ix == (elementsCountAroundFull - 1 - rvShield.elementsCountUpRegular):
setEftScaleFactorIds(eft1, [1], [])
scalefactors = [ -1.0 ]
remapEftNodeValueLabel(eft1, [ 2, 6 ], Node.VALUE_LABEL_D_DS2, [ ( Node.VALUE_LABEL_D_DS1, [1] ) ])
remapEftNodeValueLabel(eft1, [ 2, 6 ], Node.VALUE_LABEL_D_DS1, [ ( Node.VALUE_LABEL_D_DS2, [] ) ])
elif ix < (elementsCountAroundFull - 1 - rvShield.elementsCountUpRegular):
setEftScaleFactorIds(eft1, [1], [])
scalefactors = [ -1.0 ]
remapEftNodeValueLabel(eft1, [ 2, 4, 6, 8 ], Node.VALUE_LABEL_D_DS2, [ ( Node.VALUE_LABEL_D_DS1, [1] ) ])
remapEftNodeValueLabel(eft1, [ 2, 4, 6, 8 ], Node.VALUE_LABEL_D_DS1, [ ( Node.VALUE_LABEL_D_DS2, [] ) ])
else:
setEftScaleFactorIds(eft1, [1], [])
scalefactors = [ -1.0 ]
if ix == rvShield.elementsCountUpRegular:
scaleEftNodeValueLabels(eft1, [ 2, 6 ], [ Node.VALUE_LABEL_D_DS1 , Node.VALUE_LABEL_D_DS2 ], [ 1 ])
remapEftNodeValueLabel(eft1, [ 1, 5 ], Node.VALUE_LABEL_D_DS1, [ ( Node.VALUE_LABEL_D_DS2, [1] ) ])
Expand All @@ -1008,7 +1017,7 @@ def generateBaseMesh(cls, region, options):
elementtemplate1.defineField(coordinates, -1, eft1)
element = mesh.createElement(elementIdentifier, elementtemplate1)
result2 = element.setNodesByIdentifier(eft1, nids)
result3 = element.setScaleFactors(eft1, scalefactors)
result3 = element.setScaleFactors(eft1, scalefactors) if scalefactors else None
#print('create element sulcus', elementIdentifier, result2, result3, nids)
#self.elementId[e2][e1] = elementIdentifier
elementIdentifier += 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,6 @@ def generateBaseMesh(cls, region, options):
# 7-node collapsed LV free wall element 1, by lv crest and la
nids = [ nsdl, nsdl + 1, laNodeId[0][3], nsdl + nowl, nsdl + nowl + 1, lv_crest_nid1, laNodeId[1][3] ]
eft1 = tricubichermite.createEftNoCrossDerivatives()
setEftScaleFactorIds(eft1, [1], [])
remapEftNodeValueLabel(eft1, [ 1, 3 ], Node.VALUE_LABEL_D_DS2, [])
remapEftNodeValueLabel(eft1, [ 3 ], Node.VALUE_LABEL_D_DS1, [ ( Node.VALUE_LABEL_D_DS2, [] ) ])
remapEftNodeValueLabel(eft1, [ 3 ], Node.VALUE_LABEL_D_DS3, [ ( Node.VALUE_LABEL_D_DS2, [] ), ( Node.VALUE_LABEL_D_DS3, [] ) ])
Expand Down Expand Up @@ -1151,15 +1150,15 @@ def generateBaseMesh(cls, region, options):
# supraventricular crest outer 2, outer infundibulum 1
nids = [ nidr + 4, nidr + 5, rv_crest_nid1, rvOutletNodeId[0][2], nidr + nowr + 4, nidr + nowr + 5, rv_crest_nid2, rvOutletNodeId[1][2] ]
eft1 = tricubichermite.createEftNoCrossDerivatives()
setEftScaleFactorIds(eft1, [1, 102, 104, 108, 304], [])
setEftScaleFactorIds(eft1, [1], [])
tricubichermite.setEftLinearDerivative(eft1, [ 4, 8 ], Node.VALUE_LABEL_D_DS3, 4, 8, 1)
remapEftNodeValueLabel(eft1, [ 4, 8 ], Node.VALUE_LABEL_D_DS1, [ ( Node.VALUE_LABEL_D_DS1, [] ), ( Node.VALUE_LABEL_D_DS2, [] ) ])
meshGroups += [ conusArteriosusMeshGroup ]
elif e == 6:
# outer infundibulum 2
nids = [ nidr + 5, nidr + 6, rvOutletNodeId[0][2], rvOutletNodeId[0][3], nidr + nowr + 5, nidr + nowr + 6, rvOutletNodeId[1][2], rvOutletNodeId[1][3] ]
eft1 = tricubichermite.createEftNoCrossDerivatives()
setEftScaleFactorIds(eft1, [1, 102, 104, 108, 304], [])
setEftScaleFactorIds(eft1, [1], [])
tricubichermite.setEftLinearDerivative(eft1, [ 3, 7 ], Node.VALUE_LABEL_D_DS3, 3, 7, 1)
tricubichermite.setEftLinearDerivative(eft1, [ 4, 8 ], Node.VALUE_LABEL_D_DS3, 4, 8, 1)
meshGroups += [ conusArteriosusMeshGroup ]
Expand Down
8 changes: 3 additions & 5 deletions src/scaffoldmaker/meshtypes/meshtype_3d_lung1.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ def generateBaseMesh(cls, region, options):
lowerRightNodeIds, upperRightNodeIds, nodeIndex, nodeIdentifier)

# Diaphragm lung nodes
getDiaphragmaticLungNodes(cache, coordinates, generateParameters,
diaNodeIndex, nodeIdentifier = getDiaphragmaticLungNodes(cache, coordinates, generateParameters,
nodes, nodetemplate, nodeFieldParameters,
diaphragmaticElementsCount1, diaphragmaticElementsCount2, diaphragmaticElementsCount3,
diaphragmaticNodeIds, nodeIndex, nodeIdentifier)
Expand Down Expand Up @@ -875,7 +875,6 @@ def getLungElements(coordinates, eftfactory, eftRegular, elementtemplateRegular,
nodeIdentifiers.pop(6)
nodeIdentifiers.pop(2)
eft = eftfactory.createEftBasic()
setEftScaleFactorIds(eft, [1], [])
nodes = [3, 4, 7, 8]
collapseNodes = [3, 7]
remapEftNodeValueLabel(eft, nodes, Node.VALUE_LABEL_D_DS1, [])
Expand Down Expand Up @@ -985,7 +984,6 @@ def getLungElements(coordinates, eftfactory, eftRegular, elementtemplateRegular,
elif (e3 == (uElementsCount3 - 2)) and (e2 == (uElementsCount2 - 2)):
# Remapped cube element 2
eft = eftfactory.createEftBasic()
setEftScaleFactorIds(eft, [1], [])
remapEftNodeValueLabel(eft, [1, 2], Node.VALUE_LABEL_D_DS3,
[(Node.VALUE_LABEL_D_DS2, []), (Node.VALUE_LABEL_D_DS3, [])])
elif None in nodeIdentifiers:
Expand Down Expand Up @@ -1082,17 +1080,17 @@ def getDiaphragmaticLungElements(coordinates, eftfactory, eftRegular, elementtem
NodeIds[e3 + 1][e2 + 1][e1], NodeIds[e3 + 1][e2 + 1][e1 + 1]]

if (e1 == 1) and (e3 == (elementsCount3 - 1)):
# wedge elements along crest
nodeIdentifiers.pop(6)
nodeIdentifiers.pop(4)
eft = eftfactory.createEftBasic()
setEftScaleFactorIds(eft, [1], [])
nodes = [5, 6, 7, 8]
collapseNodes = [5, 7]
remapEftNodeValueLabel(eft, nodes, Node.VALUE_LABEL_D_DS1, [])
remapEftNodeValueLabel(eft, collapseNodes, Node.VALUE_LABEL_D_DS3,
[(Node.VALUE_LABEL_D_DS1, []), (Node.VALUE_LABEL_D_DS3, [])])
if e2 == 0:
# Remapping the element
setEftScaleFactorIds(eft, [1], [])
remapEftNodeValueLabel(eft, [3], Node.VALUE_LABEL_D_DS2,
[(Node.VALUE_LABEL_D_DS2, []), (Node.VALUE_LABEL_D_DS1, [1])])
ln_map = [1, 2, 3, 4, 5, 5, 6, 6]
Expand Down
20 changes: 18 additions & 2 deletions src/scaffoldmaker/meshtypes/meshtype_3d_stellate1.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,10 +403,10 @@ def generateBaseMesh(cls, region, options):

if e1 == 0: # wheel
eft1 = bicubichermitelinear.createEftNoCrossDerivatives()
setEftScaleFactorIds(eft1, [1], [])
scalefactors = [-1.0]
if armCount == 3:
if e2 == 0:
setEftScaleFactorIds(eft1, [1], [])
scalefactors = [-1.0]
scaleEftNodeValueLabels(eft1, [1, 5], [Node.VALUE_LABEL_D_DS1,
Node.VALUE_LABEL_D_DS2], [1])
ns = [3, 7]
Expand All @@ -417,9 +417,13 @@ def generateBaseMesh(cls, region, options):
[(Node.VALUE_LABEL_D_DS1, []),
(Node.VALUE_LABEL_D_DS2, [])])
if e2 == 0:
setEftScaleFactorIds(eft1, [1], [])
scalefactors = [-1.0]
remapEftNodeValueLabel(eft1, ns, Node.VALUE_LABEL_D_DS2,
[(Node.VALUE_LABEL_D_DS1, [1])])
elif na == 1:
setEftScaleFactorIds(eft1, [1], [])
scalefactors = [-1.0]
remapEftNodeValueLabel(eft1, ns, Node.VALUE_LABEL_D_DS1,
[(Node.VALUE_LABEL_D_DS1, [1])])
if e2 == 0:
Expand All @@ -430,6 +434,8 @@ def generateBaseMesh(cls, region, options):
[(Node.VALUE_LABEL_D_DS1, [1]),
(Node.VALUE_LABEL_D_DS2, [1])])
elif na == 2:
setEftScaleFactorIds(eft1, [1], [])
scalefactors = [-1.0]
remapEftNodeValueLabel(eft1, ns, Node.VALUE_LABEL_D_DS1,
[(Node.VALUE_LABEL_D_DS2, [1])])
if e2 == 0:
Expand All @@ -441,6 +447,8 @@ def generateBaseMesh(cls, region, options):
[(Node.VALUE_LABEL_D_DS1, [])])
elif armCount == 4:
if e2 == 0:
setEftScaleFactorIds(eft1, [1], [])
scalefactors = [-1.0]
scaleEftNodeValueLabels(eft1, [1, 5], [Node.VALUE_LABEL_D_DS1,
Node.VALUE_LABEL_D_DS2], [1])
ns = [3, 7]
Expand All @@ -451,9 +459,13 @@ def generateBaseMesh(cls, region, options):
[(Node.VALUE_LABEL_D_DS1, []),
(Node.VALUE_LABEL_D_DS2, [])])
if e2 == 0:
setEftScaleFactorIds(eft1, [1], [])
scalefactors = [-1.0]
remapEftNodeValueLabel(eft1, ns, Node.VALUE_LABEL_D_DS2,
[(Node.VALUE_LABEL_D_DS1, [1])])
elif na == 1:
setEftScaleFactorIds(eft1, [1], [])
scalefactors = [-1.0]
remapEftNodeValueLabel(eft1, ns, Node.VALUE_LABEL_D_DS1,
[(Node.VALUE_LABEL_D_DS1, [1]),
(Node.VALUE_LABEL_D_DS2, [])])
Expand All @@ -464,6 +476,8 @@ def generateBaseMesh(cls, region, options):
remapEftNodeValueLabel(eft1, ns, Node.VALUE_LABEL_D_DS2,
[(Node.VALUE_LABEL_D_DS1, [1])])
elif na == 2:
setEftScaleFactorIds(eft1, [1], [])
scalefactors = [-1.0]
remapEftNodeValueLabel(eft1, ns, Node.VALUE_LABEL_D_DS1,
[(Node.VALUE_LABEL_D_DS1, [1]),
(Node.VALUE_LABEL_D_DS2, [1])])
Expand All @@ -474,6 +488,8 @@ def generateBaseMesh(cls, region, options):
remapEftNodeValueLabel(eft1, ns, Node.VALUE_LABEL_D_DS2,
[(Node.VALUE_LABEL_D_DS2, [1])])
elif na == 3:
setEftScaleFactorIds(eft1, [1], [])
scalefactors = [-1.0]
remapEftNodeValueLabel(eft1, ns, Node.VALUE_LABEL_D_DS1,
[(Node.VALUE_LABEL_D_DS1, []),
(Node.VALUE_LABEL_D_DS2, [1])])
Expand Down
Loading