|
Intrepid2
|
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::host_mirror_type | 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. | |
| 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 >::host_mirror_type | 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() |
Utility methods for Intrepid2 unit tests.
Definition in file Intrepid2_TestUtils.hpp.
| #define INTREPID2_OUTPUTSCALAR_POINTSCALAR_TEST_INSTANT | ( | GROUP_NAME, | |
| TEST_NAME | |||
| ) |
Definition at line 793 of file Intrepid2_TestUtils.hpp.
| #define INTREPID2_POINTSCALAR_TEST_INSTANT | ( | GROUP_NAME, | |
| TEST_NAME | |||
| ) |
Definition at line 789 of file Intrepid2_TestUtils.hpp.
| using Intrepid2::DefaultTestDeviceType = typedef typename Kokkos::DefaultExecutionSpace::device_type |
Default Kokkos::Device to use for tests; depends on platform.
Definition at line 42 of file Intrepid2_TestUtils.hpp.
| using Intrepid2::FixedRankViewType = typedef Kokkos::View<ScalarType,DeviceType> |
Definition at line 83 of file Intrepid2_TestUtils.hpp.
| using Intrepid2::ViewType = typedef Kokkos::DynRankView<ScalarType,DeviceType> |
Definition at line 80 of file Intrepid2_TestUtils.hpp.
|
inline |
Definition at line 92 of file Intrepid2_TestUtils.hpp.
| ViewType< Scalar, DefaultTestDeviceType >::host_mirror_type Intrepid2::copyFunctorToHostView | ( | const Functor & | deviceFunctor | ) |
Copy the values for the specified functor.
Definition at line 400 of file Intrepid2_TestUtils.hpp.
References Intrepid2::copyFunctorToHostView(), and Intrepid2::getFunctorRank().
Referenced by Intrepid2::copyFunctorToHostView().
| KOKKOS_INLINE_FUNCTION bool Intrepid2::errMeetsAbsAndRelTol | ( | const Scalar1 & | s1, |
| const Scalar2 & | s2, | ||
| const double & | relTol, | ||
| const double & | absTol | ||
| ) |
Definition at line 71 of file Intrepid2_TestUtils.hpp.
|
inline |
Definition at line 98 of file Intrepid2_TestUtils.hpp.
| KOKKOS_INLINE_FUNCTION double Intrepid2::fromZeroOne | ( | double | x_zero_one | ) |
Definition at line 105 of file Intrepid2_TestUtils.hpp.
| KOKKOS_INLINE_FUNCTION double Intrepid2::fromZeroOne_dx | ( | double | dx_zero_one | ) |
Definition at line 117 of file Intrepid2_TestUtils.hpp.
|
inline |
Definition at line 369 of file Intrepid2_TestUtils.hpp.
|
inline |
Definition at line 137 of file Intrepid2_TestUtils.hpp.
|
inline |
Definition at line 219 of file Intrepid2_TestUtils.hpp.
|
inline |
Definition at line 185 of file Intrepid2_TestUtils.hpp.
| DeviceViewType::host_mirror_type Intrepid2::getHostCopy | ( | const DeviceViewType & | deviceView | ) |
Definition at line 129 of file Intrepid2_TestUtils.hpp.
|
inline |
Returns a DynRankView containing regularly-spaced points on the specified cell topology.
| [in] | cellTopo | - the cell topology on which the points will be defined. |
| [in] | numPoints_1D | - the number of points that will be defined along each edge. |
The total number of points defined will be a triangular number; if n=numPointsBase, then the point count is the nth triangular number, given by n*(n+1)/2.
Definition at line 240 of file Intrepid2_TestUtils.hpp.
References Intrepid2::getInputPointsView(), Intrepid2::PointTools::getLattice(), and Intrepid2::PointTools::getLatticeSize().
Referenced by Intrepid2::getInputPointsView().
|
inline |
Definition at line 293 of file Intrepid2_TestUtils.hpp.
|
inline |
Definition at line 204 of file Intrepid2_TestUtils.hpp.
| void Intrepid2::printFunctor | ( | const FunctorType & | functor, |
| std::ostream & | out, | ||
| const std::string & | functorName = "" |
||
| ) |
Definition at line 465 of file Intrepid2_TestUtils.hpp.
| void Intrepid2::printFunctor1 | ( | const FunctorType & | functor, |
| std::ostream & | out, | ||
| const std::string & | functorName = "" |
||
| ) |
Definition at line 505 of file Intrepid2_TestUtils.hpp.
| void Intrepid2::printFunctor2 | ( | const FunctorType & | functor, |
| std::ostream & | out, | ||
| const std::string & | functorName = "" |
||
| ) |
Definition at line 512 of file Intrepid2_TestUtils.hpp.
| void Intrepid2::printFunctor3 | ( | const FunctorType & | functor, |
| std::ostream & | out, | ||
| const std::string & | functorName = "" |
||
| ) |
Definition at line 519 of file Intrepid2_TestUtils.hpp.
| void Intrepid2::printFunctor4 | ( | const FunctorType & | functor, |
| std::ostream & | out, | ||
| const std::string & | functorName = "" |
||
| ) |
Definition at line 526 of file Intrepid2_TestUtils.hpp.
| void Intrepid2::printFunctor5 | ( | const FunctorType & | functor, |
| std::ostream & | out, | ||
| const std::string & | functorName = "" |
||
| ) |
Definition at line 533 of file Intrepid2_TestUtils.hpp.
| void Intrepid2::printFunctor6 | ( | const FunctorType & | functor, |
| std::ostream & | out, | ||
| const std::string & | functorName = "" |
||
| ) |
Definition at line 540 of file Intrepid2_TestUtils.hpp.
| void Intrepid2::printFunctor7 | ( | const FunctorType & | functor, |
| std::ostream & | out, | ||
| const std::string & | functorName = "" |
||
| ) |
Definition at line 547 of file Intrepid2_TestUtils.hpp.
| void Intrepid2::printView | ( | const View & | view, |
| std::ostream & | out, | ||
| const std::string & | viewName = "" |
||
| ) |
Definition at line 554 of file Intrepid2_TestUtils.hpp.
| 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.
Definition at line 58 of file Intrepid2_TestUtils.hpp.
References Intrepid2::relErrMeetsTol(), and Intrepid2::smallNumber().
Referenced by Intrepid2::relErrMeetsTol().
| const Teuchos::ScalarTraits< Scalar >::magnitudeType Intrepid2::smallNumber | ( | ) |
Use Teuchos small number determination on host; pass this to Intrepid2::relErr() on device.
Definition at line 48 of file Intrepid2_TestUtils.hpp.
References Intrepid2::smallNumber().
Referenced by Intrepid2::relErrMeetsTol(), and Intrepid2::smallNumber().
| 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" |
||
| ) |
Definition at line 587 of file Intrepid2_TestUtils.hpp.
| 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.
Definition at line 596 of file Intrepid2_TestUtils.hpp.
References Intrepid2::getFunctorRank().
| 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" |
||
| ) |
Definition at line 696 of file Intrepid2_TestUtils.hpp.
| 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" |
||
| ) |
Definition at line 703 of file Intrepid2_TestUtils.hpp.
| 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" |
||
| ) |
Definition at line 710 of file Intrepid2_TestUtils.hpp.
| 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" |
||
| ) |
Definition at line 717 of file Intrepid2_TestUtils.hpp.
| 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" |
||
| ) |
Definition at line 724 of file Intrepid2_TestUtils.hpp.
| 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" |
||
| ) |
Definition at line 731 of file Intrepid2_TestUtils.hpp.
| 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" |
||
| ) |
Definition at line 738 of file Intrepid2_TestUtils.hpp.
| 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" |
||
| ) |
Definition at line 745 of file Intrepid2_TestUtils.hpp.
| KOKKOS_INLINE_FUNCTION double Intrepid2::toZeroOne | ( | double | x_minus_one_one | ) |
Definition at line 111 of file Intrepid2_TestUtils.hpp.
| KOKKOS_INLINE_FUNCTION double Intrepid2::toZeroOne_dx | ( | double | dx_minus_one_one | ) |
Definition at line 123 of file Intrepid2_TestUtils.hpp.
| KOKKOS_INLINE_FUNCTION bool Intrepid2::valuesAreSmall | ( | const ScalarType & | a, |
| const ScalarType & | b, | ||
| const double & | epsilon | ||
| ) |
Definition at line 86 of file Intrepid2_TestUtils.hpp.
|
constexpr |
Maximum number of derivatives to track for Fad types in tests.
Definition at line 34 of file Intrepid2_TestUtils.hpp.
|
static |
Definition at line 76 of file Intrepid2_TestUtils.hpp.