test_coord_sys.cc File Reference
#include <iostream>
#include <numeric>
#include "gtest/gtest.h"
#include "wonton/support/CoordinateSystem.h"

Functions

template<typename CoordSys , int D>
auto get_bounding_box ()
 
template<typename CoordSys , int D>
auto get_reference_point ()
 
template<typename CoordSys , int D>
auto get_unmodified_gradient ()
 
template<typename CoordSys , int D>
auto get_modified_gradient ()
 
template<typename CoordSys , int D>
auto get_unmodified_line_element ()
 
template<typename CoordSys , int D>
auto get_modified_line_element ()
 
template<typename CoordSys , int D>
auto get_unmodified_volume ()
 
template<typename CoordSys , int D>
auto get_modified_volume ()
 
template<typename CoordSys , int D>
auto get_unmodified_first_moments ()
 
template<typename CoordSys , int D>
auto get_modified_first_moments ()
 
template<>
auto get_bounding_box< Wonton::CartesianCoordinates, 1 > ()
 
template<>
auto get_reference_point< Wonton::CartesianCoordinates, 1 > ()
 
template<>
auto get_unmodified_gradient< Wonton::CartesianCoordinates, 1 > ()
 
template<>
auto get_modified_gradient< Wonton::CartesianCoordinates, 1 > ()
 
template<>
auto get_unmodified_line_element< Wonton::CartesianCoordinates, 1 > ()
 
template<>
auto get_modified_line_element< Wonton::CartesianCoordinates, 1 > ()
 
template<>
auto get_unmodified_volume< Wonton::CartesianCoordinates, 1 > ()
 
template<>
auto get_modified_volume< Wonton::CartesianCoordinates, 1 > ()
 
template<>
auto get_unmodified_first_moments< Wonton::CartesianCoordinates, 1 > ()
 
template<>
auto get_modified_first_moments< Wonton::CartesianCoordinates, 1 > ()
 
template<>
auto get_bounding_box< Wonton::CartesianCoordinates, 2 > ()
 
template<>
auto get_reference_point< Wonton::CartesianCoordinates, 2 > ()
 
template<>
auto get_unmodified_gradient< Wonton::CartesianCoordinates, 2 > ()
 
template<>
auto get_modified_gradient< Wonton::CartesianCoordinates, 2 > ()
 
template<>
auto get_unmodified_line_element< Wonton::CartesianCoordinates, 2 > ()
 
template<>
auto get_modified_line_element< Wonton::CartesianCoordinates, 2 > ()
 
template<>
auto get_unmodified_volume< Wonton::CartesianCoordinates, 2 > ()
 
template<>
auto get_modified_volume< Wonton::CartesianCoordinates, 2 > ()
 
template<>
auto get_unmodified_first_moments< Wonton::CartesianCoordinates, 2 > ()
 
template<>
auto get_modified_first_moments< Wonton::CartesianCoordinates, 2 > ()
 
template<>
auto get_bounding_box< Wonton::CartesianCoordinates, 3 > ()
 
template<>
auto get_reference_point< Wonton::CartesianCoordinates, 3 > ()
 
template<>
auto get_unmodified_gradient< Wonton::CartesianCoordinates, 3 > ()
 
template<>
auto get_modified_gradient< Wonton::CartesianCoordinates, 3 > ()
 
template<>
auto get_unmodified_line_element< Wonton::CartesianCoordinates, 3 > ()
 
template<>
auto get_modified_line_element< Wonton::CartesianCoordinates, 3 > ()
 
template<>
auto get_unmodified_volume< Wonton::CartesianCoordinates, 3 > ()
 
template<>
auto get_modified_volume< Wonton::CartesianCoordinates, 3 > ()
 
template<>
auto get_unmodified_first_moments< Wonton::CartesianCoordinates, 3 > ()
 
template<>
auto get_modified_first_moments< Wonton::CartesianCoordinates, 3 > ()
 
template<>
auto get_bounding_box< Wonton::CylindricalRadialCoordinates, 1 > ()
 
