forked from celeritas-project/celeritas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GlobalGeoTestBase.hh
49 lines (41 loc) · 1.6 KB
/
GlobalGeoTestBase.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//----------------------------------*-C++-*----------------------------------//
// Copyright 2022-2024 UT-Battelle, LLC, and other Celeritas developers.
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file celeritas/GlobalGeoTestBase.hh
//---------------------------------------------------------------------------//
#pragma once
#include <string_view>
#include "geocel/LazyGeoManager.hh"
#include "GlobalTestBase.hh"
namespace celeritas
{
namespace test
{
//---------------------------------------------------------------------------//
/*!
* Reuse geometry across individual tests.
*
* This is helpful for slow geometry construction or if the geometry has
* trouble building/destroying multiple times per execution due to global
* variable usage (VecGeom, Geant4).
*
* The "geometry basename" should be the filename without extension of a
* geometry file inside `test/celeritas/data`.
*/
class GlobalGeoTestBase : virtual public GlobalTestBase,
protected LazyGeoManager
{
public:
// Overload with the base filename of the geometry
virtual std::string_view geometry_basename() const = 0;
// Construct a geometry that's persistent across tests
SPConstGeo build_geometry() override;
protected:
//// LAZY GEOMETRY CONSTRUCTION AND CLEANUP ////
SPConstGeoI build_fresh_geometry(std::string_view) override;
};
//---------------------------------------------------------------------------//
} // namespace test
} // namespace celeritas