-
Notifications
You must be signed in to change notification settings - Fork 9
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 combination of skin extraction with scoping #673
Merged
janvonrickenbach
merged 34 commits into
master
from
jvonrick/fix_skin_extraction_with_selection
Aug 28, 2024
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
441c44e
Fix combination of skin extraction with scoping
janvonrickenbach d681a5b
Don't export skin scoping separately
janvonrickenbach 431c7fd
Simplify logic with forward operators
janvonrickenbach 8ab7fe2
Fix problem with forward operator
janvonrickenbach 75087b1
Remove view of selection workflow
janvonrickenbach 2962315
Fix server assignment for forwarding operators
janvonrickenbach 2a15039
Update test assertions
janvonrickenbach 13cb6fd
Cleanup
janvonrickenbach e524c62
Run pre commit on all files
janvonrickenbach 7e74ba1
Add new tests that checks the exact values of on the skin
janvonrickenbach a875ac9
Add tests for principal and equivalent results
janvonrickenbach 460996e
Add tests for displacement
janvonrickenbach 7a278d4
Simplify test code
janvonrickenbach 78cc56a
Cleanup
janvonrickenbach 48211c3
Cleanup and more comments
janvonrickenbach 37c9a40
Fix some tests
janvonrickenbach 831abbf
Fix some tests
janvonrickenbach a1dd1cb
Fix some tests
janvonrickenbach 5381f06
Fix some tests
janvonrickenbach 37f6ba8
Fix some tests
janvonrickenbach 2aeb1b9
Add cyclic tests
janvonrickenbach b590bfc
Add tests for cyclic simulations
janvonrickenbach dc5a97b
Merge branch 'master' into jvonrick/fix_skin_extraction_with_selection
janvonrickenbach 5424196
Fix checks for server version
janvonrickenbach a2d792f
Merge remote-tracking branch 'origin/jvonrick/fix_skin_extraction_wit…
janvonrickenbach 67ff7eb
New workflow is only supported for server versions 8_0 and higher
janvonrickenbach 084af72
Fix check for server version
janvonrickenbach f007436
Skip tests for older server versions
janvonrickenbach 4686a92
Fix result comparison for older version
janvonrickenbach aefadc3
Fix getting the solid mesh element ids for older versions
janvonrickenbach bbc2d4f
Add tests for more complicated skin geometries
janvonrickenbach 1545e62
Small cosmetic improvements
janvonrickenbach 085dfaa
Adapt to backend changes: solid to skin mapping operator now propagat…
janvonrickenbach dae7b64
Skip principal strain tests for server version before 9.0
janvonrickenbach 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ | |
class _WfNames: | ||
data_sources = "data_sources" | ||
scoping = "scoping" | ||
skin_input_mesh = "skin_input_mesh" | ||
final_scoping = "final_scoping" | ||
scoping_a = "scoping_a" | ||
scoping_b = "scoping_b" | ||
|
@@ -404,9 +405,24 @@ def select_skin( | |
be returned by the Operator ``operators.metadata.is_cyclic``. Used to get the skin | ||
on the expanded mesh. | ||
""" | ||
op = operators.mesh.skin(server=self._server) | ||
self._selection.add_operator(op) | ||
mesh_input = op.inputs.mesh | ||
|
||
def connect_any(operator_input, input_value): | ||
# Workaround to connect any inputs: see | ||
# https://github.com/ansys/pydpf-core/issues/1670 | ||
operator_input._operator().connect(operator_input._pin, input_value) | ||
|
||
skin_operator = operators.mesh.skin(server=self._server) | ||
self._selection.add_operator(skin_operator) | ||
|
||
initial_mesh_fwd_op = operators.utility.forward(server=self._server) | ||
self._selection.set_input_name( | ||
_WfNames.initial_mesh, initial_mesh_fwd_op.inputs.any | ||
) | ||
self._selection.add_operator(initial_mesh_fwd_op) | ||
|
||
skin_operator_input_mesh_fwd_op = operators.utility.forward(server=self._server) | ||
connect_any(skin_operator_input_mesh_fwd_op.inputs.any, initial_mesh_fwd_op) | ||
self._selection.add_operator(skin_operator_input_mesh_fwd_op) | ||
|
||
if _is_model_cyclic(is_model_cyclic): | ||
mesh_provider_cyc = operators.mesh.mesh_provider() | ||
|
@@ -436,13 +452,11 @@ def select_skin( | |
server=self._server, | ||
) | ||
self._selection.add_operator(mesh_by_scop_op) | ||
op.inputs.mesh.connect(mesh_by_scop_op) | ||
skin_operator_input_mesh_fwd_op.inputs.any(mesh_by_scop_op) | ||
else: | ||
op.inputs.mesh.connect(mesh_provider_cyc) | ||
self._selection.set_input_name( | ||
_WfNames.initial_mesh, mesh_provider_cyc, 100 | ||
) # hack | ||
mesh_input = None | ||
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. I'm not sure why mesh_input was set to None here. It is checked on line 459, but I just replaced this checked with a not _is_model_cyclic check. |
||
skin_operator_input_mesh_fwd_op.inputs.any(mesh_provider_cyc) | ||
|
||
mesh_provider_cyc.connect(100, initial_mesh_fwd_op.outputs.any) | ||
|
||
elif elements is not None: | ||
if not isinstance(elements, Scoping): | ||
|
@@ -453,34 +467,50 @@ def select_skin( | |
scoping=elements, server=self._server | ||
) | ||
self._selection.add_operator(mesh_by_scop_op) | ||
mesh_input = mesh_by_scop_op.inputs.mesh | ||
op.inputs.mesh.connect(mesh_by_scop_op) | ||
skin_operator_input_mesh_fwd_op.inputs.any(mesh_by_scop_op.outputs.mesh) | ||
connect_any(mesh_by_scop_op.inputs.mesh, initial_mesh_fwd_op.outputs.any) | ||
|
||
if mesh_input is not None: | ||
self._selection.set_input_name(_WfNames.initial_mesh, mesh_input) | ||
if not _is_model_cyclic(is_model_cyclic): | ||
if location == result_native_location: | ||
self._selection.set_output_name(_WfNames.mesh, op.outputs.mesh) | ||
self._selection.set_output_name(_WfNames.skin, op.outputs.mesh) | ||
self._selection.set_output_name( | ||
_WfNames.mesh, skin_operator.outputs.mesh | ||
) | ||
|
||
self._selection.set_output_name(_WfNames.skin, skin_operator.outputs.mesh) | ||
if location == locations.nodal and result_native_location == locations.nodal: | ||
self._selection.set_output_name( | ||
_WfNames.scoping, op.outputs.nodes_mesh_scoping | ||
_WfNames.scoping, skin_operator.outputs.nodes_mesh_scoping | ||
) | ||
|
||
elif not _is_model_cyclic(is_model_cyclic) and ( | ||
result_native_location == locations.elemental | ||
or result_native_location == locations.elemental_nodal | ||
): | ||
transpose_op = operators.scoping.transpose( | ||
mesh_scoping=op.outputs.nodes_mesh_scoping, server=self._server | ||
mesh_scoping=skin_operator.outputs.nodes_mesh_scoping, | ||
server=self._server, | ||
) | ||
self._selection.add_operator(transpose_op) | ||
self._selection.set_input_name( | ||
_WfNames.initial_mesh, transpose_op.inputs.meshed_region | ||
connect_any( | ||
transpose_op.inputs.meshed_region, initial_mesh_fwd_op.outputs.any | ||
) | ||
self._selection.set_output_name( | ||
_WfNames.scoping, transpose_op.outputs.mesh_scoping_as_scoping | ||
) | ||
|
||
connect_any( | ||
skin_operator.inputs.mesh, skin_operator_input_mesh_fwd_op.outputs.any | ||
) | ||
|
||
# Provide the input mesh from which a skin was generated | ||
# This is useful because the skin_mesh contains the mapping of | ||
# skin elements to the original mesh element indices, which is used | ||
# by the solid_to_skin_fc operator. The skin_input_mesh can be passed | ||
# to the solid_to_skin_fc operator to ensure that the mapping is correct. | ||
self._selection.set_output_name( | ||
_WfNames.skin_input_mesh, skin_operator_input_mesh_fwd_op.outputs.any | ||
) | ||
|
||
def select_with_scoping(self, scoping: Scoping): | ||
"""Directly sets the scoping as the spatial selection. | ||
|
||
|
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
Oops, something went wrong.
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.
Hey @janvonrickenbach,
If I remember correctly, it should be because this is what is done in the Mechanical workflow.
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.
Thanks, this is also what Camille mentioned. I will add a note in the upcomping refactoring PR.