Skip to content

Commit

Permalink
Update expected safeties in Vecgeom tests and CMake version range (#1552
Browse files Browse the repository at this point in the history
)

* Fix expected volumes and safety values in Vecgeom.test.cc
* Revert "REVERTME: disable failing vecgeom tests"
* Fix build when +vecgeom~geant4
* Fix SolidsGeantTest*
* Fix test Geometry:CmseTest*
* Fix geometry tests for VecGeom's master branch
* Attempt to fix Geometry test, failing at the CI
* Temporarily disable Geometry test for Cmse (host fixture): See issue #1570 for more details.

---------

Co-authored-by: Seth R Johnson <[email protected]>
  • Loading branch information
mrguilima and sethrj authored Jan 10, 2025
1 parent 108cd76 commit 56a2ea5
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 68 deletions.
10 changes: 10 additions & 0 deletions src/geocel/GeantGeoUtils.hh
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,16 @@ inline std::string make_gdml_name(G4LogicalVolume const&)
{
CELER_NOT_CONFIGURED("Geant4");
}

inline std::ostream& operator<<(std::ostream&, PrintableNavHistory const&)
{
CELER_NOT_CONFIGURED("Geant4");
}

inline std::ostream& operator<<(std::ostream&, PrintableLV const&)
{
CELER_NOT_CONFIGURED("Geant4");
}
#endif

//---------------------------------------------------------------------------//
Expand Down
16 changes: 9 additions & 7 deletions test/celeritas/geo/Geometry.test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,11 @@ auto CmseTest::reference_volumes() const -> SpanConstStr
auto CmseTest::reference_avg_path() const -> SpanConstReal
{
// clang-format off
static real_type const paths[] = {74.17136, 13.25306, 76.67924, 449.5464,
0.09551618, 0.3231404, 0.310899, 0.3844357, 0.01179415, 11.09485,
9.101073, 0.0004083249, 0.3033329, 0.4292332, 228.7892, 0.03947559,
563.0746, 2858.592};
static real_type const paths[] = {
74.681789113, 13.9060168654525, 67.789037081, 460.34598500,
0.0752032527, 0.3958262271, 0.25837963337, 0.51484801201, 0.01179415,
10.662958365, 9.3044714865, 0.0004083249, 0.25874352886, 0.4292332,
225.390314534812, 0.0394755943, 550.75653646, 2824.1066316 };
// clang-format on
return make_span(paths);
}
Expand Down Expand Up @@ -311,8 +312,8 @@ TEST_F(ThreeSpheresTest, TEST_IF_CELER_DEVICE(device))
//---------------------------------------------------------------------------//
// CMSE
//---------------------------------------------------------------------------//

TEST_F(CmseTest, host)
// TODO: ensure reference values are the same for all CI platforms (see #1570)
TEST_F(CmseTest, DISABLED_host)
{
auto const& bbox = this->geometry()->bbox();
real_type const geo_eps
Expand All @@ -323,7 +324,8 @@ TEST_F(CmseTest, host)
EXPECT_VEC_SOFT_EQ((Real3{1750 + geo_eps, 1750 + geo_eps, 45000 + geo_eps}),
bbox.upper());

real_type tol = 0.35;
real_type tol = CELERITAS_CORE_GEO == CELERITAS_CORE_GEO_VECGEOM ? 0.005
: 0.35;
this->run_host(512, tol);
}

Expand Down
1 change: 1 addition & 0 deletions test/geocel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ if(CELERITAS_USE_VecGeom)
"FourLevelsTest.*"
"MultiLevelTest.*"
"SolidsTest.*"
"CmseTest.*"
)
endif()
endif()
Expand Down
73 changes: 12 additions & 61 deletions test/geocel/vg/Vecgeom.test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -284,19 +284,6 @@ class FourLevelsTest : public VecgeomVgdmlTestBase
{
return this->load_vgdml("four-levels.gdml");
}

SpanStringView expected_log_levels() const final
{
if (vecgeom_version >= Version{2})
{
static std::string_view const levels[] = {"warning"};
return make_span(levels);
}
else
{
return {};
}
}
};

//---------------------------------------------------------------------------//
Expand Down Expand Up @@ -745,8 +732,7 @@ class SolidsTest : public VecgeomVgdmlTestBase
{
if (vecgeom_version >= Version{2})
{
static std::string_view const levels[]
= {"warning", "warning", "warning"};
static std::string_view const levels[] = {"warning", "warning"};
return make_span(levels);
}
else if (geant4_version >= Version{11})
Expand Down Expand Up @@ -1066,24 +1052,11 @@ class CmseTest : public VecgeomVgdmlTestBase
{
public:
SPConstGeo build_geometry() final { return this->load_vgdml("cmse.gdml"); }

SpanStringView expected_log_levels() const final
{
if (vecgeom_version >= Version(2))
{
static std::string_view const levels[] = {"warning"};
return make_span(levels);
}
else
{
return {};
}
}
};

//---------------------------------------------------------------------------//

TEST_F(CmseTest, DISABLED_trace)
TEST_F(CmseTest, trace)
{
// clang-format off
{
Expand All @@ -1098,8 +1071,8 @@ TEST_F(CmseTest, DISABLED_trace)
180, 910, 24000, 6000};
EXPECT_VEC_SOFT_EQ(expected_distances, result.distances);
static real_type const expected_hw_safety[] = {100, 2.1499999999997,
0.52499999999986, 13.023518051922, 6.95, 6.95, 13.023518051922,
0.52499999999986, 2.15, 100, 5, 8, 100, 100, 100};
10.302730220675, 13.023518051922, 6.95, 6.95, 13.023518051922,
10.302730220675, 2.15, 100, 5, 8, 100, 100, 100};
EXPECT_VEC_SOFT_EQ(expected_hw_safety, result.halfway_safeties);
}
{
Expand Down Expand Up @@ -1135,8 +1108,8 @@ TEST_F(CmseTest, DISABLED_trace)
535, 920};
EXPECT_VEC_SOFT_EQ(expected_distances, result.distances);
static real_type const expected_hw_safety[] = {85, 267.5, 85.85,
58.4195, 0.078366388350241, 2.343262600759, 0.078366388350241,
58.4195, 85.85, 267.5, 460};
60.4, 0.078366388350241, 2.343262600759, 0.078366388350241,
60.4, 85.85, 267.5, 460};
EXPECT_VEC_SOFT_EQ(expected_hw_safety, result.halfway_safeties);
}
{
Expand All @@ -1148,7 +1121,7 @@ TEST_F(CmseTest, DISABLED_trace)
static real_type const expected_distances[] = {12.495, 287.505, 530,
920};
EXPECT_VEC_SOFT_EQ(expected_distances, result.distances);
static real_type const expected_hw_safety[] = {1, 1, 242, 460};
static real_type const expected_hw_safety[] = {6.2475, 47.95, 242, 460};
EXPECT_VEC_SOFT_EQ(expected_hw_safety, result.halfway_safeties);
}
// clang-format on
Expand Down Expand Up @@ -1236,7 +1209,7 @@ TEST_F(FourLevelsGeantTest, tracking)
EXPECT_VEC_SOFT_EQ(expected_distances, result.distances);
}
{
SCOPED_TRACE("From outside edge");
SCOPED_TRACE("From exactly on outside edge");
auto result = this->track({-24, 10., 10.}, {1, 0, 0});
static char const* const expected_volumes[] = {"[OUTSIDE]",
"World",
Expand Down Expand Up @@ -1275,29 +1248,6 @@ TEST_F(FourLevelsGeantTest, tracking)
static real_type const expected_distances[] = {5, 1, 3, 5};
EXPECT_VEC_SOFT_EQ(expected_distances, result.distances);
}
{
// Formerly in linear propagator test, used to fail
SCOPED_TRACE("From just outside world");
auto result = this->track({-24, 10, 10}, {1, 0, 0});
static char const* const expected_volumes[] = {"[OUTSIDE]",
"World",
"Envelope",
"Shape1",
"Shape2",
"Shape1",
"Envelope",
"World",
"Envelope",
"Shape1",
"Shape2",
"Shape1",
"Envelope",
"World"};
EXPECT_VEC_EQ(expected_volumes, result.volumes);
static real_type const expected_distances[]
= {1e-13, 7, 1, 1, 10, 1, 1, 6, 1, 1, 10, 1, 1, 7};
EXPECT_VEC_SOFT_EQ(expected_distances, result.distances);
}
}

//---------------------------------------------------------------------------//
Expand Down Expand Up @@ -1498,9 +1448,10 @@ TEST_F(SolidsGeantTest, geant_volumes)
{
{
auto result = this->get_import_geant_volumes();
static int const expected_volumes[]
= {0, 1, 2, 3, 4, 5, 6, 7, -1, 9, 10, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30};
static int const expected_volumes[] = {
0, 1, 2, 3, 4, 5, 6, 7, -1, 9, 10, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30,
};
EXPECT_VEC_EQ(expected_volumes, result.volumes);
EXPECT_EQ(0, result.missing_names.size()) << repr(result.missing_names);
}
Expand Down

0 comments on commit 56a2ea5

Please sign in to comment.