Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
233 commits
Select commit Hold shift + click to select a range
d50f777
First compiling version. Passing quest_geometry_clipper as a smoke t…
gunney1 Feb 11, 2025
190b1d1
Plot and visually verify results of plane clipping test.
gunney1 Feb 13, 2025
435b81b
Implement volume comparison correctness check.
gunney1 Feb 13, 2025
68e72e0
Support Sidre blueprint mesh format.
gunney1 Feb 18, 2025
e746c1f
Progress toward better Conduit and device support.
gunney1 Feb 24, 2025
f7c14fb
Remove obsolete code.
gunney1 Feb 24, 2025
e151a82
Add createGroup param to accept existing group instead of returning n…
gunney1 Feb 25, 2025
2832de2
Fix error seting up matsets in setFreeVolumeFractions.
gunney1 Feb 25, 2025
76d78b9
Add SphereClipper and some missing code.
gunney1 Feb 28, 2025
60e8471
Add Hex clipper.
gunney1 Mar 1, 2025
93de9ee
Mostly changes to output to help testing and development.
gunney1 Mar 4, 2025
c42c4a7
Merge remote-tracking branch 'gh/feature/gunney/copy-sidre-to-conduit…
gunney1 Apr 22, 2025
d21d2f1
Fix bug in runtime check on supported memory space.
gunney1 Apr 22, 2025
07a04cf
Use core::ConduitMemory for conduit memory allocation.
gunney1 Apr 22, 2025
fadc42c
Fixed bugs crashing GPU runs.
gunney1 Apr 22, 2025
71acd24
Autoformat.
gunney1 Apr 22, 2025
d356f7c
Merge remote-tracking branch 'gh/feature/gunney/copy-sidre-to-conduit…
gunney1 Apr 23, 2025
9c8ca1c
Add Geometry::asHierarchy() and TetMeshClipper.
gunney1 Apr 24, 2025
6b7942f
Add TetClipper class and debug new code.
gunney1 Apr 25, 2025
3a905bf
Autoformat.
gunney1 Apr 25, 2025
4d6ef04
Some cleaning up.
gunney1 Apr 26, 2025
73ab036
Add primal::Cone and SOR geometry clipping.
gunney1 Apr 26, 2025
3ba6a3b
Add cyl and cone to geometry clipper test.
gunney1 Apr 28, 2025
8a26314
New mechanism for setting geometry-specific tolerances.
gunney1 Apr 28, 2025
5202eb5
Debug device execution.
gunney1 Apr 29, 2025
97f0a7f
Remove debug code.
gunney1 Apr 29, 2025
408acd2
Expand multigeometry test and use non-regex delimiter.
gunney1 Apr 29, 2025
c6b3cf1
Generalize Geometry data by storing it in a hierarchy.
gunney1 Apr 30, 2025
39c04ea
Tweak geometry size to be about 6.25-7% of the 2x2x2 mesh volume.
gunney1 Apr 30, 2025
90a6f8d
Remove development crud.
gunney1 Apr 30, 2025
68b482b
Rename getShape* methods to getGeometry* and set up performance annot…
gunney1 May 1, 2025
83ef26c
Add transformations to clipper.
gunney1 May 2, 2025
0c3e5eb
Use lables to do limited clipping.
gunney1 May 7, 2025
8b2d0b2
Fix a array index range fault in the polyhedron clipping.
gunney1 May 7, 2025
76002c6
Use variable for repetitive geometry name.
gunney1 May 8, 2025
543ebc1
Changes for comparing to geometry clipping test.
gunney1 May 8, 2025
309ae29
Add comments about further features and improvements.
gunney1 May 8, 2025
28d649a
Fix crash due to giving host cuda memory.
gunney1 May 8, 2025
3d792d3
Remove obsolete code and add shape-specific timer annotation.
gunney1 May 12, 2025
d5d1639
Fix sor rz function to give the intended volume.
gunney1 May 12, 2025
0f1e550
Remove stream flush from timed code.
gunney1 May 12, 2025
dd16876
Adjust test parameters for shape-in-memory and clipping tests.
gunney1 May 12, 2025
988b224
Minor cleaning.
gunney1 May 13, 2025
6a5068b
Minor cleaning and silence warning.
gunney1 May 15, 2025
314c75d
Allow repetition of geometries tested.
gunney1 May 15, 2025
e80e45d
Fix failure to create new group.
gunney1 May 16, 2025
31417c4
Minor changes affecting performance tests.
gunney1 May 16, 2025
f22bfc1
Support multiple shapes in a single run.
gunney1 May 19, 2025
28f2135
Isolate pre-compute costs for clipping test.
gunney1 May 19, 2025
9861b0a
Added checks for segment-sphere intersection.
gunney1 May 20, 2025
4ae2ec9
Adjust error tolerance for discretized geometries.
gunney1 May 21, 2025
cf0a5fe
Re-arrange potentially unused edge-checking in SphereClipper.
gunney1 May 21, 2025
04cffee
Implement bounding-box-based labelInOut for tet mesh geometry.
gunney1 May 21, 2025
f10dfc3
Tweak some error tolerances using 7 refinement levels.
gunney1 May 21, 2025
dad7cf5
Slight ShapeeMesh function name changes and vertex points accessor.
gunney1 May 22, 2025
5d912a5
Add edge-tet intersections to fix small errors in tet clipping.
gunney1 May 22, 2025
ed68b63
Change labelInOut for tet mesh clipper, based on tree search.
gunney1 May 22, 2025
e7d393f
Debug recent changes to run on GPUs.
gunney1 May 22, 2025
6147548
Raise tolerance for tet mesh volume check.
gunney1 May 22, 2025
39d0948
Move CoordinateTransformer to primal, add its tests.
gunney1 May 28, 2025
431275d
New labelInOut for sphere and SOR.
gunney1 May 31, 2025
7cd1d76
Re-implement TetClipper's in/out labeling.
gunney1 Jun 1, 2025
9ef7a1e
Fix missing device compilations for squared_distance.
gunney1 Jun 1, 2025
7cdd470
Add forgotten test file to repo.
gunney1 Jun 4, 2025
4e0d71e
Fix for GPU builds.
gunney1 Jun 4, 2025
436277b
New implementation of HexClipper in/out screening.
gunney1 Jun 4, 2025
058b8fb
Minor warning fix and variable name changes for uniformity.
gunney1 Jun 7, 2025
411ca32
Don't require matset just to clip.
gunney1 Jun 7, 2025
51dfe38
Support ArrayView output for apps that manage their own buffer.
gunney1 Jun 7, 2025
7a787c8
Convience method for preallocating intermediate data.
gunney1 Jun 7, 2025
60e8fad
Add utility to allocate GeometryClipperStrategy for a klee::Geometry.
gunney1 Jun 7, 2025
791a306
Merge remote-tracking branch 'gh/feature/gunney/copy-sidre-to-conduit…
gunney1 Jun 10, 2025
450ff0e
Variable name change in SorClipper.
gunney1 Jun 12, 2025
c92ed7e
Partial support for SOR functions that double back.
gunney1 Jun 13, 2025
76811f9
Debug for device builds and tests.
gunney1 Jun 13, 2025
ca5f6de
Documentation and variable name change for Cone class.
gunney1 Jun 17, 2025
bc963c3
Rename FSorClipper to SorClipper before re-implementing SorClipper.
gunney1 Jun 18, 2025
4c3a2fa
Minor dox comment changes.
gunney1 Jun 18, 2025
0bbb1d7
First working version supporting SOR curves that double back.
gunney1 Jun 19, 2025
616d61e
Merge remote-tracking branch 'gh/develop' into feature/gunney/shaping…
gunney1 Jun 19, 2025
f1eac34
Handle unidentified conduit allocator without crashing.
gunney1 Jun 27, 2025
768cd0d
Rename getConnectivity to getCellNodeConnectivity.
gunney1 Jun 27, 2025
8c66d47
Redo TetMeshClipper in/out labeling, by using boundary faces.
gunney1 Jun 27, 2025
76bb9c4
Debug TetMeshClipper for device execution.
gunney1 Jun 30, 2025
71dc795
Clean up recent development crud and improve comments.
gunney1 Jun 30, 2025
ed960a5
Port FSorClipper::getGeometryAsOcts to GPU.
gunney1 Jul 1, 2025
5afde48
Clean up. Remove obsolete notes.
gunney1 Jul 1, 2025
d624ea6
Remove obsolete code and data from SorClipper.
gunney1 Jul 2, 2025
05fc8b1
Update comments.
gunney1 Jul 2, 2025
57268c5
Work-around a weird crash on ATS-2.
gunney1 Jul 2, 2025
80606e1
Disable some tests for degenerate polylines that are now acceptable.
gunney1 Jul 2, 2025
636c397
Work around a weird device assert failure on ATS-2.
gunney1 Jul 9, 2025
0319a4a
Tempoarily disable code causing a link failure.
gunney1 Jul 9, 2025
f2b6a05
Add more instances to the ConduitMemory work-around.
gunney1 Jul 11, 2025
d01e6b4
Add accessor to get default Conduit allocator.
gunney1 Jul 17, 2025
4a19351
Implement tuple in Sidre.
gunney1 Jul 17, 2025
1ddebdd
Allow user to specify allocator ids when deep copying Sidre to Conduit.
gunney1 Jul 22, 2025
476ecd2
Doxygen comments for Group and View allocator ids.
gunney1 Jul 23, 2025
cf88532
Let users specify new UG topology name.
gunney1 Jul 23, 2025
97287f7
Misc changes needed for HIP run on MI300.
gunney1 Jul 23, 2025
55213fd
Disable broken asserts.
gunney1 Jul 23, 2025
c1086a1
Add new DataSemantic file that was forgotten in earlier commit.
gunney1 Jul 23, 2025
e00f7d3
Let user specify name of clipper strategy.
gunney1 Jul 24, 2025
85d30b1
Check tet mesh validity in TetMeshClipper.
gunney1 Jul 25, 2025
4d42fca
Fix wrong timer name.
gunney1 Jul 25, 2025
fd038b7
Fix error setting default tuple allocator.
gunney1 Jul 25, 2025
2d0666b
Temporarily disable assertions that fail with rzansel+RelWithDebInfo.
gunney1 Jul 25, 2025
136c041
Various clean-ups.
gunney1 Jul 25, 2025
35f7741
Clean up GeometryClipperDelegateExec.
gunney1 Jul 25, 2025
7a971ad
Variable name changes removing the "device" from names.
gunney1 Jul 25, 2025
53fc963
Support cone in klee Geometry.
gunney1 Jul 30, 2025
997306d
Template parameters for Polyhedron interal array sizes.
gunney1 Aug 5, 2025
8bce9f8
Add check for sphere containing sphere.
gunney1 Aug 7, 2025
37355fd
SphereClipper save and access statistics.
gunney1 Aug 7, 2025
c3429fa
Bounding sphere for in/out labeling in SphereClipper.
gunney1 Aug 7, 2025
c334b33
Use bounding sphere AND vertex in/out for SphereClipper screening.
gunney1 Aug 12, 2025
48d62a5
Fix critical and cosmetic bugs for new Cone class.
gunney1 Aug 13, 2025
dae43e8
Subdivide big SOR segments for better screening.
gunney1 Aug 15, 2025
58795bf
New in/out check for TetClipper.
gunney1 Aug 21, 2025
2d3cd80
Minor clean-up and use memory pool.
gunney1 Aug 22, 2025
264caa1
Add performance test for tet-tet cliping.
gunney1 Aug 24, 2025
4c1ba07
Minor change to shorten names and add timers.
gunney1 Aug 26, 2025
edc0d77
Shorten run time for primal clip perf test.
gunney1 Aug 27, 2025
512925f
Implement tet screening (after cell screening) for TetClipper.
gunney1 Aug 27, 2025
43e6331
Implement tet screening (after cell screening) for Sphere Clipper.
gunney1 Aug 28, 2025
361adfb
Fix crash in an edge case.
gunney1 Sep 3, 2025
7be84f4
Extend CoordinateTransformer to set by transform end points.
gunney1 Sep 4, 2025
5064528
Add notes and use typedefs.
gunney1 Sep 8, 2025
41529b9
Undo some temporary work-arounds.
gunney1 Sep 9, 2025
e0458e6
Remove code that was added but ended up not used.
gunney1 Sep 9, 2025
d13be4a
Add asterisks to comments, mostly.
gunney1 Sep 9, 2025
2430e30
Merge remote-tracking branch 'gh/feature/gunney/copy-sidre-to-conduit…
gunney1 Sep 9, 2025
44d2385
Remove debug code.
gunney1 Sep 10, 2025
0ac972a
Update TODO comment.
gunney1 Sep 10, 2025
caf862a
Fix minor build errors.
gunney1 Sep 10, 2025
195491f
Rename GeometryClipper -> MeshClipper. Move clipping code.
gunney1 Sep 11, 2025
1957a1b
Autoformat.
gunney1 Sep 11, 2025
6744a40
Fix build error for non-raja builds.
gunney1 Sep 11, 2025
1378d0e
Merge remote-tracking branch 'gh/develop' into feature/gunney/shaping…
gunney1 Sep 12, 2025
9b8281f
Fix build issues when no bump or sidre.
gunney1 Sep 12, 2025
4b3150d
Avoid a useless warning.
gunney1 Sep 15, 2025
ae4dc69
Reduce mesh size to shorten test time.
gunney1 Sep 15, 2025
57861cb
Merge remote-tracking branch 'gh/feature/gunney/copy-sidre-to-conduit…
gunney1 Sep 17, 2025
66c101b
Merge remote-tracking branch 'gh/feature/gunney/shaping-refactor-and-…
gunney1 Sep 17, 2025
123d1de
Fix typos and comments. Make a private method public.
gunney1 Sep 18, 2025
2597560
Require rotation axis to be unit vectors.
gunney1 Sep 18, 2025
6a7d90c
Make a test a bit easier to read.
gunney1 Sep 18, 2025
1e6d200
Put new mesh clipping classes in experimental namespace.
gunney1 Sep 18, 2025
3d70857
Merge remote-tracking branch 'gh/feature/gunney/copy-sidre-to-conduit…
gunney1 Sep 21, 2025
52d9982
Merge remote-tracking branch 'gh/bugfix/gunney/no-use-invalid-alloc-i…
gunney1 Sep 22, 2025
6256c44
Minor corrections.
gunney1 Sep 24, 2025
9efb96f
Improve comments.
gunney1 Sep 24, 2025
93c42cf
More comment improvements.
gunney1 Sep 24, 2025
7c1cc3d
Replace tets/hex with symbol.
gunney1 Sep 24, 2025
ac02db8
Move ShapeeMesh into experimental namespace.
gunney1 Sep 24, 2025
85a9e7f
Rename ShapeeMesh->ShapeMesh.
gunney1 Sep 24, 2025
1852311
Backport Geometry.hpp changes from another branch.
gunney1 Sep 24, 2025
058425c
Merge remote-tracking branch 'qck/feature/gunney/initial-mesh-clipper…
gunney1 Oct 3, 2025
e6bacb2
Merge remote-tracking branch 'gh/develop' into feature/gunney/shaping…
gunney1 Nov 6, 2025
843d175
Remove empty fields node to pass blueprint validation.
gunney1 Nov 6, 2025
522dd31
Fix non-existent fields node.
gunney1 Nov 7, 2025
277b31e
Fix bad macro name in check.
gunney1 Nov 13, 2025
0ac4360
More descriptive section names in SorClipper.
gunney1 Nov 13, 2025
b0ef4f4
Fix error initializng FSorClipper function.
gunney1 Nov 14, 2025
5089b6e
Add Point methods to compute distance to origin.
gunney1 Nov 19, 2025
778ea83
Improve statistics logging in MeshClipper.
gunney1 Nov 19, 2025
9f55c8e
Redo tet clipping implementation for FSorClipper.
gunney1 Nov 19, 2025
86ace0e
Minor: Prefer Axom's numerical limits over std.
gunney1 Nov 20, 2025
e734542
Fix confusion over clipping statistics.
gunney1 Nov 20, 2025
60a7794
Move MeshClipperStrategy functions annotations to MeshClipper.
gunney1 Nov 21, 2025
d4fedcc
Rename a private method for consistency.
gunney1 Nov 21, 2025
4d83ee4
Bring back TetClipper screening.
gunney1 Nov 21, 2025
8d74b8c
Minor move of data allocation to a different method.
gunney1 Nov 21, 2025
24b16c6
Use tighter screening in SphereClipper.
gunney1 Nov 24, 2025
105f3f7
Factor out bounding-box based labeling and implement tet screening for
gunney1 Nov 24, 2025
d35012f
Clean up some mesh clipper implemenations.
gunney1 Nov 24, 2025
c86dbd6
Implent Plane3DClipper::specializedClipTets.
gunney1 Nov 25, 2025
07de16c
Minor.
gunney1 Nov 25, 2025
b49140c
Clean up development crud, mostly in Plane3DClipper.
gunney1 Nov 25, 2025
8a9cfdb
Add a way to get clip count for performance analysis.
gunney1 Nov 25, 2025
c809947
Implement non-screened plane clipper for performance evaluation.
gunney1 Nov 25, 2025
f292d66
Fix clip count error.
gunney1 Nov 25, 2025
f70700b
Add ShapeMesh interface to decompose hex into tets.
gunney1 Nov 25, 2025
81cc328
Support 18-tet hex decomposition.
gunney1 Nov 26, 2025
bc4ef88
Screen out degenerate cells and tets (label them OUT).
gunney1 Nov 27, 2025
f858e0a
Implement tet screening for TetMeshClipper.
gunney1 Nov 27, 2025
0cf5f7e
Screen out degenerate cells and tets in TetClipper.
gunney1 Dec 1, 2025
10ed188
Don't scale up boxes in BVH.
gunney1 Dec 1, 2025
42f1fe7
MeshClipperStrategy can now report clipping statistics.
gunney1 Dec 3, 2025
397b6d3
Add flag to auto-correct or abort on inverted tets in geometries.
gunney1 Dec 3, 2025
0e061e4
Add CoordinateTransformer constructor using terminus points.
gunney1 Dec 4, 2025
effc897
Add Tetrahedron accessor to get array of vertices.
gunney1 Dec 4, 2025
3add781
Minor touch-ups for FSorClipper.
gunney1 Dec 4, 2025
e5246ac
Make screenLevel a formal parameter for MeshClipper.
gunney1 Dec 4, 2025
7c1da0a
Subdivide SOR curve for discretization.
gunney1 Dec 5, 2025
42d8e04
Redo statistics, storing all in a conduit Node.
gunney1 Dec 5, 2025
bdd6929
Factor out code that computes overlap between a mesh tet
gunney1 Dec 7, 2025
67b9065
Factor out MeshClipperImpl code that gets the discrete geometry.
gunney1 Dec 7, 2025
06003cd
Factor out BVH construction in MeshClipperImpl.
gunney1 Dec 8, 2025
ac4db99
Minor comment and variable name changes.
gunney1 Dec 8, 2025
c5861a8
Don't use a new Point method that will be removed.
gunney1 Dec 8, 2025
ec9359f
Revert "Add Point methods to compute distance to origin."
gunney1 Dec 8, 2025
0b235e8
Revert "Add Tetrahedron accessor to get array of vertices."
gunney1 Dec 8, 2025
51ea48d
Autoformat.
gunney1 Dec 8, 2025
2fd9dce
Merge remote-tracking branch 'gh/develop' into feature/gunney/shaping…
gunney1 Dec 8, 2025
8fd7cdb
Make the BVH not a pointer.
gunney1 Dec 8, 2025
eb65dc8
LLVM+AMD compiler may not like constexpr members in kernels.
gunney1 Dec 8, 2025
f944580
Minor re-arranging preparation for using 2-pass BVH search.
gunney1 Dec 8, 2025
18eb93a
Use unit tet to determine labels in TetClipper.
gunney1 Dec 8, 2025
e247035
Bunch of minor fixes.
gunney1 Dec 8, 2025
3d362b8
Fix misspelled stat names.
gunney1 Dec 9, 2025
85b16e5
Use a 2-pass BVH search (but currently does the same as a single pass).
gunney1 Dec 9, 2025
b21123b
Ready to use more selective predicate and leaf actions.
gunney1 Dec 9, 2025
f9c05e7
Activate primitive collision checks in BVH search and change statistics
gunney1 Dec 10, 2025
dd70b9e
Correct slight errors in SOR subdividing code.
gunney1 Dec 10, 2025
ea1ed31
Add clipsMiss to statistics.
gunney1 Dec 10, 2025
419ead9
Remove obsolete methods.
gunney1 Dec 10, 2025
5e86373
Re-factor statistics again to manage the growing collection.
gunney1 Dec 11, 2025
9cfd98c
Improve tetOctIntersects by checking for tet above/below oct.
gunney1 Dec 11, 2025
6cff91e
Calculation of avg length is based on average cell volume.
gunney1 Dec 11, 2025
311e958
Fix errors computing oct heights.
gunney1 Dec 11, 2025
db629f1
Autoformat.
gunney1 Dec 11, 2025
3095c27
Don't let degenerate mesh tets crash the clip loop.
gunney1 Dec 12, 2025
fb84397
Log info on discretized mesh in debug mode.
gunney1 Dec 12, 2025
52f6c47
Correct comments.
gunney1 Dec 16, 2025
0f8b50e
Don't count labels unless verbose is true.
gunney1 Dec 18, 2025
6c82ec2
Use reduction instead of atomic adds for counters. They're faster.
gunney1 Dec 18, 2025
4ae2e85
Fix typos in comments.
gunney1 Dec 18, 2025
24b9a2d
Allow tet volume to be negative when checking for its sign.
gunney1 Dec 18, 2025
ecfff47
Remobe obsolete and broken assert.
gunney1 Dec 19, 2025
cce5ef1
Minor logging changes and typo fix.
gunney1 Dec 18, 2025
b8cec6f
Imrove collectOnIndices performance.
gunney1 Dec 18, 2025
c6482d5
Merge remote-tracking branch 'gh/develop' into feature/gunney/shaping…
gunney1 Dec 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/axom/core/utilities/Utilities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,16 @@ inline AXOM_HOST_DEVICE bool isNearlyEqualRelative(RealType a,
// return abs(a-b) <= max(absThresh, relThresh * maxFabs );
}