template<>
auto get_reference_point< Wonton::CylindricalRadialCoordinates, 1 > ()
 
template<>
auto get_unmodified_gradient< Wonton::CylindricalRadialCoordinates, 1 > ()
 
template<>
auto get_modified_gradient< Wonton::CylindricalRadialCoordinates, 1 > ()
 
template<>
auto get_unmodified_line_element< Wonton::CylindricalRadialCoordinates, 1 > ()
 
template<>
auto get_modified_line_element< Wonton::CylindricalRadialCoordinates, 1 > ()
 
template<>
auto get_unmodified_volume< Wonton::CylindricalRadialCoordinates, 1 > ()
 
template<>
auto get_modified_volume< Wonton::CylindricalRadialCoordinates, 1 > ()
 
template<>
auto get_unmodified_first_moments< Wonton::CylindricalRadialCoordinates, 1 > ()
 
template<>
auto get_modified_first_moments< Wonton::CylindricalRadialCoordinates, 1 > ()
 
template<>
auto get_bounding_box< Wonton::CylindricalAxisymmetricCoordinates, 2 > ()
 
template<>
auto get_reference_point< Wonton::CylindricalAxisymmetricCoordinates, 2 > ()
 
template<>
auto get_unmodified_gradient< Wonton::CylindricalAxisymmetricCoordinates, 2 > ()
 
template<>
auto get_modified_gradient< Wonton::CylindricalAxisymmetricCoordinates, 2 > ()
 
template<>
auto get_unmodified_line_element< Wonton::CylindricalAxisymmetricCoordinates, 2 > ()
 
template<>
auto get_modified_line_element< Wonton::CylindricalAxisymmetricCoordinates, 2 > ()
 
template<>
auto get_unmodified_volume< Wonton::CylindricalAxisymmetricCoordinates, 2 > ()
 
template<>
auto get_modified_volume< Wonton::CylindricalAxisymmetricCoordinates, 2 > ()
 
template<>
auto get_unmodified_first_moments< Wonton::CylindricalAxisymmetricCoordinates, 2 > ()
 
template<>
auto get_modified_first_moments< Wonton::CylindricalAxisymmetricCoordinates, 2 > ()
 
template<>
auto get_bounding_box< Wonton::CylindricalPolarCoordinates, 2 > ()
 
template<>
auto get_reference_point< Wonton::CylindricalPolarCoordinates, 2 > ()
 
template<>
auto get_unmodified_gradient< Wonton::CylindricalPolarCoordinates, 2 > ()
 
template<>
auto get_modified_gradient< Wonton::CylindricalPolarCoordinates, 2 > ()
 
template<>
auto get_unmodified_line_element< Wonton::CylindricalPolarCoordinates, 2 > ()
 
template<>
auto get_modified_line_element< Wonton::CylindricalPolarCoordinates, 2 > ()
 
template<>
auto get_unmodified_volume< Wonton::CylindricalPolarCoordinates, 2 > ()
 
template<>
auto get_modified_volume< Wonton::CylindricalPolarCoordinates, 2 > ()
 
template<>
auto get_unmodified_first_moments< Wonton::CylindricalPolarCoordinates, 2 > ()
 
template<>
auto get_modified_first_moments< Wonton::CylindricalPolarCoordinates, 2 > ()
 
template<>
auto get_bounding_box< Wonton::Cylindrical3DCoordinates, 3 > ()
 
template<>
auto get_reference_point< Wonton::Cylindrical3DCoordinates, 3 > ()
 
template<>
auto get_unmodified_gradient< Wonton::Cylindrical3DCoordinates, 3 > ()
 
template<>
auto get_modified_gradient< Wonton::Cylindrical3DCoordinates, 3 > ()
 
template<>
auto get_unmodified_line_element< Wonton::Cylindrical3DCoordinates, 3 > ()
 
template<>
auto get_modified_line_element< Wonton::Cylindrical3DCoordinates, 3 > ()
 
