Skip to content

dMatrix6x6

dMatrix6x6 is a static storage container which stores a six by six matrix of double values. It is used to store stiffness and compliance tensors in Voigt notations, as a storage unit in Storage3D container.

The data inside of the dMatrix6x6 container is manipulated using a number of dedicated methods:

Constructors

cpp
dMatrix6x6();

Default constructor, sets matrix values to zero;

cpp
dMatrix6x6(const dMatrix6x6& rhs);

Copy constructor, initializes the current matrix with a copy of rhs.

cpp
static dMatrix6x6 ZeroTensor(void);

Constructs and returns zero-valued matrix.

cpp
static dMatrix6x6 UnitTensor(void);

Constructs and returns diagonal unity matrix.

Access operators

cpp
double& operator()(const size_t i, const size_t j);
double const& operator()(const size_t i, const size_t j) const;

Return (const) reference to the element i,j.

cpp
double* data(void);
const double* data(void) const;

Returns (const) pointer to the first element of the vector.

Logic, arithmetic and matrix-vector operations

cpp
bool operator==(const dMatrix6x6& rhs);

Boolean comparison operator. Returns true if element-wise difference of the two matices is smaller than DBL_EPSILON.

cpp
bool operator!=(const dMatrix6x6& rhs);

Boolean comparison operator. Returns true if element-wise difference of the two matices is greater than DBL_EPSILON.

cpp
dMatrix6x6 operator*(const double m) const;

Returns current matrix with all components multiplied by the factor m.

cpp
dMatrix6x6 operator/(const double m) const;

Returns current matrix with all components divided by the factor m.

cpp
dMatrix6x6 operator*(const dMatrix6x6& rhs) const;

Returns dot product of two matrices.

cpp
dMatrix6x6 operator+(const dMatrix6x6& rhs) const;

Returns the sum of two matrices.

cpp
dMatrix6x6 operator-(const dMatrix6x6& rhs) const;

Returns the difference of two matrices.

cpp
dMatrix6x6 operator*(const dMatrix6x6& rhs) const;

Returns dot product of two matrices.

cpp
dMatrix6x6& operator*=(const dMatrix6x6& rhs);

Assigns the dot product of two matrices to the current matrix.

cpp
dMatrix6x6& operator/=(const double m);

Divides all entries of the current matrix by the factor m.

cpp
dMatrix6x6& operator-=(const dMatrix6x6& rhs);

Subtracts matrix rhs from the current matrix.

cpp
dMatrix6x6& operator+=(const dMatrix6x6& rhs);

Adds matrix rhs to the current matrix.

cpp
dMatrix6x6& operator=(const dMatrix6x6& rhs);

Assigns the content of the matrix rhs to the current matrix.

cpp
dMatrix6x6 Hadamard_product(const dMatrix6x6& rhs) const;

Returns Hadamard (component-wise) product of two matrices.

cpp
double norm(double p);

Returns Frobenius norm of the current matrix.

Data manipulation methods

cpp
void set_to_zero(void);

Sets all entries to zero.

cpp
void set_to_unity(void);

Sets diagonal elements to one and all off-diagonal entries to zero.

cpp
dMatrix6x6& invert();

Inverts current matrix.

cpp
dMatrix6x6 inverted() const;

Returns inverted copy of the current matrix.

cpp
dMatrix6x6& transpose();

Transposes current matrix.

cpp
dMatrix6x6 transposed() const;

Returns transposed copy of the current matrix.

cpp
dMatrix6x6& rotate(const dMatrix3x3& RotationMatrix);

Rotates current matrix using the specified RotationMatrix.

cpp
dMatrix6x6 rotated(const dMatrix3x3& RotationMatrix) const;

Returns rotated copy of the current matrix using the specified RotationMatrix.

cpp
dMatrix3x3 project(const dVector3& n);

Returns projection onto a given direction n

cpp
const double& tensor(const int i, const int j, const int k, const int l) const;

Returns matrix components using full index notations.

Container properties

cpp
constexpr size_t sizeX(void) const;

Returns first (X)-dimension of the stored matrix.

cpp
constexpr size_t sizeY(void) const;

Returns second (Y)-dimension of the stored matrix.

MPI communication methods

cpp
void pack(std::vector<double>& buffer);

Packs the content of the current dMatrix6x6 object into the MPI communication buffer.

cpp
void unpack(std::vector<double>& buffer, size_t& it);

Unpacks (reads) the content of the current dMatrix6x6 object from the MPI communication buffer. The existing data in the container is overwritten.

Read/write methods

cpp
std::string print(void) const;

Returns formatted string of the matrix values ready to print to the terminal.

cpp
void read_ASCII(std::istream& inp);

Reads matrix content from the input stream.

cpp
void write_ASCII(std::ostream& outp, const int precision = 16, const char sep = ' ') const;

Writes matrix content in ASCII format with the specified precision using sep as entry separator into the output stream.

cpp
std::string get_output_string(const int precision = 16, const char sep = ' ') const;

Returns output string with matrix content in ASCII format with the specified precision using sep as entry separator.

cpp
std::vector<double> get_vector() const;

Returns std::vector containing current matrix components.

cpp
std::vector<float> get_vector_float() const;

Returns std::vector<float> containing current matrix components rounded to float precision.

Released under the GNU GPLv3 License.