Skip to content

Commit

Permalink
Merge branch 'develop' into task/rhornung67/v0.10.0-RC
Browse files Browse the repository at this point in the history
  • Loading branch information
rhornung67 authored Sep 26, 2024
2 parents 3f1b415 + b9cc160 commit 0cbe048
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 22 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/test_windows_tpls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@ jobs:

steps:
- name: Checkout repo w/ submodules
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.7'
python-version: '3.10'

- name: List path and files
run: ls
- name: Run uberenv (${{ matrix.triplet }})
run: python3 ./scripts/uberenv/uberenv.py --triplet ${{ matrix.triplet }}
- name: Save Uberenv logs
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: uberenv_artifacts_${{ matrix.triplet }}_${{ matrix.cfg }}.zip
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
ls
ctest -C ${{ matrix.cfg }} --no-compress-output -T Test
- name: Save CTest logs
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: ctest_artifacts_${{ matrix.triplet }}_${{ matrix.cfg }}.zip
Expand Down
3 changes: 3 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/
- Removes caching of `{PACKAGE}_FOUND` variables in `SetupAxomThirdParty.cmake`
- We no longer test Axom with the XL compiler. So users should consider XL unsupported.

### Fixed
- `numerics::eigen_solve()` has been corrected to avoid an early return with error state.

## [Version 0.9.0] - Release date 2024-03-19

### Added
Expand Down
20 changes: 7 additions & 13 deletions src/axom/core/MDMapping.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,22 +324,16 @@ class MDMapping
const axom::StackArray<DirectionType, DIM>& v) const
{
// v is a permutation if all its values are unique and in [0, DIM).
axom::StackArray<bool, DIM> found;
for(int d = 0; d < DIM; ++d)
{
found[d] = false;
}
for(int d = 0; d < DIM; ++d)
axom::StackArray<DirectionType, DIM> values_sorted = v;

// After sorting, the values should be the sequence {0, 1, ... DIM - 1}.
axom::utilities::insertionSort(&values_sorted[0], DIM);
for(int d = 0; d < DIM; d++)
{
if(v[d] < 0 || v[d] >= DIM)
{
return false; // Out of range.
}
if(found[v[d]] == true)
if(values_sorted[d] != d)
{
return false; // Repeated index.
return false;
}
found[v[d]] = true;
}
return true;
}
Expand Down
9 changes: 6 additions & 3 deletions src/axom/core/numerics/eigen_solve.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace numerics
* \param [in] A a square input matrix
* \param [in] k number of eigenvalue-eigenvectors to find
* \param [out] u pointer to k eigenvectors in order by magnitude of eigenvalue
* \param [out] lambdas pointer to k eigenvales in order by size
* \param [out] lambdas pointer to k eigenvalues in order by size
* \param [in] numIterations optional number of iterations for the power method
* \note if k <= 0, the solve is declared successful
* \return rc return value, nonzero if the solve is successful.
Expand Down Expand Up @@ -119,9 +119,12 @@ int eigen_solve(Matrix<T>& A, int k, T* u, T* lambdas, int numIterations)

bool res = normalize<T>(vec, N);

if(!res) // something went wrong
// something went wrong, likely because `vec` is (numerically)
// in the span of the previous eigenvectors. Try again!
if(!res)
{
return 0;
i--;
continue;
}

// 3: run depth iterations of power method; note that a loop invariant
Expand Down
75 changes: 75 additions & 0 deletions src/axom/primal/tests/primal_orientedboundingbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,81 @@ TEST(primal_OBBox, obb_ctor_from_data)
EXPECT_TRUE(obbox1.getExtents() == e);
}

//------------------------------------------------------------------------------
TEST(primal_OBBox, obb_ctor_from_point_array)
{
constexpr int DIM = 3;
using CoordType = double;
using QPoint = primal::Point<CoordType, DIM>;
using QOBBox = primal::OrientedBoundingBox<CoordType, DIM>;

QPoint pt1; // origin
QPoint pt2({1.0, 0.0, 0.0});
QPoint pt3({0.0, 1.0, 0.0});
QPoint pt4({0.0, 0.0, 1.0});
QPoint pt5({1.0, 1.0, 0.0});
QPoint pt6({1.0, 0.0, 1.0});
QPoint pt7({0.0, 1.0, 1.0});
QPoint pt8({1.0, 1.0, 1.0});

/* -1D OBB */
QPoint* pts_00 = nullptr;
QOBBox obbox00(pts_00, 0);

EXPECT_FALSE(obbox00.isValid());

/* 0D OBB */
QPoint pts_0d[] = {pt1};
QOBBox obbox0(pts_0d, 1);

EXPECT_TRUE(obbox0.isValid());
EXPECT_TRUE(obbox0.contains(pt1));

EXPECT_NEAR(obbox0.getCentroid()[0], 0.0, 1e-6);
EXPECT_NEAR(obbox0.getCentroid()[1], 0.0, 1e-6);
EXPECT_NEAR(obbox0.getCentroid()[2], 0.0, 1e-6);

/* 1D OBB */
QPoint pts_1d[] = {pt1, pt2};
QOBBox obbox1(pts_1d, 2);

EXPECT_TRUE(obbox1.isValid());
EXPECT_TRUE(obbox1.contains(pt1));
EXPECT_TRUE(obbox1.contains(pt2));

EXPECT_NEAR(obbox1.getCentroid()[0], 0.5, 1e-6);
EXPECT_NEAR(obbox1.getCentroid()[1], 0.0, 1e-6);
EXPECT_NEAR(obbox1.getCentroid()[2], 0.0, 1e-6);

/* 2D OBB */
QPoint pts_2d[] = {pt1, pt2, pt3, pt5};
QOBBox obbox2(pts_2d, 4);

EXPECT_TRUE(obbox2.isValid());
EXPECT_TRUE(obbox2.contains(pt1));
EXPECT_TRUE(obbox2.contains(pt2));
EXPECT_TRUE(obbox2.contains(pt3));
EXPECT_TRUE(obbox2.contains(pt5));

EXPECT_NEAR(obbox2.getCentroid()[0], 0.5, 1e-6);
EXPECT_NEAR(obbox2.getCentroid()[1], 0.5, 1e-6);
EXPECT_NEAR(obbox2.getCentroid()[2], 0.0, 1e-6);

/* 3D OBB */
QPoint pts_3d[] = {pt1, pt2, pt3, pt4, pt5, pt6, pt7, pt8};
QOBBox obbox3(pts_3d, 8);

// check containments
EXPECT_TRUE(obbox3.isValid());
for(int i = 0; i < 8; i++)
{
EXPECT_TRUE(obbox3.contains(pts_3d[i]));
}

// check settings
EXPECT_TRUE(obbox3.getCentroid() == QPoint(0.5));
}

//------------------------------------------------------------------------------
TEST(primal_OBBox, obb_test_clear)
{
Expand Down
2 changes: 1 addition & 1 deletion src/axom/slam/BivariateMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ class BivariateMap<T, BSet, IndPol, StrPol, IfacePol>::RangeIterator
* index. Same as operator()
*/
template <typename... ComponentIndex>
DataRefType value(ComponentIndex... comp) const
AXOM_HOST_DEVICE DataRefType value(ComponentIndex... comp) const
{
return m_mapIterator(comp...);
}
Expand Down

0 comments on commit 0cbe048

Please sign in to comment.