Stokhos Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
Classes | Namespaces | Macros
Stokhos_SacadoMPVectorUnitTest.cpp File Reference
#include "Teuchos_UnitTestHarness.hpp"
#include "Teuchos_TestingHelpers.hpp"
#include "Teuchos_UnitTestRepository.hpp"
#include "Teuchos_GlobalMPISession.hpp"
#include "Stokhos_Sacado_Kokkos_MP_Vector.hpp"
#include "Stokhos_UnitTestHelpers.hpp"
#include "Kokkos_Core.hpp"
#include "Kokkos_Complex.hpp"
Include dependency graph for Stokhos_SacadoMPVectorUnitTest.cpp:

Go to the source code of this file.

Classes

struct  UnitTestSetup< VecType, FadType >
 

Namespaces

namespace  DynamicVecTest
 
namespace  DynamicStridedVecTest
 
namespace  StaticVecTest
 
namespace  StaticFixedVecTest
 
namespace  StaticFixedVecTest::Double
 
namespace  StaticFixedVecTest::Complex_std
 
namespace  StaticFixedVecTest::Complex_Kokkos
 

Macros

#define UNARY_UNIT_TEST(VEC, SCALAR_T, OP, OPNAME, USING_OP)
 
#define BINARY_UNIT_TEST(VEC, SCALAR_T, OP, OPNAME)
 
#define BINARYFUNC_UNIT_TEST(VEC, SCALAR_T, OP, SOP, USING_SOP, OPNAME)
 
#define OPASSIGN_UNIT_TEST(VEC, SCALAR_T, OP, OPNAME)
 
#define SAXPY_UNIT_TEST(VEC, SCALAR_T)
 
#define TERNARY_UNIT_TEST(VEC, SCALAR_T)
 
#define VECTOR_UNIT_TESTS_ANY_TYPE(VEC, SCALAR_T)
 
#define VECTOR_UNIT_TESTS_SFS_ANY_VALUE_TYPE(SCALAR_T)
 
#define VECTOR_UNIT_TESTS_COMPLEX_TYPE(VEC, SCALAR_T)
 
#define VECTOR_UNIT_TESTS_REAL_TYPE(VEC, SCALAR_T)
 
#define TEST_DYNAMIC_STORAGE(__storage_type__, __vec_type__, __scalar_type__, __macro_for_tests__)
 
#define TEST_STATIC_STORAGE(__storage_type__, __vec_type__, __scalar_type__, __scalar_type_name__, __storage_size__, __macro_for_tests__)
 
#define TEST_STATIC_FIXED_STORAGE(__storage_type__, __vec_type__, __scalar_type__, __scalar_type_name__, __storage_size__, __macro_for_tests__)
 

Macro Definition Documentation

◆ UNARY_UNIT_TEST

#define UNARY_UNIT_TEST (   VEC,
  SCALAR_T,
  OP,
  OPNAME,
  USING_OP 
)

Common series of test for any unary operator.

Definition at line 97 of file Stokhos_SacadoMPVectorUnitTest.cpp.

◆ BINARY_UNIT_TEST

#define BINARY_UNIT_TEST (   VEC,
  SCALAR_T,
  OP,
  OPNAME 
)

Definition at line 136 of file Stokhos_SacadoMPVectorUnitTest.cpp.

◆ BINARYFUNC_UNIT_TEST

#define BINARYFUNC_UNIT_TEST (   VEC,
  SCALAR_T,
  OP,
  SOP,
  USING_SOP,
  OPNAME 
)

Definition at line 230 of file Stokhos_SacadoMPVectorUnitTest.cpp.

◆ OPASSIGN_UNIT_TEST

#define OPASSIGN_UNIT_TEST (   VEC,
  SCALAR_T,
  OP,
  OPNAME 
)

Definition at line 352 of file Stokhos_SacadoMPVectorUnitTest.cpp.

◆ SAXPY_UNIT_TEST

#define SAXPY_UNIT_TEST (   VEC,
  SCALAR_T 
)

Definition at line 396 of file Stokhos_SacadoMPVectorUnitTest.cpp.

◆ TERNARY_UNIT_TEST

#define TERNARY_UNIT_TEST (   VEC,
  SCALAR_T 
)
Value:
TEUCHOS_UNIT_TEST( VEC##_##SCALAR_T, ternay) { \
UTS setup; \
UTS::vec_type u = std::sin(setup.x); \
UTS::vec_type v = -std::sin(setup.x); \
u = u >= 0 ? -u : u; \
success = compareVecs(u, "u", v, "v", \
setup.rtol, setup.atol, out); \
}
TEUCHOS_UNIT_TEST(tAdaptivityManager, test_interface)
UnitTestSetup< Kokkos::Cuda > setup

Definition at line 442 of file Stokhos_SacadoMPVectorUnitTest.cpp.

◆ VECTOR_UNIT_TESTS_ANY_TYPE

#define VECTOR_UNIT_TESTS_ANY_TYPE (   VEC,
  SCALAR_T 
)

Default series of tests to perform for any type. The set of operators should make sense for both real and complex types.

Definition at line 456 of file Stokhos_SacadoMPVectorUnitTest.cpp.

◆ VECTOR_UNIT_TESTS_SFS_ANY_VALUE_TYPE

