Skip to content

Add Pro/E input to intersection shaping driver#1111

Merged
bmhan12 merged 33 commits intodevelopfrom
feature/han12/shaping_proe
Jun 13, 2023
Merged

Add Pro/E input to intersection shaping driver#1111
bmhan12 merged 33 commits intodevelopfrom
feature/han12/shaping_proe

Conversation

@bmhan12
Copy link
Copy Markdown
Contributor

@bmhan12 bmhan12 commented Jun 6, 2023

This PR:

  • Adds Pro/E format as an input to the intersection shaping driver
  • Updates data submodule with klee and Pro/E files to test the new format in the quest_intersection_shaper unit tests:

Related to llnl/axom_data#16

Pro/E Case 1:
proeCase1

Pro/E Case 2:
proeCase2

@bmhan12 bmhan12 added Quest Issues related to Axom's 'quest' component Primal Issues related to Axom's 'primal component labels Jun 6, 2023
Copy link
Copy Markdown
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!

Please don't forget to update the RELEASE-NOTES.

Comment thread src/axom/primal/geometry/Octahedron.hpp
Comment on lines +610 to +631
for(int i = 0; i < m_num_vertices; i++)
{
for(int j = i + 1; j < m_num_vertices; j++)
{
// operator= for Point does not want to play nice...
if(m_vertices[i][0] == m_vertices[j][0] &&
m_vertices[i][1] == m_vertices[j][1] &&
m_vertices[i][2] == m_vertices[j][2])
{
return false;
}
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@bmhan12 -- do we always want to call a Polyhedron invalid when it has duplicated vertices?
There are some cases that I can think of where this might be beneficial.

Also, should we be checking for exact duplicates? or should we be supplying a tolerance and checking that the distance b/w vertices is not nearly zero subject to that tolerance?

Suggestion: I think it would be clearer to move the highlighted code to a new function hasDuplicatedVertices(double EPS), and consider calling it explicitly, when necessary.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

do we always want to call a Polyhedron invalid when it has duplicated vertices?

Admittedly, I'm not sure.
I did find this case needs to be handled for the Polyhedron::volume() function. It resulted in an infinite loop condition.
I've added a new test in primal_clip.cpp for this case in particular.

Also, should we be checking for exact duplicates? or should we be supplying a tolerance and checking that the distance b/w vertices is not nearly zero subject to that tolerance?

👍 . Agreed, a tolerance value would be good.

Suggestion: I think it would be clearer to move the highlighted code to a new function hasDuplicatedVertices(double EPS), and consider calling it explicitly, when necessary.

I can separate this snippet into the function, and have it just in the Polyhedron::volume() function for now where I was originally seeing the problem.

Comment thread src/axom/quest/IntersectionShaper.hpp Outdated
Comment on lines +393 to +406
// Initialize tetrahedra
axom::Array<IndexType> nodeIds(4);
axom::Array<Point3D> pts(4);

const auto& shapeName = shape.getName();
AXOM_UNUSED_VAR(shapeDimension);
AXOM_UNUSED_VAR(shapeName);
for(int i = 0; i < m_tetcount; i++)
{
m_surfaceMesh->getCellNodeIDs(i, nodeIds.data());

SLIC_INFO(axom::fmt::format("Current shape is {}", shapeName));
m_surfaceMesh->getNode(nodeIds[0], pts[0].data());
m_surfaceMesh->getNode(nodeIds[1], pts[1].data());
m_surfaceMesh->getNode(nodeIds[2], pts[2].data());
m_surfaceMesh->getNode(nodeIds[3], pts[3].data());

m_tets[i] = TetrahedronType({pts[0], pts[1], pts[2], pts[3]});
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a way to do this w/in a kernel in the ExecSpace too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is there a way to do this w/in a kernel in the ExecSpace too?

I did not explore it in this PR, as a lot of these calls are to mint::UnstructuredMesh functions which are not host/device annotated yet.
The functions also override virtual mint::Mesh functions, so that might complicate things.

Comment thread src/axom/quest/IntersectionShaper.hpp Outdated
Comment thread src/axom/quest/IntersectionShaper.hpp Outdated
Comment thread src/axom/quest/IntersectionShaper.hpp Outdated
Comment thread src/axom/quest/IntersectionShaper.hpp Outdated
@@ -882,11 +1005,12 @@ class IntersectionShaper : public Shaper
axom::deallocate(m_hexes);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm a bit confused about when we use allocate/deallocate and when we use StackArray for variables/arrays.
Could you please clarify?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(Perhaps that's why I have so many comments about it)

Copy link
Copy Markdown
Contributor Author

@bmhan12 bmhan12 Jun 6, 2023

Choose a reason for hiding this comment

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

I'm a bit confused about when we use allocate/deallocate and when we use StackArray for variables/arrays.
Could you please clarify?

The StackArray's that are being created here are for using the host-device decorated ArrayView constructor:https://github.com/LLNL/axom/blob/31ae2e4787a602d9a7b44eea76c3130a30c8ce3d/src/axom/core/ArrayView.hpp#L76-L87

The allocate/deallocate is for memory that will be used inside kernels.

I need to do a pass through these to change them to use axom::Array and axom::ArrayView.

Comment thread src/axom/quest/IntersectionShaper.hpp Outdated
Copy link
Copy Markdown
Member

@agcapps agcapps left a comment

Choose a reason for hiding this comment

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

Thanks, Brian!

Copy link
Copy Markdown
Member

@rhornung67 rhornung67 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 A few comments for consideration related to documentation and implementation consistency

Comment thread src/axom/primal/geometry/Octahedron.hpp Outdated
Comment thread src/axom/primal/geometry/Tetrahedron.hpp
Comment thread src/axom/primal/operators/split.hpp Outdated
Comment thread src/axom/primal/tests/primal_clip.cpp Outdated
Comment thread src/axom/quest/interface/internal/QuestHelpers.hpp Outdated
@bmhan12 bmhan12 force-pushed the feature/han12/shaping_proe branch from 375b17f to dc5bd9e Compare June 13, 2023 16:03
@bmhan12
Copy link
Copy Markdown
Contributor Author

bmhan12 commented Jun 13, 2023

The conversion of pointer allocate/deallocate memory to axom:Array / axom::ArrayView was mostly straightforward.

Did encounter an error with HIP trying to use axom::Array with a RAJA::ReduceSum for the size:
https://github.com/LLNL/axom/blob/43df7b65cad3c0a1e625550458ffaf9e137ffebe/src/axom/quest/IntersectionShaper.hpp#L729-L755

Not seeing the problem with CUDA.

This case will be added to a running list of HIP issues in #787 .

@bmhan12 bmhan12 mentioned this pull request Jun 13, 2023
8 tasks
@bmhan12 bmhan12 merged commit d467ebe into develop Jun 13, 2023
@bmhan12 bmhan12 deleted the feature/han12/shaping_proe branch June 13, 2023 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Primal Issues related to Axom's 'primal component Quest Issues related to Axom's 'quest' component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants