12#include <util/mpi/MpiStructBuilder.h>
31 UTIL_THROW(
"Tensor::initStatic called more than once");
38 #define UTIL_TENSOR_EPSILON 1.0E-8
46 if ( fabs(t1.elem_[i] - t2.elem_[i]) > UTIL_TENSOR_EPSILON) {
60 if ( fabs(t1(i, j) - a2[i][j]) > UTIL_TENSOR_EPSILON) {
72 {
return (t2 == a1); }
74 #undef UTIL_TENSOR_EPSILON
80 {
return !(t1 == t2); }
84 {
return !(t1 == a2); }
88 {
return !(t2 == a1); }
96 in >> tensor.elem_[i];
107 out.setf(std::ios::scientific);
108 out.width(Tensor::Width);
109 out.precision(Tensor::Precision);
110 out << tensor.elem_[i];
135 builder.
addMember(&tensor(i, j), MPI::DOUBLE);
A MpiStructBuilder objects is used to create an MPI Struct datatype.
void addMember(void *memberAddress, MPI::Datatype type, int count=1)
Add a new member variable to the type map.
void setBase(void *objectAddress)
Set address of an class instance.
void commit(MPI::Datatype &newType)
Build and commit a user-defined MPI Struct datatype.
A Tensor represents a Cartesian tensor.
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 void commitMpiType()
Commit MPI datatype MpiTraits<Tensor>::type.
static const Tensor Identity
Constant idenity Tensor (diagonal diagonal elements all 1).
File containing preprocessor macros for error handling.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
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.