42 #if !defined(Intrepid_MiniTensor_Definitions_h)
43 #define Intrepid_MiniTensor_Definitions_h
48 #include "Sacado_mpl_disable_if.hpp"
55 typedef unsigned int Index;
60 typedef long unsigned int LongCount;
70 typedef std::complex<Real> Complex;
83 using Sacado::Promote;
84 using Sacado::mpl::lazy_disable_if;
89 static const bool value =
false;
94 static const bool value =
true;
103 template <
typename T>
105 static const bool value =
false;
108 template <
typename T>
110 static const bool value =
true;
113 template <
typename T>
119 template <
typename T>
121 static const bool value =
false;
124 template <
typename T>
126 static const bool value =
true;
129 template <
typename T>
135 template <
typename T>
137 static const bool value =
false;
140 template <
typename T>
142 static const bool value =
true;
145 template <
typename T>
151 template <
typename T>
153 static const bool value =
false;
156 template <
typename T>
158 static const bool value =
true;
161 template <
typename T>
163 static const bool value =
true;
166 template <
typename T>
168 static const bool value =
true;
171 template <
typename T>
173 static const bool value =
true;
184 struct Promote<double, Intrepid::Index> {
189 struct Promote<Intrepid::Index, double> {
194 struct Promote<float, Intrepid::Index> {
199 struct Promote<Intrepid::Index, float> {
204 struct Promote<std::complex<double>, Intrepid::Index> {
205 typedef std::complex<double> type;
209 struct Promote<Intrepid::Index, std::complex<double> > {
210 typedef std::complex<double> type;
214 struct Promote<std::complex<float>, Intrepid::Index> {
215 typedef std::complex<float> type;
219 struct Promote<Intrepid::Index, std::complex<float> > {
220 typedef std::complex<float> type;
226 template <
typename T>
227 struct ScalarType< Intrepid::Vector<T> > {
231 template <
typename T>
232 struct ValueType< Intrepid::Vector<T> > {
236 template <
typename T>
237 struct IsADType< Intrepid::Vector<T> > {
238 static bool const value = IsADType<T>::value;
241 template <
typename T>
242 struct IsScalarType< Intrepid::Vector<T> > {
243 static bool const value =
false;
246 template <
typename T>
247 struct Value< Intrepid::Vector<T> > {
248 typedef typename ValueType<T>::type value_type;
252 Intrepid::Index
const
258 for (Intrepid::Index i = 0; i < N; ++i) {
266 template <
typename T>
267 struct ScalarValue< Intrepid::Vector<T> > {
268 typedef typename ValueType<T>::type value_type;
269 typedef typename ScalarType<T>::type scalar_type;
273 Intrepid::Index
const
279 for (Intrepid::Index i = 0; i < N; ++i) {
280 v(i) = ScalarValue<value_type>::eval(x(i).val());
287 template <
typename T>
288 struct StringName< Intrepid::Vector<T> > {
292 return std::string(
"Intrepid::Vector< ") +
293 StringName<T>::eval() + std::string(
" >");
297 template <
typename T>
298 struct IsEqual< Intrepid::Vector<T> > {
299 static bool eval(T
const & x, T
const & y) {
return x == y; }
302 template <
typename T>
303 struct IsStaticallySized< Intrepid::Vector<T> > {
304 static const bool value =
false;
310 template <
typename T>
311 struct ScalarType< Intrepid::Tensor<T> > {
315 template <
typename T>
316 struct ValueType< Intrepid::Tensor<T> > {
320 template <
typename T>
321 struct IsADType< Intrepid::Tensor<T> > {
322 static bool const value = IsADType<T>::value;
325 template <
typename T>
326 struct IsScalarType< Intrepid::Tensor<T> > {
327 static bool const value =
false;
330 template <
typename T>
331 struct Value< Intrepid::Tensor<T> > {
332 typedef typename ValueType<T>::type value_type;
336 Intrepid::Index
const
342 for (Intrepid::Index i = 0; i < N; ++i) {
343 for (Intrepid::Index j = 0; j < N; ++j) {
344 v(i,j) = x(i,j).val();
352 template <
typename T>
353 struct ScalarValue< Intrepid::Tensor<T> > {
354 typedef typename ValueType<T>::type value_type;
355 typedef typename ScalarType<T>::type scalar_type;
359 Intrepid::Index
const
365 for (Intrepid::Index i = 0; i < N; ++i) {
366 for (Intrepid::Index j = 0; j < N; ++j) {
367 v(i,j) = ScalarValue<value_type>::eval(x(i,j).val());
375 template <
typename T>
376 struct StringName< Intrepid::Tensor<T> > {
380 return std::string(
"Intrepid::Tensor< ") +
381 StringName<T>::eval() + std::string(
" >");
385 template <
typename T>
386 struct IsEqual< Intrepid::Tensor<T> > {
387 static bool eval(T
const & x, T
const & y) {
return x == y; }
390 template <
typename T>
391 struct IsStaticallySized< Intrepid::Tensor<T> > {
392 static const bool value =
false;
398 template <
typename T>
399 struct ScalarType< Intrepid::Tensor3<T> > {
403 template <
typename T>
404 struct ValueType< Intrepid::Tensor3<T> > {
408 template <
typename T>
409 struct IsADType< Intrepid::Tensor3<T> > {
410 static bool const value = IsADType<T>::value;
413 template <
typename T>
414 struct IsScalarType< Intrepid::Tensor3<T> > {
415 static bool const value =
false;
418 template <
typename T>
419 struct Value< Intrepid::Tensor3<T> > {
420 typedef typename ValueType<T>::type value_type;
424 Intrepid::Index
const
430 for (Intrepid::Index i = 0; i < N; ++i) {
431 for (Intrepid::Index j = 0; j < N; ++j) {
432 for (Intrepid::Index k = 0; k < N; ++k) {
433 v(i,j,k) = x(i,j,k).val();
442 template <
typename T>
443 struct ScalarValue< Intrepid::Tensor3<T> > {
444 typedef typename ValueType<T>::type value_type;
445 typedef typename ScalarType<T>::type scalar_type;
449 Intrepid::Index
const
455 for (Intrepid::Index i = 0; i < N; ++i) {
456 for (Intrepid::Index j = 0; j < N; ++j) {
457 for (Intrepid::Index k = 0; k < N; ++k) {
458 v(i,j,k) = ScalarValue<value_type>::eval(x(i,j,k).val());
467 template <
typename T>
468 struct StringName< Intrepid::Tensor3<T> > {
472 return std::string(
"Intrepid::Tensor3< ") +
473 StringName<T>::eval() + std::string(
" >");
477 template <
typename T>
478 struct IsEqual< Intrepid::Tensor3<T> > {
479 static bool eval(T
const & x, T
const & y) {
return x == y; }
482 template <
typename T>
483 struct IsStaticallySized< Intrepid::Tensor3<T> > {
484 static const bool value =
false;
490 template <
typename T>
491 struct ScalarType< Intrepid::Tensor4<T> > {
495 template <
typename T>
496 struct ValueType< Intrepid::Tensor4<T> > {
500 template <
typename T>
501 struct IsADType< Intrepid::Tensor4<T> > {
502 static bool const value = IsADType<T>::value;
505 template <
typename T>
506 struct IsScalarType< Intrepid::Tensor4<T> > {
507 static bool const value =
false;
510 template <
typename T>
511 struct Value< Intrepid::Tensor4<T> > {
512 typedef typename ValueType<T>::type value_type;
516 Intrepid::Index
const
522 for (Intrepid::Index i = 0; i < N; ++i) {
523 for (Intrepid::Index j = 0; j < N; ++j) {
524 for (Intrepid::Index k = 0; k < N; ++k) {
525 for (Intrepid::Index l = 0; l < N; ++l) {
526 v(i,j,k,l) = x(i,j,k,l).val();
536 template <
typename T>
537 struct ScalarValue< Intrepid::Tensor4<T> > {
538 typedef typename ValueType<T>::type value_type;
539 typedef typename ScalarType<T>::type scalar_type;
543 Intrepid::Index
const
549 for (Intrepid::Index i = 0; i < N; ++i) {
550 for (Intrepid::Index j = 0; j < N; ++j) {
551 for (Intrepid::Index k = 0; k < N; ++k) {
552 for (Intrepid::Index l = 0; l < N; ++l) {
553 v(i,j,k,l) = ScalarValue<value_type>::eval(x(i,j,k,l).val());
563 template <
typename T>
564 struct StringName< Intrepid::Tensor4<T> > {
568 return std::string(
"Intrepid::Tensor4< ") +
569 StringName<T>::eval() + std::string(
" >");
573 template <
typename T>
574 struct IsEqual< Intrepid::Tensor4<T> > {
575 static bool eval(T
const & x, T
const & y) {
return x == y; }
578 template <
typename T>
579 struct IsStaticallySized< Intrepid::Tensor4<T> > {
580 static const bool value =
false;
585 #endif // Intrepid_MiniTensor_Definitions_h
Index get_dimension() const
Tensors from 1st to 4th order.