-
Notifications
You must be signed in to change notification settings - Fork 35
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
Linear basis through wall for sphere shell #23
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b55d5c7
Add linear basis through wall
mlin865 f38f55f
Merge remote-tracking branch 'abi/master' into bicubicSphereShell
mlin865 0df8652
Rename useCubicHermite as useCubicHermiteThroughWall
mlin865 9945ffa
Apply duck typing on eftfactory
mlin865 71bd05a
Correct function name for creating shell top and bottom in other mesh…
mlin865 02162c6
Delete lines made redundant from duck typing
mlin865 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
|
||
from __future__ import division | ||
import math | ||
from scaffoldmaker.utils.eftfactory_bicubichermitelinear import eftfactory_bicubichermitelinear | ||
from scaffoldmaker.utils.eftfactory_tricubichermite import eftfactory_tricubichermite | ||
from scaffoldmaker.utils.zinc_utils import * | ||
from scaffoldmaker.utils.meshrefinement import MeshRefinement | ||
|
@@ -33,6 +34,7 @@ def getDefaultOptions(): | |
'Length ratio' : 1.0, | ||
'Element length ratio equator/apex' : 1.0, | ||
'Use cross derivatives' : False, | ||
'Use linear through wall' : False, | ||
'Refine' : False, | ||
'Refine number of elements around' : 1, | ||
'Refine number of elements up' : 1, | ||
|
@@ -52,6 +54,7 @@ def getOrderedOptionNames(): | |
'Length ratio', | ||
'Element length ratio equator/apex', | ||
'Use cross derivatives', | ||
'Use linear through wall', | ||
'Refine', | ||
'Refine number of elements around', | ||
'Refine number of elements up', | ||
|
@@ -89,7 +92,8 @@ def checkOptions(options): | |
@staticmethod | ||
def generateBaseMesh(region, options): | ||
""" | ||
Generate the base tricubic Hermite mesh. See also generateMesh(). | ||
Generate the base tricubic Hermite or bicubic Hermite linear mesh. | ||
See also generateMesh(). | ||
:param region: Zinc region to define model in. Must be empty. | ||
:param options: Dict containing options. See getDefaultOptions(). | ||
:return: None | ||
|
@@ -98,6 +102,7 @@ def generateBaseMesh(region, options): | |
elementsCountUp = options['Number of elements up'] | ||
elementsCountThroughWall = options['Number of elements through wall'] | ||
useCrossDerivatives = options['Use cross derivatives'] | ||
useCubicHermiteThroughWall = not(options['Use linear through wall']) | ||
excludeBottomRows = options['Exclude bottom rows'] | ||
excludeTopRows = options['Exclude top rows'] | ||
wallThickness = options['Wall thickness'] | ||
|
@@ -115,27 +120,30 @@ def generateBaseMesh(region, options): | |
nodetemplateApex.setValueNumberOfVersions(coordinates, -1, Node.VALUE_LABEL_VALUE, 1) | ||
nodetemplateApex.setValueNumberOfVersions(coordinates, -1, Node.VALUE_LABEL_D_DS1, 1) | ||
nodetemplateApex.setValueNumberOfVersions(coordinates, -1, Node.VALUE_LABEL_D_DS2, 1) | ||
nodetemplateApex.setValueNumberOfVersions(coordinates, -1, Node.VALUE_LABEL_D_DS3, 1) | ||
if useCubicHermiteThroughWall: | ||
nodetemplateApex.setValueNumberOfVersions(coordinates, -1, Node.VALUE_LABEL_D_DS3, 1) | ||
if useCrossDerivatives: | ||
nodetemplate = nodes.createNodetemplate() | ||
nodetemplate.defineField(coordinates) | ||
nodetemplate.setValueNumberOfVersions(coordinates, -1, Node.VALUE_LABEL_VALUE, 1) | ||
nodetemplate.setValueNumberOfVersions(coordinates, -1, Node.VALUE_LABEL_D_DS1, 1) | ||
nodetemplate.setValueNumberOfVersions(coordinates, -1, Node.VALUE_LABEL_D_DS2, 1) | ||
nodetemplate.setValueNumberOfVersions(coordinates, -1, Node.VALUE_LABEL_D2_DS1DS2, 1) | ||
nodetemplate.setValueNumberOfVersions(coordinates, -1, Node.VALUE_LABEL_D_DS3, 1) | ||
nodetemplate.setValueNumberOfVersions(coordinates, -1, Node.VALUE_LABEL_D2_DS1DS3, 1) | ||
nodetemplate.setValueNumberOfVersions(coordinates, -1, Node.VALUE_LABEL_D2_DS2DS3, 1) | ||
nodetemplate.setValueNumberOfVersions(coordinates, -1, Node.VALUE_LABEL_D3_DS1DS2DS3, 1) | ||
if useCubicHermiteThroughWall: | ||
nodetemplate.setValueNumberOfVersions(coordinates, -1, Node.VALUE_LABEL_D_DS3, 1) | ||
nodetemplate.setValueNumberOfVersions(coordinates, -1, Node.VALUE_LABEL_D2_DS1DS3, 1) | ||
nodetemplate.setValueNumberOfVersions(coordinates, -1, Node.VALUE_LABEL_D2_DS2DS3, 1) | ||
nodetemplate.setValueNumberOfVersions(coordinates, -1, Node.VALUE_LABEL_D3_DS1DS2DS3, 1) | ||
else: | ||
nodetemplate = nodetemplateApex | ||
|
||
mesh = fm.findMeshByDimension(3) | ||
|
||
tricubichermite = eftfactory_tricubichermite(mesh, useCrossDerivatives) | ||
eft = tricubichermite.createEftBasic() | ||
|
||
tricubicHermiteBasis = fm.createElementbasis(3, Elementbasis.FUNCTION_TYPE_CUBIC_HERMITE) | ||
if useCubicHermiteThroughWall: | ||
eftfactory = eftfactory_tricubichermite(mesh, useCrossDerivatives) | ||
else: | ||
eftfactory = eftfactory_bicubichermitelinear(mesh, useCrossDerivatives) | ||
eft = eftfactory.createEftBasic() | ||
|
||
elementtemplate = mesh.createElementtemplate() | ||
elementtemplate.setElementShapeType(Element.SHAPE_TYPE_CUBE) | ||
|
@@ -232,7 +240,8 @@ def generateBaseMesh(region, options): | |
coordinates.setNodeParameters(cache, -1, Node.VALUE_LABEL_VALUE, 1, [ 0.0, 0.0, position[1] ]) | ||
coordinates.setNodeParameters(cache, -1, Node.VALUE_LABEL_D_DS1, 1, [ 0.0, vector2[0], 0.0 ]) | ||
coordinates.setNodeParameters(cache, -1, Node.VALUE_LABEL_D_DS2, 1, [ vector2[0], 0.0, 0.0 ]) | ||
coordinates.setNodeParameters(cache, -1, Node.VALUE_LABEL_D_DS3, 1, [ 0.0, 0.0, vector3[1] ]) | ||
if useCubicHermiteThroughWall: | ||
coordinates.setNodeParameters(cache, -1, Node.VALUE_LABEL_D_DS3, 1, [ 0.0, 0.0, vector3[1] ]) | ||
nodeIdentifier = nodeIdentifier + 1 | ||
|
||
elif n2 < elementsCountUp: | ||
|
@@ -266,12 +275,14 @@ def generateBaseMesh(region, options): | |
coordinates.setNodeParameters(cache, -1, Node.VALUE_LABEL_VALUE, 1, x) | ||
coordinates.setNodeParameters(cache, -1, Node.VALUE_LABEL_D_DS1, 1, dx_ds1) | ||
coordinates.setNodeParameters(cache, -1, Node.VALUE_LABEL_D_DS2, 1, dx_ds2) | ||
coordinates.setNodeParameters(cache, -1, Node.VALUE_LABEL_D_DS3, 1, dx_ds3) | ||
if useCubicHermiteThroughWall: | ||
coordinates.setNodeParameters(cache, -1, Node.VALUE_LABEL_D_DS3, 1, dx_ds3) | ||
if useCrossDerivatives: | ||
coordinates.setNodeParameters(cache, -1, Node.VALUE_LABEL_D2_DS1DS2, 1, zero) | ||
coordinates.setNodeParameters(cache, -1, Node.VALUE_LABEL_D2_DS1DS3, 1, zero) | ||
coordinates.setNodeParameters(cache, -1, Node.VALUE_LABEL_D2_DS2DS3, 1, zero) | ||
coordinates.setNodeParameters(cache, -1, Node.VALUE_LABEL_D3_DS1DS2DS3, 1, zero) | ||
if useCubicHermiteThroughWall: | ||
coordinates.setNodeParameters(cache, -1, Node.VALUE_LABEL_D2_DS1DS3, 1, zero) | ||
coordinates.setNodeParameters(cache, -1, Node.VALUE_LABEL_D2_DS2DS3, 1, zero) | ||
coordinates.setNodeParameters(cache, -1, Node.VALUE_LABEL_D3_DS1DS2DS3, 1, zero) | ||
nodeIdentifier = nodeIdentifier + 1 | ||
|
||
else: | ||
|
@@ -281,7 +292,8 @@ def generateBaseMesh(region, options): | |
coordinates.setNodeParameters(cache, -1, Node.VALUE_LABEL_VALUE, 1, [ 0.0, 0.0, position[1] ]) | ||
coordinates.setNodeParameters(cache, -1, Node.VALUE_LABEL_D_DS1, 1, [ 0.0, vector2[0], 0.0 ]) | ||
coordinates.setNodeParameters(cache, -1, Node.VALUE_LABEL_D_DS2, 1, [ -vector2[0], 0.0, 0.0 ]) | ||
coordinates.setNodeParameters(cache, -1, Node.VALUE_LABEL_D_DS3, 1, [ 0.0, 0.0, vector3[1] ]) | ||
if useCubicHermiteThroughWall: | ||
coordinates.setNodeParameters(cache, -1, Node.VALUE_LABEL_D_DS3, 1, [ 0.0, 0.0, vector3[1] ]) | ||
nodeIdentifier = nodeIdentifier + 1 | ||
|
||
# create elements | ||
|
@@ -311,7 +323,10 @@ def generateBaseMesh(region, options): | |
for e1 in range(elementsCountAround): | ||
va = e1 | ||
vb = (e1 + 1)%elementsCountAround | ||
eft1 = tricubichermite.createEftShellApexBottom(va*100, vb*100) | ||
if useCubicHermiteThroughWall: | ||
eft1 = eftfactory.createEftShellPoleBottom(va*100, vb*100) | ||
else: | ||
eft1 = eftfactory.createEftShellPoleBottom(va*100, vb*100) | ||
elementtemplate1.defineField(coordinates, -1, eft1) | ||
element = mesh.createElement(elementIdentifier, elementtemplate1) | ||
bni1 = no + 1 | ||
|
@@ -357,7 +372,10 @@ def generateBaseMesh(region, options): | |
for e1 in range(elementsCountAround): | ||
va = e1 | ||
vb = (e1 + 1)%elementsCountAround | ||
eft1 = tricubichermite.createEftShellApexTop(va*100, vb*100) | ||
if useCubicHermiteThroughWall: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These 4 lines should just be:
as the same code is called in both cases. |
||
eft1 = eftfactory.createEftShellPoleTop(va*100, vb*100) | ||
else: | ||
eft1 = eftfactory.createEftShellPoleTop(va*100, vb*100) | ||
elementtemplate1.defineField(coordinates, -1, eft1) | ||
element = mesh.createElement(elementIdentifier, elementtemplate1) | ||
bni3 = no + now | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 4 lines should just be:
as the same code is called in both cases.