-
Notifications
You must be signed in to change notification settings - Fork 25
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
Feat/plot warped mesh #269
Conversation
Codecov Report
@@ Coverage Diff @@
## master #269 +/- ##
==========================================
+ Coverage 86.22% 86.32% +0.10%
==========================================
Files 52 52
Lines 5661 5697 +36
==========================================
+ Hits 4881 4918 +37
+ Misses 780 779 -1 |
Remove treatment of kwarg show_axes in add_point_labels as only kwargs for pv.add_point_labels are supposed to be supported there, and it has nothing to do here. This should increase test coverage of the PR to 100%.
ansys/dpf/core/field.py
Outdated
@@ -262,12 +264,20 @@ def plot(self, shell_layers=None, **kwargs): | |||
shell_layers : shell_layers, optional | |||
Enum used to set the shell layers if the model to plot | |||
contains shell elements. The default is ``None``. | |||
scaling_result : result operator, optional |
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.
This class name will reflect poorly in the doc, the real type name needs to be used.
I also think that restricting the input type to "Result" is not a good idea, Operators (maybe even Field and Fields Containers) should be supported. "Result" is a helper but not a main DPF entity
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.
@cbellot000 I am not sure I understand how we would scale by an Operator other than a Result Operator. Also I thought it was just a specific type of Operator. The problem here is that if I put "Operator" as input type in the docstring and it only supports Result operators, there might be issues.
As for Field and FieldsContainer support, it can be done. I just wanted to get a first feature out there.
title='MeshedRegion', text='MeshedRegion.plot(disp_field)') | ||
|
||
# Split the model by material and plot the deformed MeshesContainer obtained | ||
split_mesh_op = dpf.Operator("split_mesh") |
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.
old operator syntax
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.
@cbellot000 Reworked
…and changed the docstring for deform_by.
…rm_by argument for plotting.
* WIP * Fixed MeshedRegion.plot(warped) * Clean example * Finish adding scale factor text * Add show_axes=True as default when plotting * Forcing protobuf to less than 4.* * Fix error when warping_field is None for MeshesContainer.plot * Refactor name of argument as "warp_by" Update docstrings * Fix coordinates as optional in _as_vtk * Refactor the first test with more pythonic and newer API calls. * Renamed the mesh warp method to scale_coordinates_by_result * Rename scaling method, and fixed an error * Rename parameter to scaling_result * Remove unused DpfPlotter.update_mesh Remove treatment of kwarg show_axes in add_point_labels as only kwargs for pv.add_point_labels are supposed to be supported there, and it has nothing to do here. This should increase test coverage of the PR to 100%. * Improve operator instantiations in example * Renamed scaling_result as deform_by, scaling_factor as scale_factor, and changed the docstring for deform_by. * Show support for Field, Operator, Result or FieldsContainer as a deform_by argument for plotting. # Conflicts: # ansys/dpf/core/meshed_region.py
This PR adds the possibility to use a result to warp the mesh with.
This result should give a 3D vector field.
This enables for example the plotting of deformed geometries by giving as input a displacement result at a specific time step:
disp_result = model.results.displacement.on_time_scoping([step])
mesh.plot(warping_field=disp_result, scaling_factor=scaling_factor)