All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
topology_test.cxx
Go to the documentation of this file.
1 /**
2  * @file topology_test.cxx
3  * @brief Test for neighbourhood discovery in simple geometries.
4  * @author Gianluca Petrillo (petrillo@fnal.gov)
5  * @date July 12, 2017
6  *
7  * Usage: just run the executable.
8  */
9 
10 // Boost test libraries; defining this symbol tells boost somehow to generate
11 // a main() function; Boost is pulled in by boost_unit_test_base.h
12 #define BOOST_TEST_MODULE topology_test
13 
14 // LArSoft libraries
16 
17 // utility libraries
18 #include <boost/test/unit_test.hpp>
19 
20 // C/C++ standard libraries
21 #include <vector>
22 #include <iterator> // std::back_inserter()
23 #include <algorithm> // std::transform()
24 #include <memory> // std::address_of()
25 #include <cstdlib> // std::size_t
26 
27 //------------------------------------------------------------------------------
28 
29 
30 struct Neighbors_t {
31 
32  static constexpr std::size_t Width = 0;
33  static constexpr std::size_t Depth = 1;
34  static constexpr std::size_t Drift = 2;
35  static constexpr std::size_t NDims = 3;
36  static constexpr std::size_t Pos = 0;
37  static constexpr std::size_t Neg = 1;
38  static constexpr std::size_t NDirs = 2;
39 
40  std::vector<geo::BoxBoundedGeo const*> neighbors[NDims][NDirs];
41 
42 }; // Neighbors_t
43 
44 
45 //------------------------------------------------------------------------------
47 
48  //
49  // definition of the topology; something simple here: a 3x3x3 cube
50  //
51  double const side = 2.0;
52  std::vector<geo::BoxBoundedGeo> boxes;
53  boxes.reserve(27);
54  for (int x = -1; x <= 1; ++x)
55  for (int y = -1; y <= 1; ++y)
56  for (int z = -1; z <= 1; ++z)
57  boxes.emplace_back(
58  side * (x - 0.5), side * (x + 0.5),
59  side * (y - 0.5), side * (y + 0.5),
60  side * (z - 0.5), side * (z + 0.5)
61  );
62  std::vector<geo::BoxBoundedGeo const*> volumes;
63  std::transform(boxes.cbegin(), boxes.cend(), std::back_inserter(volumes),
64  [](auto& obj){ return std::addressof(obj); });
65 
66  //
67  // discovery of the neighbourhood
68  //
69 
70  //
71  // verification of the result
72  //
73 
74 
75 
76 } // BoxedTopologyTest()
77 
78 
79 
80 
81 
82 
83 
84 //------------------------------------------------------------------------------
85 BOOST_AUTO_TEST_CASE(BoxedTopologyTestCase) {
87 } // BoxedTopologyTestCase
BOOST_AUTO_TEST_CASE(AllTests)
static constexpr std::size_t Neg
process_name opflash particleana ie ie ie z
static constexpr Sample_t transform(Sample_t sample)
process_name opflash particleana ie x
static constexpr std::size_t Width
static constexpr std::size_t Pos
process_name opflash particleana ie ie y
static constexpr std::size_t NDirs
std::vector< geo::BoxBoundedGeo const * > neighbors[NDims][NDirs]
static constexpr std::size_t Depth
Provides a base class aware of world box coordinates.
static constexpr std::size_t Drift
static constexpr std::size_t NDims
void BoxedTopologyTest()