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;
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>
231 template <
typename T>
236 template <
typename T>
238 static bool const value = IsADType<T>::value;
241 template <
typename T>
243 static bool const value =
false;
246 template <
typename 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>
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>
292 return std::string(
"Intrepid::Vector< ") +
293 StringName<T>::eval() + std::string(
" >");
297 template <
typename T>
299 static bool eval(T
const & x, T
const & y) {
return x == y; }
302 template <
typename T>
304 static const bool value =
false;
310 template <
typename T>
315 template <
typename T>
320 template <
typename T>
322 static bool const value = IsADType<T>::value;
325 template <
typename T>
327 static bool const value =
false;
330 template <
typename 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>
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>
380 return std::string(
"Intrepid::Tensor< ") +
381 StringName<T>::eval() + std::string(
" >");
385 template <
typename T>
387 static bool eval(T
const & x, T
const & y) {
return x == y; }
390 template <
typename T>
392 static const bool value =
false;
398 template <
typename T>
403 template <
typename T>
408 template <
typename T>
410 static bool const value = IsADType<T>::value;
413 template <
typename T>
415 static bool const value =
false;
418 template <
typename 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>
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>
472 return std::string(
"Intrepid::Tensor3< ") +
473 StringName<T>::eval() + std::string(
" >");
477 template <
typename T>
479 static bool eval(T
const & x, T
const & y) {
return x == y; }
482 template <
typename T>
484 static const bool value =
false;
490 template <
typename T>
495 template <
typename T>
500 template <
typename T>
502 static bool const value = IsADType<T>::value;
505 template <
typename T>
507 static bool const value =
false;
510 template <
typename 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>
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>
568 return std::string(
"Intrepid::Tensor4< ") +
569 StringName<T>::eval() + std::string(
" >");
573 template <
typename T>
575 static bool eval(T
const & x, T
const & y) {
return x == y; }
578 template <
typename T>
580 static const bool value =
false;
585 #endif // Intrepid_MiniTensor_Definitions_h
Index get_dimension() const
Tensors from 1st to 4th order.