template<>
auto get_unmodified_volume< Wonton::Cylindrical3DCoordinates, 3 > ()
 
template<>
auto get_modified_volume< Wonton::Cylindrical3DCoordinates, 3 > ()
 
template<>
auto get_unmodified_first_moments< Wonton::Cylindrical3DCoordinates, 3 > ()
 
template<>
auto get_modified_first_moments< Wonton::Cylindrical3DCoordinates, 3 > ()
 
template<>
auto get_bounding_box< Wonton::SphericalRadialCoordinates, 1 > ()
 
template<>
auto get_reference_point< Wonton::SphericalRadialCoordinates, 1 > ()
 
template<>
auto get_unmodified_gradient< Wonton::SphericalRadialCoordinates, 1 > ()
 
template<>
auto get_modified_gradient< Wonton::SphericalRadialCoordinates, 1 > ()
 
template<>
auto get_unmodified_line_element< Wonton::SphericalRadialCoordinates, 1 > ()
 
template<>
auto get_modified_line_element< Wonton::SphericalRadialCoordinates, 1 > ()
 
template<>
auto get_unmodified_volume< Wonton::SphericalRadialCoordinates, 1 > ()
 
template<>
auto get_modified_volume< Wonton::SphericalRadialCoordinates, 1 > ()
 
template<>
auto get_unmodified_first_moments< Wonton::SphericalRadialCoordinates, 1 > ()
 
template<>
auto get_modified_first_moments< Wonton::SphericalRadialCoordinates, 1 > ()
 
template<>
auto get_bounding_box< Wonton::Spherical3DCoordinates, 3 > ()
 
template<>
auto get_reference_point< Wonton::Spherical3DCoordinates, 3 > ()
 
template<>
auto get_unmodified_gradient< Wonton::Spherical3DCoordinates, 3 > ()
 
template<>
auto get_modified_gradient< Wonton::Spherical3DCoordinates, 3 > ()
 
template<>
auto get_unmodified_line_element< Wonton::Spherical3DCoordinates, 3 > ()
 
template<>
auto get_modified_line_element< Wonton::Spherical3DCoordinates, 3 > ()
 
template<>
auto get_unmodified_volume< Wonton::Spherical3DCoordinates, 3 > ()
 
template<>
auto get_modified_volume< Wonton::Spherical3DCoordinates, 3 > ()
 
template<>
auto get_unmodified_first_moments< Wonton::Spherical3DCoordinates, 3 > ()
 
template<>
auto get_modified_first_moments< Wonton::Spherical3DCoordinates, 3 > ()
 
template<typename CoordSys , int D>
void run_coord_sys_test ()
 
template<int D, int S>
std::vector< double > get_sample_moments ()
 
template<>
std::vector< double > get_sample_moments< 1, 0 > ()
 
template<>
std::vector< double > get_sample_moments< 1, 1 > ()
 
template<>
std::vector< double > get_sample_moments< 1, 2 > ()
 
template<>
std::vector< double > get_sample_moments< 2, 0 > ()
 
template<>
std::vector< double > get_sample_moments< 2, 1 > ()
 
template<>
std::vector< double > get_sample_moments< 2, 2 > ()
 
template<>
std::vector< double > get_sample_moments< 3, 0 > ()
 
template<>
std::vector< double > get_sample_moments< 3, 1 > ()
 
template<>
std::vector< double > get_sample_moments< 3, 2 > ()
 
template<typename CoordSys , int D>
constexpr void run_shift_test ()
 
 TEST (Moment_Index_test, Cartesian1D)
 
 TEST (Moment_Index_test, Cartesian2D)
 
 TEST (Moment_Index_test, Cartesian3D)
 
 TEST (Moment_Index_test, CylindricalRadial)
 
 TEST (Moment_Index_test, CylindricalAxisymmetric)
 
 TEST (Moment_Index_test, CylindricalPolar)
 
 TEST (Moment_Index_test, Cylindrical3D)
 
 TEST (Moment_Index_test, SphericalRadial)
 
 TEST (Moment_Index_test, Spherical3D)
 