/*!
* \brief Sign of a value of any type that supports comparison and
* negation operators.
*/
template <typename T>
inline int sign_of(const T& v, const T& eps = {0})
{
return v > eps ? 1 : v < -eps ? -1 : 0;
}

/*!
* \brief Insertion sort of an array.
* \accelerated
Expand Down
2 changes: 1 addition & 1 deletion src/axom/klee/Geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void Geometry::populateGeomInfo()
m_discreteFunction = axom::Array<double, 2>(2, 2);
m_discreteFunction(0, 0) = 0.0;
m_discreteFunction(0, 1) = cone.getBaseRadius();
m_discreteFunction(1, 1) = cone.getLength();
m_discreteFunction(1, 0) = cone.getLength();
m_discreteFunction(1, 1) = cone.getTopRadius();
m_geomInfo["discreteFunction"].set(m_discreteFunction.data(), m_discreteFunction.size());
m_geomInfo["sorOrigin"].set(cone.getBaseCenter().data(), 3);
Expand Down
3 changes: 2 additions & 1 deletion src/axom/primal/geometry/Cone.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ class Cone
}

/*!
* \brief Returns the algebraic volume of the cone
* \brief Returns the algebraic volume of the cone,
* which is negative if the length is negative.
*
* Volume is only defined when NDIMS == 3.
*/
Expand Down
10 changes: 10 additions & 0 deletions src/axom/primal/geometry/CoordinateTransformer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ class CoordinateTransformer
*/
CoordinateTransformer(const numerics::Matrix<T>& matrix) { setMatrix(matrix); }

