-
Notifications
You must be signed in to change notification settings - Fork 0
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
PoC / Paraview integration for mesh_doctor #16
base: main
Are you sure you want to change the base?
Conversation
Unfortunately @untereiner, Therefore, there is still a need to install from a source the packaged though it can be as a usual package and not in the Paraview python version (unlike I initially thought) |
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.
Thx!
from paraview.util.vtkAlgorithm import * | ||
from paraview.selection import * |
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.
If possible, please be specific about what you include (i.e. no *
)
from paraview.vtk import vtkIdTypeArray, vtkSelectionNode, vtkSelection, vtkCollection | ||
from vtk import vtkExtractSelection |
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.
We usually try to put all the includes at the top of the file, not nested in functions.
BTW, I'm surprised you have to gather vtkExtractSelection
from vtk
while everything else is available from praview.vtk
? I've seen a vtkPVExtractSelection
available. Do you think that could make it?
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.
Indeed I was also suprised that it is missing and TBF jumped right to the closest working version from what I already had.
I will try with vtkPVExtractSelection
which should wrap the same functions as originally vtkExtractSelection
extracted.SetInputDataObject(0, mesh) | ||
extracted.SetInputData(1, selection) | ||
extracted.Update() | ||
print("There are {} cells under {} m3 vol".format(extracted.GetOutput().GetNumberOfCells(), self.opt)) |
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.
Please use a logger instead.
Maybe use f-strings
as well?
Are you sure about the unit?
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.
I will discard text printing as it is more of a debug tool for now
print("There are {} cells under {} m3 vol".format(extracted.GetOutput().GetNumberOfCells(), self.opt)) | ||
print("There are {} arrays of cell data".format(extracted.GetOutput().GetCellData().GetNumberOfArrays(), self.opt)) | ||
|
||
return extracted |
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.
Do you want to return the extracted
of some kind of extracted.GetOuput()
?
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.
I indeed only need to return a vtkUnstructuredMesh
print("1> There are {} cells under {} m3 vol".format(outData.GetNumberOfCells(), self.opt)) | ||
return 1 | ||
|
||
def _Process(self,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.
Could you add type hints to your functions (if there's no problem with some python compatibility)?
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.
Done
Exploring However, reading through sources, it seems that a self-contained path would be to flag cells that violate threshold (instead of extracting them), which is denoted as It can be further down extracted later through |
Well that makes sense @jafranc But does that imply some refactoring in |
Yes it would require for the two demonstrated here The other functionality would require to return iterable list of cells to flag, though with not too much effort it could be a point/node set for
|
Yes, we can handle this that's OK I think.
Yes, in |
This PR transfer from discussion on GEOS' PR #2790
This is a test to leverage
mesh_doctor
inParaview
either as a Python Programmable Filter or a python pluginA example is given for
element_volumes
check.It is run over the unstructured version of spe11a join here.
spe11a_mesh_.zip
As a programmable filter
mesh_doctor
has to be deploy in the Paraview python hierarchy so it is able to get the import pathAs a python plugin
As exemplified here, going through the loading procedure allow load and access to Mesh Doctor(GEOS) as a new filter (for now only volume check is available).
Note that as stated in documentation, the test packaged
mesh_doctor
version has been modified so thatelementVolumes.check
takes a vtk mesh as input (instead of a file name) asParaview
is in charge of loading meshes here. This reduce to using the__check
function included inelementVolumes
.