TestHelpers.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <random>
7 
9 
10 /*!
11  * \brief Generates random coordinates of double and DataVector types.
12  *
13  * Creates:
14  * - `std::uniform_real_distribution<double>` named `dist` on interval
15  * `LOWER_BOUND` and `UPPER_BOUND`
16  * - `grid_coords_dv` of type `tnsr::I<DataVector, DIM, Frame::Grid>`
17  * - `grid_coords_double` of type `tnsr::I<double, DIMN, Frame::Grid>`
18  * - `inertial_coords_dv` of type `tnsr::I<DataVector, DIM, Frame::Inertial>`
19  * - `inertial_coords_double` of type `tnsr::I<double, DIMN, Frame::Inertial>`
20  *
21  * The argument `GENERATOR` must be a `gsl::not_null` to a random number
22  * generator. Typically the generator would be created using the
23  * `MAKE_GENERATOR` macro.
24  */
25 #define TIME_DEPENDENCE_GENERATE_COORDS(GENERATOR, DIM, LOWER_BOUND, \
26  UPPER_BOUND) \
27  std::uniform_real_distribution<double> dist{LOWER_BOUND, UPPER_BOUND}; \
28  const auto grid_coords_dv = \
29  make_with_random_values<tnsr::I<DataVector, DIM, Frame::Grid>>( \
30  GENERATOR, make_not_null(&dist), DataVector{5}); \
31  const auto grid_coords_double = \
32  make_with_random_values<tnsr::I<double, DIM, Frame::Grid>>( \
33  GENERATOR, make_not_null(&dist)); \
34  const auto inertial_coords_dv = \
35  make_with_random_values<tnsr::I<DataVector, DIM, Frame::Inertial>>( \
36  GENERATOR, make_not_null(&dist), DataVector{5}); \
37  const auto inertial_coords_double = \
38  make_with_random_values<tnsr::I<double, DIM, Frame::Inertial>>( \
39  GENERATOR, make_not_null(&dist))
random
MakeWithRandomValues.hpp