-
Notifications
You must be signed in to change notification settings - Fork 543
Implement a new MeshMaterialFilter #3406
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
base: develop
Are you sure you want to change the base?
Conversation
string = type(self).__name__ + '\n' | ||
string += '{: <16}=\t{}\n'.format('\tID', self.id) | ||
string += '{: <16}=\t{}\n'.format('\tMesh ID', self.mesh.id) | ||
string += '{: <16}=\t{}\n'.format('\tBins', self.bins) |
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.
The Bins print to terminal, but the spacing is not ideal, perhaps add more white spacing to indent
MeshMaterialFilter
ID = 2
Mesh ID = 2
Bins = [[644 1]
[645 1]
[654 1]
[655 1]
[744 1]
[745 1]
[754 1]
[755 1]
[844 1]
[845 1]
[854 1]
[855 1]]
Translation = None
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.
Nice @paulromano! I'm looking forward to trying this out. Some potential small refactors suggested here.
// First determine which elements the particle crosses (may or may not | ||
// actually match bins so we have to adjust bins_/weight_ after) | ||
int32_t n_start = match.bins_.size(); | ||
model::meshes[mesh_]->bins_crossed( |
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 think defining our own FilterMatch
, let's call it mesh_match
, here to pass to the mesh would simplify what's going on in the loop below. We can then sequentially remove invalid bins to match
from mesh_match
and add the remaining valid bins to match
at the end.
Awesome, thanks Patrick, looks like lots of good changes. I've been putting this branch to use to see how the workflow goes. I can probably improve this draft notebook. It does appear possible to do and R2S workflow with this new MeshMaterialFilter. I can't say it was easy and I'm not 100% sure I've done all the processing correctly but I've got something here. I think we could consider adding some utility functions to make some of the stages more compact. |
Co-authored-by: Jonathan Shimwell <drshimwell@gmail.com> Co-authored-by: Patrick Shriwise <pshriwise@gmail.com>
Description
This PR implements a new
MeshMaterialFilter
that allows tallying specific combinations of mesh elements and materials. In principle, one can already do this by combining aMeshFilter
and aMaterialFilter
. However, in many cases a single mesh element only contains a few materials, which means tallying every single material for each mesh element would be very wasteful. This new filter works in conjunction with theMesh.material_volumes()
method, which returns aMeshMaterialVolumes
object. This filter has afrom_volumes()
classmethod that will create a filter with bins for all mesh element-material combinations that were found from the call tomaterial_volumes()
. So, the workflow is basically:This new filter is one of the last infrastructural pieces needed to carry out mesh-based subvoxel R2S calculations.
Checklist