/*!
* @brief Contruct transformer that moves 4 starting points to 4
* destination points.
*/
AXOM_HOST_DEVICE CoordinateTransformer(const primal::Point<T, 3>* startPts,
const primal::Point<T, 3>* destPts)
{
setByTerminusPts(startPts, destPts);
}

/*!
* @brief Set the matrix, discarding the current transformation.
* @param matrix [in] The transformation matrix for homogeneous
Expand Down
20 changes: 20 additions & 0 deletions src/axom/primal/geometry/Sphere.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,18 @@ class Sphere
AXOM_HOST_DEVICE
inline bool intersectsWith(const Sphere<T, NDIMS>& sphere, double TOL = 1.e-9) const;

/*!
* \brief Tests if this sphere completely contains another sphere.
*
* \param [in] other The sphere object to check for containment
* \param [in] margin Amount that this sphere must contain the other sphere by.
* Positive means that the other sphere is "more inside".
*
* \return true if this sphere contains the other, false otherwise.
*/
AXOM_HOST_DEVICE
inline bool contains(const Sphere<T, NDIMS>& other, double margin = 0.0) const;

/*!
* \brief Prints the Sphere information in the given output stream.
* \param [in,out] os the output stream to write to.
Expand Down Expand Up @@ -233,6 +245,14 @@ AXOM_HOST_DEVICE inline bool Sphere<T, NDIMS>::intersectsWith(const Sphere<T, ND
utilities::isNearlyEqual(distance_squared, sum_of_radii_2, TOL));
}

//------------------------------------------------------------------------------
template <typename T, int NDIMS>
AXOM_HOST_DEVICE inline bool Sphere<T, NDIMS>::contains(const Sphere<T, NDIMS>& sphere, double TOL) const
{
const T center_sep = VectorType(sphere.getCenter(), m_center).norm();
return (m_radius > center_sep + sphere.getRadius() + TOL);
}

//------------------------------------------------------------------------------
// implementation of free functions
//------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/axom/primal/operators/detail/clip_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ AXOM_HOST_DEVICE void poly_clip_vertices(Polyhedron<T, NDIMS>& poly,
// A probable AMD GPU 6.3 compiler bug caused the first assert to fail.
// The second assert is equivalent because we expect addVertex call to
// consume the next index and increment the number of vertices.
// However, when the compilers no longar cause false failures, we should
// However, when the compilers no longer cause false failures, we should
// restore the first assert.
// SLIC_ASSERT(newVertexIndex == expectedVertexIndex);
SLIC_ASSERT(newVertexIndex == poly.numVertices() - 1);
Expand Down
32 changes: 32 additions & 0 deletions src/axom/primal/tests/primal_sphere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,31 @@ void check_sphere_intersection()
EXPECT_FALSE(S0.intersectsWith(S3));
}

//------------------------------------------------------------------------------
template <int NDIMS>
void check_sphere_containment()
{
using PointType = primal::Point<double, NDIMS>;
using SphereType = primal::Sphere<double, NDIMS>;

PointType center {0.0, 0.0, 0.0};
double tol = 1e-12;

// STEP 0: test fully containing
SphereType S0;
EXPECT_TRUE(S0.contains(S0, -tol));

// STEP 1: test barely not containing.
center[0] = tol;
SphereType S1(center);
EXPECT_FALSE(S0.contains(S1));

// STEP 2: test partial containment.
center[0] = 0.5;
SphereType S3(center);
EXPECT_FALSE(S0.contains(S3));
}

//------------------------------------------------------------------------------
template <int NDIMS>
void check_copy_constructor()
Expand Down Expand Up @@ -244,6 +269,13 @@ TEST(primal_sphere, sphere_sphere_intersection)
check_sphere_intersection<3>();
}

//------------------------------------------------------------------------------
TEST(primal_sphere, sphere_sphere_containment)
{
check_sphere_containment<2>();
check_sphere_containment<3>();
}

//------------------------------------------------------------------------------
int main(int argc, char* argv[])
{
Expand Down
18 changes: 17 additions & 1 deletion src/axom/quest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ set( quest_headers
interface/signed_distance.hpp

util/mesh_helpers.hpp
util/make_clipper_strategy.hpp
MeshViewUtil.hpp
)

Expand Down Expand Up @@ -90,6 +91,7 @@ set( quest_sources
interface/signed_distance.cpp

util/mesh_helpers.cpp
util/make_clipper_strategy.cpp
)


Expand All @@ -100,6 +102,7 @@ set( quest_depends_on
)

blt_list_append(TO quest_depends_on IF AXOM_ENABLE_SIDRE ELEMENTS sidre)
blt_list_append(TO quest_depends_on IF AXOM_ENABLE_BUMP ELEMENTS bump)
blt_list_append(TO quest_depends_on IF SPARSEHASH_FOUND ELEMENTS sparsehash)
blt_list_append(TO quest_depends_on IF MFEM_FOUND ELEMENTS mfem)

Expand Down Expand Up @@ -150,11 +153,24 @@ if(AXOM_ENABLE_KLEE AND AXOM_ENABLE_SIDRE)
if(RAJA_FOUND)
list(APPEND quest_headers MeshClipper.hpp
MeshClipperStrategy.hpp
detail/clipping/Plane3DClipper.hpp
detail/clipping/TetClipper.hpp
detail/clipping/TetMeshClipper.hpp
detail/clipping/HexClipper.hpp
detail/clipping/SphereClipper.hpp
detail/clipping/FSorClipper.hpp
detail/clipping/SorClipper.hpp
detail/clipping/MeshClipperImpl.hpp)
list(APPEND quest_sources MeshClipper.cpp
MeshClipperStrategy.cpp
detail/clipping/Plane3DClipper.cpp
detail/clipping/TetClipper.cpp
MeshClipperStrategy.cpp)
detail/clipping/TetMeshClipper.cpp
detail/clipping/HexClipper.cpp
detail/clipping/SphereClipper.cpp
detail/clipping/FSorClipper.cpp
detail/clipping/SorClipper.cpp
detail/clipping/MeshClipperImpl.hpp)
endif()
endif()

Expand Down
4 changes: 3 additions & 1 deletion src/axom/quest/Discretize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ OctType new_inscribed_oct(const SphereType& sphere, OctType& o, int s, int t, in
*
* This routine allocates an array pointed to by \a out. The caller is responsible
* to free the array.
*
* TODO: If possible, port to GPU (rewrite to be data-parallel).
*/
bool discretize(const SphereType& sphere, int levels, axom::Array<OctType>& out, int& octcount)
{
Expand All @@ -125,7 +127,7 @@ bool discretize(const SphereType& sphere, int levels, axom::Array<OctType>& out,

octcount = count_sphere_octahedra(levels);

out = axom::Array<OctType>(octcount, octcount);
out.resize(octcount);

// index points to an octahedron of the last generation. We'll generate
// new octahedra based on out[index].
Expand Down
3 changes: 2 additions & 1 deletion src/axom/quest/Discretize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ bool discretize(const SphereType& s, int levels, axom::Array<OctType>& out, int&
/*!
* \brief Given a 2D polyline revolved around the positive X-axis, allocate
* and return a list of Octahedra approximating the shape.
* \param [in] polyline The polyline to revolve around the X-axis
* \param [in] polyline The polyline to revolve around the X-axis.
* Data should be in a host-accessible memory space.
* \param [in] len The number of points in \a polyline
* \param [in] levels The number of refinements to perform, in addition to
* a central level-zero octahedron in each segment
Expand Down
1 change: 0 additions & 1 deletion src/axom/quest/InOutOctree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "axom/slic.hpp"
#include "axom/slam.hpp"
#include "axom/primal.hpp"
#include "axom/mint.hpp"
#include "axom/spin.hpp"

#include "detail/inout/BlockData.hpp"
Expand Down
13 changes: 8 additions & 5 deletions src/axom/quest/IntersectionShaper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,7 @@ class IntersectionShaper : public Shaper

// Generate the Octahedra
// (octahedra m_octs will be on device)
m_octs = axom::Array<OctahedronType>(0, 0, axom::execution_space<ExecSpace>::allocatorID());
const bool disc_status =
axom::quest::discretize<ExecSpace>(polyline, polyline_size, m_level, m_octs, m_octcount);

Expand Down Expand Up @@ -1967,13 +1968,15 @@ class IntersectionShaper : public Shaper
if(m_bpGrp)
{
auto fieldsGrp = m_bpGrp->getGroup("fields");
SLIC_ERROR_IF(fieldsGrp == nullptr, "Input blueprint mesh lacks the 'fields' Group/Node.");
for(auto& group : fieldsGrp->groups())
if(fieldsGrp != nullptr)
{
std::string materialName = fieldNameToMaterialName(group.getName());
if(!materialName.empty())
for(auto& group : fieldsGrp->groups())
{
materialNames.emplace_back(materialName);
std::string materialName = fieldNameToMaterialName(group.getName());
if(!materialName.empty())
{
materialNames.emplace_back(materialName);
}
}
}
}
Expand Down
Loading
Loading