Variables

constexpr double sqrt2 = 1.414213562373095048
 
constexpr double TOLERANCE = 1e-13
 

Function Documentation

◆ get_bounding_box()

template<typename CoordSys , int D>
auto get_bounding_box ( )

◆ get_bounding_box< Wonton::CartesianCoordinates, 1 >()

◆ get_bounding_box< Wonton::CartesianCoordinates, 2 >()

◆ get_bounding_box< Wonton::CartesianCoordinates, 3 >()

◆ get_bounding_box< Wonton::Cylindrical3DCoordinates, 3 >()

◆ get_bounding_box< Wonton::CylindricalAxisymmetricCoordinates, 2 >()

◆ get_bounding_box< Wonton::CylindricalPolarCoordinates, 2 >()

◆ get_bounding_box< Wonton::CylindricalRadialCoordinates, 1 >()

◆ get_bounding_box< Wonton::Spherical3DCoordinates, 3 >()

◆ get_bounding_box< Wonton::SphericalRadialCoordinates, 1 >()

◆ get_modified_first_moments()

template<typename CoordSys , int D>
auto get_modified_first_moments ( )

◆ get_modified_first_moments< Wonton::CartesianCoordinates, 1 >()

◆ get_modified_first_moments< Wonton::CartesianCoordinates, 2 >()

◆ get_modified_first_moments< Wonton::CartesianCoordinates, 3 >()

◆ get_modified_first_moments< Wonton::Cylindrical3DCoordinates, 3 >()

◆ get_modified_first_moments< Wonton::CylindricalAxisymmetricCoordinates, 2 >()

◆ get_modified_first_moments< Wonton::CylindricalPolarCoordinates, 2 >()

◆ get_modified_first_moments< Wonton::CylindricalRadialCoordinates, 1 >()

◆ get_modified_first_moments< Wonton::Spherical3DCoordinates, 3 >()

◆ get_modified_first_moments< Wonton::SphericalRadialCoordinates, 1 >()

◆ get_modified_gradient()

template<typename CoordSys , int D>
auto get_modified_gradient ( )

◆ get_modified_gradient< Wonton::CartesianCoordinates, 1 >()

◆ get_modified_gradient< Wonton::CartesianCoordinates, 2 >()

◆ get_modified_gradient< Wonton::CartesianCoordinates, 3 >()

◆ get_modified_gradient< Wonton::Cylindrical3DCoordinates, 3 >()

◆ get_modified_gradient< Wonton::CylindricalAxisymmetricCoordinates, 2 >()

◆ get_modified_gradient< Wonton::CylindricalPolarCoordinates, 2 >()

◆ get_modified_gradient< Wonton::CylindricalRadialCoordinates, 1 >()

◆ get_modified_gradient< Wonton::Spherical3DCoordinates, 3 >()

◆ get_modified_gradient< Wonton::SphericalRadialCoordinates, 1 >()

◆ get_modified_line_element()

template<typename CoordSys , int D>
auto get_modified_line_element ( )

◆ get_modified_line_element< Wonton::CartesianCoordinates, 1 >()

◆ get_modified_line_element< Wonton::CartesianCoordinates, 2 >()

◆ get_modified_line_element< Wonton::CartesianCoordinates, 3 >()

◆ get_modified_line_element< Wonton::Cylindrical3DCoordinates, 3 >()

◆ get_modified_line_element< Wonton::CylindricalAxisymmetricCoordinates, 2 >()

◆ get_modified_line_element< Wonton::CylindricalPolarCoordinates, 2 >()

◆ get_modified_line_element< Wonton::CylindricalRadialCoordinates, 1 >()

◆ get_modified_line_element< Wonton::Spherical3DCoordinates, 3 >()

◆ get_modified_line_element< Wonton::SphericalRadialCoordinates, 1 >()

◆ get_modified_volume()

template<typename CoordSys , int D>
auto get_modified_volume ( )

◆ get_modified_volume< Wonton::CartesianCoordinates, 1 >()

