Intrepid2
Macros | Typedefs | Functions | Variables
Intrepid2_TestUtils.hpp File Reference

Utility methods for Intrepid2 unit tests. More...

#include "Kokkos_Core.hpp"
#include "Kokkos_DynRankView.hpp"
#include "Intrepid2_Basis.hpp"
#include "Intrepid2_DerivedBasisFamily.hpp"
#include "Intrepid2_FunctorIterator.hpp"
#include "Intrepid2_HierarchicalBasisFamily.hpp"
#include "Intrepid2_PointTools.hpp"
#include "Intrepid2_Sacado.hpp"
#include "Intrepid2_Utils.hpp"
#include "Teuchos_UnitTestHarness.hpp"

Go to the source code of this file.

Macros

#define INTREPID2_POINTSCALAR_TEST_INSTANT(GROUP_NAME, TEST_NAME)
 
#define INTREPID2_OUTPUTSCALAR_POINTSCALAR_TEST_INSTANT(GROUP_NAME, TEST_NAME)
 

Typedefs

using Intrepid2::DefaultTestDeviceType = typename Kokkos::DefaultExecutionSpace::device_type
 Default Kokkos::Device to use for tests; depends on platform.
 
template<typename ScalarType , typename DeviceType >
using Intrepid2::ViewType = Kokkos::DynRankView< ScalarType, DeviceType >
 
template<typename ScalarType , typename DeviceType >
using Intrepid2::FixedRankViewType = Kokkos::View< ScalarType, DeviceType >
 

Functions

template<class Scalar >
const Teuchos::ScalarTraits
< Scalar >::magnitudeType 
Intrepid2::smallNumber ()
 Use Teuchos small number determination on host; pass this to Intrepid2::relErr() on device.
 
template<class Scalar1 , class Scalar2 >
KOKKOS_INLINE_FUNCTION bool Intrepid2::relErrMeetsTol (const Scalar1 &s1, const Scalar2 &s2, const typename Teuchos::ScalarTraits< typename std::common_type< Scalar1, Scalar2 >::type >::magnitudeType &smallNumber, const double &tol)
 Adapted from Teuchos::relErr(); for use in code that may be executed on device.
 
template<class Scalar1 , class Scalar2 >
KOKKOS_INLINE_FUNCTION bool Intrepid2::errMeetsAbsAndRelTol (const Scalar1 &s1, const Scalar2 &s2, const double &relTol, const double &absTol)
 
template<typename ScalarType >
KOKKOS_INLINE_FUNCTION bool Intrepid2::valuesAreSmall (const ScalarType &a, const ScalarType &b, const double &epsilon)
 
bool Intrepid2::approximatelyEqual (double a, double b, double epsilon)
 
bool Intrepid2::essentiallyEqual (double a, double b, double epsilon)
 
KOKKOS_INLINE_FUNCTION double Intrepid2::fromZeroOne (double x_zero_one)
 
KOKKOS_INLINE_FUNCTION double Intrepid2::toZeroOne (double x_minus_one_one)
 
KOKKOS_INLINE_FUNCTION double Intrepid2::fromZeroOne_dx (double dx_zero_one)
 
KOKKOS_INLINE_FUNCTION double Intrepid2::toZeroOne_dx (double dx_minus_one_one)
 
template<class DeviceViewType >
DeviceViewType::HostMirror Intrepid2::getHostCopy (const DeviceViewType &deviceView)
 
template<class BasisFamily >
Teuchos::RCP< Intrepid2::Basis
< DefaultTestDeviceType,
double, double > > 
Intrepid2::getBasisUsingFamily (shards::CellTopology cellTopo, Intrepid2::EFunctionSpace fs, int polyOrder_x, int polyOrder_y=-1, int polyOrder_z=-1)
 
template<bool defineVertexFunctions>
Teuchos::RCP< Intrepid2::Basis
< DefaultTestDeviceType,
double, double > > 
Intrepid2::getHierarchicalBasis (shards::CellTopology cellTopo, Intrepid2::EFunctionSpace fs, int polyOrder_x, int polyOrder_y=-1, int polyOrder_z=-1)
 
template<typename ValueType , typename DeviceType , class... DimArgs>
ViewType< ValueType, DeviceType > Intrepid2::getView (const std::string &label, DimArgs...dims)
 
template<typename ValueType , class... DimArgs>
FixedRankViewType< typename
RankExpander< ValueType,
sizeof...(DimArgs) >
::value_type,
DefaultTestDeviceType > 
Intrepid2::getFixedRankView (const std::string &label, DimArgs...dims)
 
template<typename PointValueType , typename DeviceType >
ViewType< PointValueType,
DeviceType > 
Intrepid2::getInputPointsView (shards::CellTopology &cellTopo, int numPoints_1D)
 Returns a DynRankView containing regularly-spaced points on the specified cell topology. More...
 
template<typename OutputValueType , typename DeviceType >
ViewType< OutputValueType,
DeviceType > 
Intrepid2::getOutputView (Intrepid2::EFunctionSpace fs, Intrepid2::EOperator op, int basisCardinality, int numPoints, int spaceDim)
 
std::vector< std::vector< int > > Intrepid2::getBasisTestCasesUpToDegree (int spaceDim, int minDegree, int polyOrder_x, int polyOrder_y=-1, int polyOrder_z=-1)
 
template<class Functor , class Scalar , int rank>
ViewType< Scalar,
DefaultTestDeviceType >
::HostMirror 
Intrepid2::copyFunctorToHostView (const Functor &deviceFunctor)
 Copy the values for the specified functor.
 
template<class FunctorType , typename Scalar , int rank>
void Intrepid2::printFunctor (const FunctorType &functor, std::ostream &out, const std::string &functorName="")
 
