TestMapHelpers.hpp File Reference

Helper functions for testing coordinate maps. More...

#include "tests/Unit/TestingFramework.hpp"
#include <algorithm>
#include <array>
#include <functional>
#include <numeric>
#include <random>
#include "DataStructures/DataVector.hpp"
#include "DataStructures/Tensor/Tensor.hpp"
#include "Domain/CoordinateMaps/CoordinateMap.hpp"
#include "Domain/CoordinateMaps/Identity.hpp"
#include "Domain/Direction.hpp"
#include "Domain/DomainHelpers.hpp"
#include "Domain/OrientationMap.hpp"
#include "Utilities/TypeTraits.hpp"
#include "tests/Unit/Domain/DomainTestHelpers.hpp"
#include "tests/Unit/TestHelpers.hpp"

Go to the source code of this file.

## Classes

class  OrientationMapIterator< VolumeDim >
An iterator for looping through all possible orientations of the n-dim cube. More...

## Functions

template<typename Map >
bool are_maps_equal (const Map &map, const domain::CoordinateMapBase< Frame::Logical, Frame::Inertial, Map::dim > &map_base)
Given a Map and a CoordinateMapBase, checks that the maps are equal by downcasting map_base and then comparing to map. Returns false if the downcast fails.

template<typename SourceFrame , typename TargetFrame , size_t VolumeDim>
void check_if_maps_are_equal (const domain::CoordinateMapBase< SourceFrame, TargetFrame, VolumeDim > &map_one, const domain::CoordinateMapBase< SourceFrame, TargetFrame, VolumeDim > &map_two)
Given two coordinate maps (but not their types), check that the maps are equal by evaluating them at a random set of points.

template<typename Map >
void check_if_map_is_identity (const Map &map)
Given a coordinate map, check that this map is equal to the identity by evaluating the map at a random set of points.

template<typename Map >
void test_jacobian (const Map &map, const std::array< double, Map::dim > &test_point)
Given a Map map, checks that the jacobian gives expected results when compared to the numerical derivative in each direction.

template<typename Map >
void test_inv_jacobian (const Map &map, const std::array< double, Map::dim > &test_point)
Given a Map map, checks that the inverse jacobian and jacobian multiply together to produce the identity matrix.

template<typename Map , typename... Args>
void test_coordinate_map_implementation (const Map &map)
Checks that the CoordinateMap map functions as expected when used as the template parameter to the CoordinateMap type.

template<typename Map , typename... Args>
void test_coordinate_map_argument_types (const Map &map, const std::array< double, Map::dim > &test_point, const Args &... args)
Checks that the CoordinateMap map functions as expected when used with different argument types.

template<typename Map , typename T >
void test_inverse_map (const Map &map, const std::array< T, Map::dim > &test_point)
Given a Map map, checks that the inverse map gives expected results.

template<typename Map >
void test_suite_for_map_on_unit_cube (const Map &map)
Given a Map map, tests the map functions, including map inverse, jacobian, and inverse jacobian, for a series of points. These points are chosen in a dim-dimensonal cube of side 2 centered at the origin. The map is expected to be valid on the boundaries of the cube.

template<typename Map >
void test_suite_for_map_on_sphere (const Map &map, const bool include_origin=true, const double radius_of_sphere=1.0)
Given a Map map, tests the map functions, including map inverse, jacobian, and inverse jacobian, for a series of points. These points are chosen in a sphere of radius radius_of_sphere, and the map is expected to be valid on the boundary of that sphere as well as in its interior. The flag include_origin indicates whether to test the map at the origin. This test works only in 3 dimensions.

std::array< OrientationMap< 3 >, 6 > all_wedge_directions ()
Wedge OrientationMap in each of the six directions used in the Shell and Sphere domain creators.

## Detailed Description

Helper functions for testing coordinate maps.