◆ get_modified_volume< Wonton::CartesianCoordinates, 2 >()

◆ get_modified_volume< Wonton::CartesianCoordinates, 3 >()

◆ get_modified_volume< Wonton::Cylindrical3DCoordinates, 3 >()

◆ get_modified_volume< Wonton::CylindricalAxisymmetricCoordinates, 2 >()

◆ get_modified_volume< Wonton::CylindricalPolarCoordinates, 2 >()

◆ get_modified_volume< Wonton::CylindricalRadialCoordinates, 1 >()

◆ get_modified_volume< Wonton::Spherical3DCoordinates, 3 >()

◆ get_modified_volume< Wonton::SphericalRadialCoordinates, 1 >()

◆ get_reference_point()

template<typename CoordSys , int D>
auto get_reference_point ( )

◆ get_reference_point< Wonton::CartesianCoordinates, 1 >()

◆ get_reference_point< Wonton::CartesianCoordinates, 2 >()

◆ get_reference_point< Wonton::CartesianCoordinates, 3 >()

◆ get_reference_point< Wonton::Cylindrical3DCoordinates, 3 >()

◆ get_reference_point< Wonton::CylindricalAxisymmetricCoordinates, 2 >()

◆ get_reference_point< Wonton::CylindricalPolarCoordinates, 2 >()

◆ get_reference_point< Wonton::CylindricalRadialCoordinates, 1 >()

◆ get_reference_point< Wonton::Spherical3DCoordinates, 3 >()

◆ get_reference_point< Wonton::SphericalRadialCoordinates, 1 >()

◆ get_sample_moments()

template<int D, int S>
std::vector<double> get_sample_moments ( )

◆ get_sample_moments< 1, 0 >()

template<>
std::vector<double> get_sample_moments< 1, 0 > ( )

◆ get_sample_moments< 1, 1 >()

template<>
std::vector<double> get_sample_moments< 1, 1 > ( )

◆ get_sample_moments< 1, 2 >()

template<>
std::vector<double> get_sample_moments< 1, 2 > ( )

◆ get_sample_moments< 2, 0 >()

template<>
std::vector<double> get_sample_moments< 2, 0 > ( )

◆ get_sample_moments< 2, 1 >()

template<>
std::vector<double> get_sample_moments< 2, 1 > ( )

◆ get_sample_moments< 2, 2 >()

template<>
std::vector<double> get_sample_moments< 2, 2 > ( )

◆ get_sample_moments< 3, 0 >()

template<>
std::vector<double> get_sample_moments< 3, 0 > ( )

◆ get_sample_moments< 3, 1 >()

template<>
std::vector<double> get_sample_moments< 3, 1 > ( )

◆ get_sample_moments< 3, 2 >()

template<>
std::vector<double> get_sample_moments< 3, 2 > ( )

◆ get_unmodified_first_moments()

template<typename CoordSys , int D>
auto get_unmodified_first_moments ( )

◆ get_unmodified_first_moments< Wonton::CartesianCoordinates, 1 >()

◆ get_unmodified_first_moments< Wonton::CartesianCoordinates, 2 >()

◆ get_unmodified_first_moments< Wonton::CartesianCoordinates, 3 >()

◆ get_unmodified_first_moments< Wonton::Cylindrical3DCoordinates, 3 >()

◆ get_unmodified_first_moments< Wonton::CylindricalAxisymmetricCoordinates, 2 >()

◆ get_unmodified_first_moments< Wonton::CylindricalPolarCoordinates, 2 >()

◆ get_unmodified_first_moments< Wonton::CylindricalRadialCoordinates, 1 >()

◆ get_unmodified_first_moments< Wonton::Spherical3DCoordinates, 3 >()

◆ get_unmodified_first_moments< Wonton::SphericalRadialCoordinates, 1 >()

◆ get_unmodified_gradient()

template<typename CoordSys , int D>
auto get_unmodified_gradient ( )

◆ get_unmodified_gradient< Wonton::CartesianCoordinates, 1 >()

