libMesh
Public Member Functions | Private Member Functions | List of all members
VectorCompareTypesTest Class Reference
Inheritance diagram for VectorCompareTypesTest:
[legend]

Public Member Functions

 LIBMESH_CPPUNIT_TEST_SUITE (VectorCompareTypesTest)
 
 CPPUNIT_TEST (testCompareTypes)
 
 CPPUNIT_TEST_SUITE_END ()
 
void testCompareTypes ()
 

Private Member Functions

template<typename T , typename T2 >
CompareTypes< T, T2 >::supertype average (const T &val1, const T2 &val2)
 

Detailed Description

Definition at line 59 of file vector_value_test.C.

Member Function Documentation

◆ average()

template<typename T , typename T2 >
CompareTypes<T, T2>::supertype VectorCompareTypesTest::average ( const T &  val1,
const T2 &  val2 
)
inlineprivate

Definition at line 70 of file vector_value_test.C.

71  {
72  return (val1 + val2) / 2;
73  }

◆ CPPUNIT_TEST()

VectorCompareTypesTest::CPPUNIT_TEST ( testCompareTypes  )

◆ CPPUNIT_TEST_SUITE_END()

VectorCompareTypesTest::CPPUNIT_TEST_SUITE_END ( )

◆ LIBMESH_CPPUNIT_TEST_SUITE()

VectorCompareTypesTest::LIBMESH_CPPUNIT_TEST_SUITE ( VectorCompareTypesTest  )

◆ testCompareTypes()

void VectorCompareTypesTest::testCompareTypes ( )
inline

Definition at line 77 of file vector_value_test.C.

References value.

78  {
79  LOG_UNIT_TEST;
80 
81  VectorValue<float> fvec;
83 
84  [[maybe_unused]] auto ftype = fvec * 1;
85  [[maybe_unused]] auto dtype = dvec * 1;
86 
87  {
88  bool assertion = std::is_same<decltype(ftype), TypeVector<float>>::value;
89  CPPUNIT_ASSERT(assertion);
90  }
91  {
92  bool assertion = std::is_same<decltype(dtype), TypeVector<double>>::value;
93  CPPUNIT_ASSERT(assertion);
94  }
95  {
96  bool assertion = std::is_same<decltype(average(ftype, ftype)), TypeVector<float>>::value;
97  CPPUNIT_ASSERT(assertion);
98  }
99  {
100  bool assertion = std::is_same<decltype(average(ftype, dtype)), TypeVector<double>>::value;
101  CPPUNIT_ASSERT(assertion);
102  }
103  {
104  bool assertion = std::is_same<decltype(average(fvec, fvec)), VectorValue<float>>::value;
105  CPPUNIT_ASSERT(assertion);
106  }
107  {
108  bool assertion = std::is_same<decltype(average(fvec, dvec)), VectorValue<double>>::value;
109  CPPUNIT_ASSERT(assertion);
110  }
111  {
112  bool assertion = std::is_same<decltype(average(fvec, dtype)), VectorValue<double>>::value;
113  CPPUNIT_ASSERT(assertion);
114  }
115  {
116  bool assertion = std::is_same<decltype(average(ftype, dvec)), VectorValue<double>>::value;
117  CPPUNIT_ASSERT(assertion);
118  }
119 #ifdef LIBMESH_HAVE_METAPHYSICL
120  {
121  typedef typename MetaPhysicL::ReplaceAlgebraicType<
122  std::vector<double>,
124  typename MetaPhysicL::ValueType<std::vector<double>>::type>::type>::type
125  ReplacedType;
126  constexpr bool assertion =
127  std::is_same<ReplacedType, std::vector<VectorValue<double>>>::value;
128  CPPUNIT_ASSERT(assertion);
129  }
130  {
131  typedef typename MetaPhysicL::ReplaceAlgebraicType<
132  std::vector<VectorValue<double>>,
134  typename MetaPhysicL::ValueType<std::vector<VectorValue<double>>>::type>::type>::type
135  ReplacedType;
136  constexpr bool assertion =
137  std::is_same<ReplacedType, std::vector<TensorValue<double>>>::value;
138  CPPUNIT_ASSERT(assertion);
139  }
140 #endif
141  }
This class defines a vector in LIBMESH_DIM dimensional Real or Complex space.
static const bool value
Definition: xdr_io.C:54

The documentation for this class was generated from the following file: