12#include <util/mpi/MpiStructBuilder.h>
36 #define UTIL_TENSOR_EPSILON 1.0E-8
44 if ( fabs(t1.elem_[i] - t2.elem_[i]) > UTIL_TENSOR_EPSILON) {
58 if ( fabs(t1(i, j) - a2[i][j]) > UTIL_TENSOR_EPSILON) {
70 {
return (t2 == a1); }
72 #undef UTIL_TENSOR_EPSILON
78 {
return !(t1 == t2); }
82 {
return !(t1 == a2); }
86 {
return !(t2 == a1); }
94 in >> tensor.elem_[i];
105 out.setf(std::ios::scientific);
106 out.width(Tensor::Width);
107 out.precision(Tensor::Precision);
108 out << tensor.elem_[i];
117 MPI::Datatype MpiTraits<Tensor>::type = MPI::BYTE;
118 bool MpiTraits<Tensor>::hasType =
false;
123 void Tensor::commitMpiType()
125 if (!MpiTraits<Tensor>::hasType) {
126 MpiStructBuilder builder;
130 builder.setBase(&tensor);
133 builder.addMember(&tensor(i, j), MPI::DOUBLE);
136 builder.commit(MpiTraits<Tensor>::type);
137 MpiTraits<Tensor>::hasType =
true;
A Tensor represents a Cartesian tensor.
Tensor()
Default constructor.
static const Tensor Zero
Constant Tensor with all zero elements.
static void initStatic()
Call to guarantee initialization of Zero and Identity tensors.
Tensor & identity()
Set this to the identity (unity) tensor.
static const Tensor Identity
Constant idenity Tensor (diagonal diagonal elements all 1).
File containing preprocessor macros for error handling.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
const int Dimension
Dimensionality of space.
const int DimensionSq
Square of Dimensionality of space.
Utility classes for scientific computation.
bool operator==(Polynomial< T > const &a, Polynomial< T > const &b)
Equality operator for polynomials.
std::istream & operator>>(std::istream &in, Pair< Data > &pair)
Input a Pair from an istream.
std::ostream & operator<<(std::ostream &out, const Pair< Data > &pair)
Output a Pair to an ostream, without line breaks.
bool operator!=(Polynomial< T > const &a, Polynomial< T > const &b)
Inequality operator for polynomials.