#define VECTOR_UNIT_TESTS_SFS_ANY_VALUE_TYPE (   SCALAR_T)
Value:
TEUCHOS_UNIT_TEST( StaticFixedVector##_##SCALAR_T, initializer_list_constructor_partial ) {\
UTS setup; \
UTS::vec_type u{ 1.0}; \
UTS::vec_type v(setup.sz, 1.0); \
success = compareVecs(u, "u", v, "v", \
setup.rtol, setup.atol, out); \
} \
TEUCHOS_UNIT_TEST( StaticFixedVector##_##SCALAR_T, initializer_list_constructor_empty ) { \
UTS::vec_type u{ std::initializer_list<typename UTS::value_type>()}; \
UTS::vec_type v(setup.sz, 0.0); \
success = compareVecs(u, "u", v, "v", \
setup.rtol, setup.atol, out); \
}
UnitTestSetup< pce_type > UTS
bool compareVecs(const VectorType1 &a1, const std::string &a1_name, const VectorType2 &a2, const std::string &a2_name, const ValueType &rel_tol, const ValueType &abs_tol, Teuchos::FancyOStream &out)

Default series of tests to perform for SFS for any value type.

Definition at line 530 of file Stokhos_SacadoMPVectorUnitTest.cpp.

◆ VECTOR_UNIT_TESTS_COMPLEX_TYPE

#define VECTOR_UNIT_TESTS_COMPLEX_TYPE (   VEC,
  SCALAR_T 
)
Value:
/* Run the series of tests for any type. */ \
VECTOR_UNIT_TESTS_ANY_TYPE(VEC,SCALAR_T)

Series of tests to run for complex type. It will run the series of tests for any type.

Definition at line 549 of file Stokhos_SacadoMPVectorUnitTest.cpp.

◆ VECTOR_UNIT_TESTS_REAL_TYPE

#define VECTOR_UNIT_TESTS_REAL_TYPE (   VEC,
  SCALAR_T 
)
Value:
/* Run the series of tests for any type. */ \
VECTOR_UNIT_TESTS_ANY_TYPE(VEC,SCALAR_T) \
/* Operator cbrt not supported for complex type but supported for real type. */ \
UNARY_UNIT_TEST(VEC, SCALAR_T, cbrt , Cbrt, using std::cbrt;) \
/* Operator atan2 not supported for complex type but supported for real type. */ \
BINARYFUNC_UNIT_TEST(VEC, SCALAR_T, atan2, atan2, using std::atan2;, ATan2) \
/* Operators min and max are not supported for complex type. */ \
BINARYFUNC_UNIT_TEST(VEC, SCALAR_T, max , max , using std::max ;, Max) \
BINARYFUNC_UNIT_TEST(VEC, SCALAR_T, min , min , using std::min ;, Min) \
/* Ternary test uses 'operator<' that is not defined for complex type. */ \
TERNARY_UNIT_TEST(VEC, SCALAR_T)
#define BINARYFUNC_UNIT_TEST(VEC, SCALAR_T, OP, SOP, USING_SOP, OPNAME)
#define TERNARY_UNIT_TEST(VEC, SCALAR_T)

Series of tests to run for real type. It will run the series of tests for any type, as well as tests that don't work or don't make sense for complex type.

Definition at line 558 of file Stokhos_SacadoMPVectorUnitTest.cpp.

◆ TEST_DYNAMIC_STORAGE

#define TEST_DYNAMIC_STORAGE (   __storage_type__,
  __vec_type__,
  __scalar_type__,
  __macro_for_tests__ 
)
Value:
typedef Kokkos::DefaultExecutionSpace execution_space; \
typedef Stokhos::__storage_type__<int,__scalar_type__,execution_space> storage_type; \
typedef UnitTestSetup<vec_type> UTS; \
__macro_for_tests__(__vec_type__,__scalar_type__)
Stokhos::StandardStorage< int, double > storage_type
Kokkos::DefaultExecutionSpace execution_space

Common test structure for dynamic storage.

Definition at line 574 of file Stokhos_SacadoMPVectorUnitTest.cpp.

◆ TEST_STATIC_STORAGE

#define TEST_STATIC_STORAGE (   __storage_type__,
  __vec_type__,
  __scalar_type__,
  __scalar_type_name__,
  __storage_size__,
  __macro_for_tests__ 
)
Value:
typedef ::Kokkos::DefaultExecutionSpace execution_space; \
typedef ::Stokhos::__storage_type__<int,__scalar_type__,__storage_size__,execution_space> storage_type; \
typedef ::Sacado::MP::Vector<storage_type> vec_type; \
typedef UnitTestSetup<vec_type> UTS; \
__macro_for_tests__(__vec_type__,__scalar_type_name__)

Common test structure for static storage.

Definition at line 594 of file Stokhos_SacadoMPVectorUnitTest.cpp.

◆ TEST_STATIC_FIXED_STORAGE

#define TEST_STATIC_FIXED_STORAGE (   __storage_type__,
  __vec_type__,
  __scalar_type__,
  __scalar_type_name__,
  __storage_size__,
  __macro_for_tests__ 
)
Value:
TEST_STATIC_STORAGE(__storage_type__,__vec_type__,__scalar_type__,__scalar_type_name__,__storage_size__,__macro_for_tests__) \
VECTOR_UNIT_TESTS_SFS_ANY_VALUE_TYPE(__scalar_type_name__)
#define TEST_STATIC_STORAGE(__storage_type__, __vec_type__, __scalar_type__, __scalar_type_name__, __storage_size__, __macro_for_tests__)

Common test structure for static fixed storage.

Definition at line 609 of file Stokhos_SacadoMPVectorUnitTest.cpp.