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
cppdMatrix6x6();Default constructor, sets matrix values to zero;
cppdMatrix6x6(const dMatrix6x6& rhs);Copy constructor, initializes the current matrix with a copy of
rhs.
cppstatic dMatrix6x6 ZeroTensor(void);Constructs and returns zero-valued matrix.
cppstatic dMatrix6x6 UnitTensor(void);Constructs and returns diagonal unity matrix.
Access operators
cppdouble& 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.
cppdouble* data(void); const double* data(void) const;Returns (const) pointer to the first element of the vector.
Logic, arithmetic and matrix-vector operations
cppbool operator==(const dMatrix6x6& rhs);Boolean comparison operator. Returns true if element-wise difference of the two matices is smaller than
DBL_EPSILON.
cppbool operator!=(const dMatrix6x6& rhs);Boolean comparison operator. Returns true if element-wise difference of the two matices is greater than
DBL_EPSILON.
cppdMatrix6x6 operator*(const double m) const;Returns current matrix with all components multiplied by the factor
m.
cppdMatrix6x6 operator/(const double m) const;Returns current matrix with all components divided by the factor
m.
cppdMatrix6x6 operator*(const dMatrix6x6& rhs) const;Returns dot product of two matrices.
cppdMatrix6x6 operator+(const dMatrix6x6& rhs) const;Returns the sum of two matrices.
cppdMatrix6x6 operator-(const dMatrix6x6& rhs) const;Returns the difference of two matrices.
cppdMatrix6x6 operator*(const dMatrix6x6& rhs) const;Returns dot product of two matrices.
cppdMatrix6x6& operator*=(const dMatrix6x6& rhs);Assigns the dot product of two matrices to the current matrix.
cppdMatrix6x6& operator/=(const double m);Divides all entries of the current matrix by the factor
m.
cppdMatrix6x6& operator-=(const dMatrix6x6& rhs);Subtracts matrix
rhsfrom the current matrix.
cppdMatrix6x6& operator+=(const dMatrix6x6& rhs);Adds matrix
rhsto the current matrix.
cppdMatrix6x6& operator=(const dMatrix6x6& rhs);Assigns the content of the matrix
rhsto the current matrix.
cppdMatrix6x6 Hadamard_product(const dMatrix6x6& rhs) const;Returns Hadamard (component-wise) product of two matrices.
cppdouble norm(double p);Returns Frobenius norm of the current matrix.
Data manipulation methods
cppvoid set_to_zero(void);Sets all entries to zero.
cppvoid set_to_unity(void);Sets diagonal elements to one and all off-diagonal entries to zero.
cppdMatrix6x6& invert();Inverts current matrix.
cppdMatrix6x6 inverted() const;Returns inverted copy of the current matrix.
cppdMatrix6x6& transpose();Transposes current matrix.
cppdMatrix6x6 transposed() const;Returns transposed copy of the current matrix.
cppdMatrix6x6& rotate(const dMatrix3x3& RotationMatrix);Rotates current matrix using the specified
RotationMatrix.
cppdMatrix6x6 rotated(const dMatrix3x3& RotationMatrix) const;Returns rotated copy of the current matrix using the specified
RotationMatrix.
cppdMatrix3x3 project(const dVector3& n);Returns projection onto a given direction
n
cppconst double& tensor(const int i, const int j, const int k, const int l) const;Returns matrix components using full index notations.
Container properties
cppconstexpr size_t sizeX(void) const;Returns first (X)-dimension of the stored matrix.
cppconstexpr size_t sizeY(void) const;Returns second (Y)-dimension of the stored matrix.
MPI communication methods
cppvoid pack(std::vector<double>& buffer);Packs the content of the current
dMatrix6x6object into the MPI communication buffer.
cppvoid unpack(std::vector<double>& buffer, size_t& it);Unpacks (reads) the content of the current
dMatrix6x6object from the MPI communication buffer. The existing data in the container is overwritten.
Read/write methods
cppstd::string print(void) const;Returns formatted string of the matrix values ready to print to the terminal.
cppvoid read_ASCII(std::istream& inp);Reads matrix content from the input stream.
cppvoid write_ASCII(std::ostream& outp, const int precision = 16, const char sep = ' ') const;Writes matrix content in ASCII format with the specified
precisionusingsepas entry separator into the output stream.
cppstd::string get_output_string(const int precision = 16, const char sep = ' ') const;Returns output string with matrix content in ASCII format with the specified
precisionusingsepas entry separator.
cppstd::vector<double> get_vector() const;Returns
std::vectorcontaining current matrix components.
cppstd::vector<float> get_vector_float() const;Returns
std::vector<float>containing current matrix components rounded tofloatprecision.