Skip to content

Commit

Permalink
Merge pull request #1486 from LLNL/feature/kweiss/opencascade-example
Browse files Browse the repository at this point in the history
Adds a quest example to process STEP files
  • Loading branch information
kennyweiss authored Jan 10, 2025
2 parents 511ae0a + 99d3647 commit 8f678a9
Show file tree
Hide file tree
Showing 12 changed files with 2,264 additions and 29 deletions.
9 changes: 5 additions & 4 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,18 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/
### Added
- `sidre::View` holding array data may now be re-shaped. See `sidre::View::reshapeArray`.
- Sina C++ library is now a component of Axom
- Adds optional dependency on [Open CASCADE](https://dev.opencascade.org). The initial intention is
to use Open CASCADE's file I/O capabilities in support of Quest applications.
- Adds optional dependency on [Open Cascade](https://dev.opencascade.org). The initial intention is
to use Open Cascade's file I/O capabilities in support of Quest applications.
- Adds `primal::NURBSCurve` and `primal::NURBSPatch` classes, supported by `primal::KnotVector`.
- Adds a Quest example that reads in a STEP file using Open Cascade and processes its geometry

### Changed
- Importing Conduit array data into `sidre::View` now allocates destination
data using the `View`'s parent's allocator ID, instead of always using
host memory. This is consistent with the behavior of deep-copying data
from Sidre.
- ItemCollection and its child classes MapCollection, ListCollection, and IndexedCollection were moved from Sidre
to core. The namespace prefix for these classes is now axom:: insteand of axom::sidre. The internal usage of
to core. The namespace prefix for these classes is now `axom::` instead of `axom::sidre`. The internal usage of
these types within Sidre Datastore and Group is unchanged.

### Deprecated
Expand Down Expand Up @@ -74,7 +75,7 @@ as well as support for 32-bit `Word`s in Slam's `BitSet` class.
- Primal: Adds `Polygon::reverseOrientation()` to reverse orientation of
a polygon in-place.
- Adds `StaticArray`, a wrapper for `StackArray` with a size member variable.
- Multidimenional `core::Array` supports column-major and arbitrary stride ordering,
- Multidimensional `core::Array` supports column-major and arbitrary stride ordering,
in addition to the default row-major ordering.
- Adds new `PolygonArray` and `MAX_VERTS` template parameters to `primal::Polygon` for dynamic
or static allocation.
Expand Down
2 changes: 1 addition & 1 deletion scripts/vcpkg_ports/opencascade/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "opencascade",
"version": "7.8.0",
"description": "Open CASCADE Technology (OCCT) is an open-source software development platform for 3D CAD, CAM, CAE.",
"description": "Open Cascade Technology (OCCT) is an open-source software development platform for 3D CAD, CAM, CAE.",
"homepage": "https://github.com/Open-Cascade-SAS/OCCT",
"license": "LGPL-2.1-only",
"supports": "!xbox",
Expand Down
14 changes: 10 additions & 4 deletions src/axom/primal/geometry/NURBSPatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "axom/primal/operators/squared_distance.hpp"

#include <ostream>
#include "axom/fmt.hpp"

namespace axom
{
Expand Down Expand Up @@ -329,7 +330,7 @@ class NURBSPatch
*/
NURBSPatch(const CoordsMat& pts, int deg_u, int deg_v) : m_controlPoints(pts)
{
auto pts_shape = pts.shape();
const auto pts_shape = pts.shape();

SLIC_ASSERT(pts_shape[0] >= deg_u + 1 && pts_shape[1] >= deg_v + 1);
SLIC_ASSERT(deg_u >= 0 && deg_v >= 0);
Expand Down Expand Up @@ -357,11 +358,11 @@ class NURBSPatch
: m_controlPoints(pts)
, m_weights(weights)
{
auto pts_shape = pts.shape();
auto weights_shape = weights.shape();
const auto pts_shape = pts.shape();

SLIC_ASSERT(pts_shape[0] >= deg_u + 1 && pts_shape[1] >= deg_v + 1);
SLIC_ASSERT(deg_u >= 0 && deg_v >= 0);
SLIC_ASSERT(pts_shape[0] >= deg_u + 1 && pts_shape[1] >= deg_v + 1);
SLIC_ASSERT(pts_shape == weights.shape());

m_knotvec_u = KnotVectorType(pts_shape[0], deg_u);
m_knotvec_v = KnotVectorType(pts_shape[1], deg_v);
Expand Down Expand Up @@ -2821,4 +2822,9 @@ std::ostream& operator<<(std::ostream& os, const NURBSPatch<T, NDIMS>& nPatch)
} // namespace primal
} // namespace axom

/// Overload to format a primal::NURBSPatch using fmt
template <typename T, int NDIMS>
struct axom::fmt::formatter<axom::primal::NURBSPatch<T, NDIMS>> : ostream_formatter
{ };

#endif // AXOM_PRIMAL_NURBSPATCH_HPP_
2 changes: 0 additions & 2 deletions src/axom/primal/tests/primal_nurbs_patch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,6 @@ TEST(primal_nurbspatch, knot_insertion)
const int DIM = 3;
using CoordType = double;
using PointType = primal::Point<CoordType, DIM>;
using VectorType = primal::Vector<CoordType, DIM>;
using NURBSPatchType = primal::NURBSPatch<CoordType, DIM>;

const int npts_u = 5;
Expand Down Expand Up @@ -883,7 +882,6 @@ TEST(primal_nurbspatch, bezier_extraction)
using CoordType = double;
using PointType = primal::Point<CoordType, DIM>;
using NURBSPatchType = primal::NURBSPatch<CoordType, DIM>;
using BezierPatchType = primal::BezierPatch<CoordType, DIM>;

const int npts_u = 5;
const int npts_v = 4;
Expand Down
11 changes: 11 additions & 0 deletions src/axom/quest/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -571,3 +571,14 @@ if( MFEM_FOUND)
FOLDER axom/quest/examples
)
endif()


if(OPENCASCADE_FOUND)
axom_add_executable(
NAME quest_step_file_ex
SOURCES quest_step_file.cpp
OUTPUT_DIR ${EXAMPLE_OUTPUT_DIRECTORY}
DEPENDS_ON axom cli11 fmt opencascade
FOLDER axom/quest/examples
)
endif()
Loading

0 comments on commit 8f678a9

Please sign in to comment.