◆ get_unmodified_gradient< Wonton::CartesianCoordinates, 2 >()

◆ get_unmodified_gradient< Wonton::CartesianCoordinates, 3 >()

◆ get_unmodified_gradient< Wonton::Cylindrical3DCoordinates, 3 >()

◆ get_unmodified_gradient< Wonton::CylindricalAxisymmetricCoordinates, 2 >()

◆ get_unmodified_gradient< Wonton::CylindricalPolarCoordinates, 2 >()

◆ get_unmodified_gradient< Wonton::CylindricalRadialCoordinates, 1 >()

◆ get_unmodified_gradient< Wonton::Spherical3DCoordinates, 3 >()

◆ get_unmodified_gradient< Wonton::SphericalRadialCoordinates, 1 >()

◆ get_unmodified_line_element()

template<typename CoordSys , int D>
auto get_unmodified_line_element ( )

◆ get_unmodified_line_element< Wonton::CartesianCoordinates, 1 >()

◆ get_unmodified_line_element< Wonton::CartesianCoordinates, 2 >()

◆ get_unmodified_line_element< Wonton::CartesianCoordinates, 3 >()

◆ get_unmodified_line_element< Wonton::Cylindrical3DCoordinates, 3 >()

◆ get_unmodified_line_element< Wonton::CylindricalAxisymmetricCoordinates, 2 >()

◆ get_unmodified_line_element< Wonton::CylindricalPolarCoordinates, 2 >()

◆ get_unmodified_line_element< Wonton::CylindricalRadialCoordinates, 1 >()

◆ get_unmodified_line_element< Wonton::Spherical3DCoordinates, 3 >()

◆ get_unmodified_line_element< Wonton::SphericalRadialCoordinates, 1 >()

◆ get_unmodified_volume()

template<typename CoordSys , int D>
auto get_unmodified_volume ( )

◆ get_unmodified_volume< Wonton::CartesianCoordinates, 1 >()

◆ get_unmodified_volume< Wonton::CartesianCoordinates, 2 >()

◆ get_unmodified_volume< Wonton::CartesianCoordinates, 3 >()

◆ get_unmodified_volume< Wonton::Cylindrical3DCoordinates, 3 >()

◆ get_unmodified_volume< Wonton::CylindricalAxisymmetricCoordinates, 2 >()

◆ get_unmodified_volume< Wonton::CylindricalPolarCoordinates, 2 >()

◆ get_unmodified_volume< Wonton::CylindricalRadialCoordinates, 1 >()

◆ get_unmodified_volume< Wonton::Spherical3DCoordinates, 3 >()

◆ get_unmodified_volume< Wonton::SphericalRadialCoordinates, 1 >()

◆ run_coord_sys_test()

template<typename CoordSys , int D>
void run_coord_sys_test ( )

◆ run_shift_test()

template<typename CoordSys , int D>
constexpr void run_shift_test ( )

◆ TEST() [1/9]

TEST ( Moment_Index_test  ,
Cartesian1D   
)

◆ TEST() [2/9]

TEST ( Moment_Index_test  ,
Cartesian2D   
)

◆ TEST() [3/9]

TEST ( Moment_Index_test  ,
Cartesian3D   
)

◆ TEST() [4/9]

TEST ( Moment_Index_test  ,
CylindricalRadial   
)

◆ TEST() [5/9]

TEST ( Moment_Index_test  ,
CylindricalAxisymmetric   
)

◆ TEST() [6/9]

TEST ( Moment_Index_test  ,
CylindricalPolar   
)

◆ TEST() [7/9]

TEST ( Moment_Index_test  ,
Cylindrical3D   
)

◆ TEST() [8/9]

TEST ( Moment_Index_test  ,
SphericalRadial   
)

◆ TEST() [9/9]

TEST ( Moment_Index_test  ,
Spherical3D   
)

Variable Documentation

◆ sqrt2

constexpr double sqrt2 = 1.414213562373095048

◆ TOLERANCE

constexpr double TOLERANCE = 1e-13