Skip to content

Commit

Permalink
Removed native_array_from for fixed size array argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Hollenbeck-Hayden committed Dec 5, 2024
1 parent fa01b4e commit 8e00351
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 44 deletions.
24 changes: 8 additions & 16 deletions test/celeritas/optical/RayleighMfpCalculator.test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,14 @@ class RayleighMfpCalculatorTest : public OpticalMockTestBase
// Check calculated MFPs match expected ones
TEST_F(RayleighMfpCalculatorTest, mfp_table)
{
static constexpr auto expected_mfps
= native_array_from<units::CmLength, 13>({
1189584.7068151,
682569.13017288,
343507.60086802,
12005096.767467,
6888377.4406869,
3466623.2384762,
1189584.7068151,
277.60444893823,
11510.805603078,
322.70360179716,
4.230373664558,
12005096.767467,
2801.539271218,
});
static constexpr auto expected_mfps = native_array_from<units::CmLength>(
// clang-format off
1189584.7068151, 682569.13017288, 343507.60086802, 12005096.767467,
6888377.4406869, 3466623.2384762, 1189584.7068151, 277.60444893823,
11510.805603078, 322.70360179716, 4.230373664558, 12005096.767467,
2801.539271218
// clang-format on
);

auto core_materials = this->material();
auto const& opt_materials = this->imported_data().optical_materials;
Expand Down
14 changes: 0 additions & 14 deletions test/celeritas/optical/ValidationUtils.hh
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,6 @@ Array<real_type, sizeof...(Args)> constexpr native_array_from(Args const&... arg
native_value_from(UnitType(args))...};
}

//---------------------------------------------------------------------------//
/*!
* Helper function to annotate units of a hard-coded test data array.
*
* This overload accepts fixed size \c Arrays which clang-format handles
* better.
*/
template<class UnitType, size_type N>
Array<real_type, N> constexpr native_array_from(Array<real_type, N> const& arr)
{
return ::celeritas::testdetail::native_array_from_indexer<UnitType>(
arr, std::make_integer_sequence<size_type, N>{});
}

//---------------------------------------------------------------------------//
/*!
* Helper function to annotate units of hard-coded test data.
Expand Down
14 changes: 0 additions & 14 deletions test/celeritas/optical/detail/ValidationUtilsImpl.hh
Original file line number Diff line number Diff line change
Expand Up @@ -160,20 +160,6 @@ template<class GridTypeE, class GridTypeA>
return result;
}

//---------------------------------------------------------------------------//
/*!
* Helper function for \c native_array_from.
*
* Forwards \c Array values as a parameter pack using \c std::integer_sequence.
*/
template<class UnitType, size_type... Is>
Array<real_type, sizeof...(Is)> constexpr native_array_from_indexer(
Array<real_type, sizeof...(Is)> const& arr,
std::integer_sequence<size_type, Is...>)
{
return ::celeritas::optical::test::native_array_from<UnitType>(arr[Is]...);
}

//---------------------------------------------------------------------------//
} // namespace testdetail
} // namespace celeritas

0 comments on commit 8e00351

Please sign in to comment.