template<class FunctorType >
void Intrepid2::printFunctor1 (const FunctorType &functor, std::ostream &out, const std::string &functorName="")
 
template<class FunctorType >
void Intrepid2::printFunctor2 (const FunctorType &functor, std::ostream &out, const std::string &functorName="")
 
template<class FunctorType >
void Intrepid2::printFunctor3 (const FunctorType &functor, std::ostream &out, const std::string &functorName="")
 
template<class FunctorType >
void Intrepid2::printFunctor4 (const FunctorType &functor, std::ostream &out, const std::string &functorName="")
 
template<class FunctorType >
void Intrepid2::printFunctor5 (const FunctorType &functor, std::ostream &out, const std::string &functorName="")
 
template<class FunctorType >
void Intrepid2::printFunctor6 (const FunctorType &functor, std::ostream &out, const std::string &functorName="")
 
template<class FunctorType >
void Intrepid2::printFunctor7 (const FunctorType &functor, std::ostream &out, const std::string &functorName="")
 
template<class View >
void Intrepid2::printView (const View &view, std::ostream &out, const std::string &viewName="")
 
template<class FunctorType1 , class FunctorType2 , int rank, typename Scalar = typename FunctorType1::value_type, class ExecutionSpace = typename FunctorType1::execution_space>
std::enable_if
< !(supports_rank
< FunctorType1, rank >::value
&&supports_rank< FunctorType2,
rank >::value), void >::type 
Intrepid2::testFloatingEquality (const FunctorType1 &functor1, const FunctorType2 &functor2, double relTol, double absTol, Teuchos::FancyOStream &out, bool &success, std::string functor1Name="Functor 1", std::string functor2Name="Functor 2")
 
template<class FunctorType1 , class FunctorType2 , int rank, typename Scalar = typename FunctorType1::value_type, class ExecutionSpace = typename FunctorType1::execution_space>
std::enable_if< (supports_rank
< FunctorType1, rank >::value
&&supports_rank< FunctorType2,
rank >::value), void >::type 
Intrepid2::testFloatingEquality (const FunctorType1 &functor1, const FunctorType2 &functor2, double relTol, double absTol, Teuchos::FancyOStream &out, bool &success, std::string functor1Name="Functor 1", std::string functor2Name="Functor 2")
 this method assumes both functors are accesible on device.
 
template<class ViewType , class FunctorType >
void Intrepid2::testFloatingEquality1 (const ViewType &view, const FunctorType &functor, double relTol, double absTol, Teuchos::FancyOStream &out, bool &success, std::string view1Name="View", std::string view2Name="Functor")
 
template<class ViewType , class FunctorType >
void Intrepid2::testFloatingEquality2 (const ViewType &view, const FunctorType &functor, double relTol, double absTol, Teuchos::FancyOStream &out, bool &success, std::string view1Name="View", std::string view2Name="Functor")
 
template<class ViewType , class FunctorType >
void Intrepid2::testFloatingEquality3 (const ViewType &view, const FunctorType &functor, double relTol, double absTol, Teuchos::FancyOStream &out, bool &success, std::string view1Name="View", std::string view2Name="Functor")
 
template<class ViewType , class FunctorType >
void Intrepid2::testFloatingEquality4 (const ViewType &view, const FunctorType &functor, double relTol, double absTol, Teuchos::FancyOStream &out, bool &success, std::string view1Name="View", std::string view2Name="Functor")
 
template<class ViewType , class FunctorType >
void Intrepid2::testFloatingEquality5 (const ViewType &view, const FunctorType &functor, double relTol, double absTol, Teuchos::FancyOStream &out, bool &success, std::string view1Name="View", std::string view2Name="Functor")
 
template<class ViewType , class FunctorType >
void Intrepid2::testFloatingEquality6 (const ViewType &view, const FunctorType &functor, double relTol, double absTol, Teuchos::FancyOStream &out, bool &success, std::string view1Name="View", std::string view2Name="Functor")
 
template<class ViewType , class FunctorType >
void Intrepid2::testFloatingEquality7 (const ViewType &view, const FunctorType &functor, double relTol, double absTol, Teuchos::FancyOStream &out, bool &success, std::string view1Name="View", std::string view2Name="Functor")
 
template<class ViewType1 , class ViewType2 >
void Intrepid2::testViewFloatingEquality (const ViewType1 &view1, const ViewType2 &view2, double relTol, double absTol, Teuchos::FancyOStream &out, bool &success, std::string view1Name="View 1", std::string view2Name="View 2")
 

Variables

constexpr int Intrepid2::MAX_FAD_DERIVATIVES_FOR_TESTS = 3
 Maximum number of derivatives to track for Fad types in tests.
 
static const double Intrepid2::TEST_TOLERANCE_TIGHT = 1.e2 * std::numeric_limits<double>::epsilon()
 

Detailed Description

Utility methods for Intrepid2 unit tests.

Author
Created by N.V. Roberts.

Definition in file Intrepid2_TestUtils.hpp.

Macro Definition Documentation

#define INTREPID2_OUTPUTSCALAR_POINTSCALAR_TEST_INSTANT (   GROUP_NAME,
  TEST_NAME 
)
Value:
\
TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( GROUP_NAME, TEST_NAME, double, double ) \

Definition at line 793 of file Intrepid2_TestUtils.hpp.

#define INTREPID2_POINTSCALAR_TEST_INSTANT (   GROUP_NAME,
  TEST_NAME 
)
Value:
\
TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( GROUP_NAME, TEST_NAME, double ) \

Definition at line 789 of file Intrepid2_TestUtils.hpp.