Skip to content
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

Initial 2D intersection shaping #1509

Merged
merged 22 commits into from
Mar 11, 2025
Merged

Initial 2D intersection shaping #1509

merged 22 commits into from
Mar 11, 2025

Conversation

bmhan12
Copy link
Contributor

@bmhan12 bmhan12 commented Mar 3, 2025

This PR:

  • Adds 2D intersection shaping, accepting as input either a 2D stl mesh of triangles (0 for z-coordinates) or a 2D in-memory triangle blueprint mesh.
    • quest_shape_in_memory.cpp modified to support a 2D in-memory triangle mesh (create2DShapeSet).
  • Adds additional utility functions to mesh_helpers for generation of 2D quad meshes using mfem/sidre/blueprint
  • Related PR 2D intersection shaping example axom_data#25 adds a 2D stl mesh for testing.
  • Fixes bug in shaping_driver.cpp where policy used for allocation would always be sequential.
  • Runtime regex output tests added in src/axom/quest/examples/CMakeLists.txt for quest_shaping_driver_ex and quest_shape_in_memory_ex executables.

@bmhan12 bmhan12 added the question Further information is requested label Mar 3, 2025
@bmhan12 bmhan12 self-assigned this Mar 3, 2025
@bmhan12 bmhan12 added Quest Issues related to Axom's 'quest' component and removed question Further information is requested labels Mar 3, 2025
Copy link
Member

@kennyweiss kennyweiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bmhan12!

Comment on lines +589 to +599
/*
Constructing a mint mesh from meshGrp fails unless we add some
extra data. Blueprint doesn't require this extra data. (The mesh
passes conduit's Blueprint verification.) This should be fixed,
or we should write better blueprint support utilities.
*/
/*
Make the coordinate arrays 2D to use mint::Mesh.
For some reason, mint::Mesh requires the arrays to be
2D, even though the second dimension is always 1.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bmhan12 -- could you please create an issue for this? We should update mint to match the blueprint, if possible

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this issue cover it? #1450

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it

Comment on lines +229 to +232
# steel triangle: star composed of 16 right triangles with
# leg length 0.25 has analytic volume 0.5
set_tests_properties(${_testname} PROPERTIES
PASS_REGULAR_EXPRESSION "Volume of material 'steel' is 0.5")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


// Get the coordinates for the vertices
for(int j = 0; j < NUM_VERTS_PER_HEX; ++j)
// This runs only only on host, because the mfem::Mesh only uses host memory, I think.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think Axom currently tests an mfem+{cuda,hip} configuration.
We could add one and make the mfem::Mesh use device memory if/when necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think Axom currently tests an mfem+{cuda,hip} configuration.

Definitely good to have enabled, captured this task in issue #1514 .

volView[cellIdx] = hexesView[cellIdx].volume();
});
// Set vertex coords to zero if within threshold.
// (I don't know why we do this. I'm following examples.)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is sort of strange to only snap for coordinates near zero.
Anyone have thoughts/context?

We probably shouldn't check this comment in though :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is sort of strange to only snap for coordinates near zero.

I made a comment about it here.
I don't think these "snaps" are needed, and have removed them from quest_shape_in_memory.cpp and IntersectionShaper.cpp

Comment on lines +111 to +125
axom::sidre::Group* make_structured_blueprint_box_mesh_2d(
axom::sidre::Group* meshGrp,
const primal::BoundingBox<double, 2>& bbox,
const NumericArray<int, 2>& res,
const std::string& topologyName = "mesh",
const std::string& coordsetName = "coords",
axom::runtime_policy::Policy runtimePolicy = axom::runtime_policy::Policy::seq);

axom::sidre::Group* make_unstructured_blueprint_box_mesh_2d(
axom::sidre::Group* meshGrp,
const primal::BoundingBox<double, 2>& bbox,
const NumericArray<int, 2>& res,
const std::string& topologyName = "mesh",
const std::string& coordsetName = "coords",
axom::runtime_policy::Policy runtimePolicy = axom::runtime_policy::Policy::seq);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is declared identically twice.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are both necessary, one is for unstructured and the other for structured mesh generation (though I agree the names are very similar).

Copy link
Contributor

@gunney1 gunney1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bmhan12 Please fix the repeated declaration. Looks good otherwise.

@bmhan12 bmhan12 merged commit 940e6ad into develop Mar 11, 2025
13 checks passed
@bmhan12 bmhan12 deleted the feature/han12/2d_shaping branch March 11, 2025 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Quest Issues related to Axom's 'quest' component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants