revision: v0.14
MatrixSymmetric.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2020, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 #ifndef MATRIXSYMMETRIC_H
27 #define MATRIXSYMMETRIC_H
28 
29 #include <cmath>
30 #include <sstream>
31 #include "Matrix.h"
32 
37 {
38 public:
42  Mdouble XX, XY, XZ, YY, YZ, ZZ;
43 
47  explicit operator Matrix3D() const;
48 
53 
58 
62  void setZero();
63 
67  Mdouble trace() const;
68 
73 
78 
83 
88 
92  friend Vec3D operator*(const MatrixSymmetric3D& A, const Vec3D& b);
93 
98 
103 
107  friend std::ostream& operator<<(std::ostream& os, const MatrixSymmetric3D& A);
108 
112  friend std::istream& operator>>(std::istream& is, MatrixSymmetric3D& A);
113 
118 
123 
128 
133 
137  static MatrixSymmetric3D sqrt(const MatrixSymmetric3D& A);
138 
142  static MatrixSymmetric3D selfDyadic(const Vec3D& a);
143 
147  static MatrixSymmetric3D symmetrisedDyadic(const Vec3D& a, const Vec3D& b);
148 
153 
157  MatrixSymmetric3D inverse() const;
158 
162  static Mdouble determinant(const MatrixSymmetric3D& A);
163 
168 };
169 
170 #endif
MatrixSymmetric3D::inverse
MatrixSymmetric3D inverse() const
Computes the inverse of a matrix; exits if the inverse doesn't exist.
Definition: MatrixSymmetric.cc:298
MatrixSymmetric3D::operator>>
friend std::istream & operator>>(std::istream &is, MatrixSymmetric3D &A)
Add elements to an istream.
Definition: MatrixSymmetric.cc:178
mathsFunc::square
T square(const T val)
squares a number
Definition: ExtendedMath.h:106
operator*
Vec3D operator*(const MatrixSymmetric3D &A, const Vec3D &b)
Definition: MatrixSymmetric.cc:132
MatrixSymmetric3D::operator*
friend Vec3D operator*(const MatrixSymmetric3D &A, const Vec3D &b)
Vector multiplication.
Definition: MatrixSymmetric.cc:132
MatrixSymmetric3D::operator+
MatrixSymmetric3D operator+(const MatrixSymmetric3D &A) const
Matrix addition.
Definition: MatrixSymmetric.cc:90
logger
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
MatrixSymmetric3D::operator-
MatrixSymmetric3D operator-(const MatrixSymmetric3D &A) const
Matrix substraction.
Definition: MatrixSymmetric.cc:100
Vec3D::X
Mdouble X
the vector components
Definition: Vector.h:65
Matrix.h
XZ
@ XZ
Definition: StatisticsVector.h:42
YZ
@ YZ
Definition: StatisticsVector.h:42
Vec3D
Definition: Vector.h:50
MatrixSymmetric3D::operator+=
MatrixSymmetric3D & operator+=(const MatrixSymmetric3D &A)
Matrix addition.
Definition: MatrixSymmetric.cc:189
A
@ A
Definition: StatisticsVector.h:42
MatrixSymmetric3D::setZero
void setZero()
Sets all elements to zero.
Definition: MatrixSymmetric.cc:70
Matrix3D
Implementation of a 3D matrix.
Definition: Matrix.h:38
double
MatrixSymmetric3D::getCylindricalTensorField
MatrixSymmetric3D getCylindricalTensorField(const Vec3D &p) const
Returns the matrix in cylindrical coordinates.
Definition: MatrixSymmetric.cc:326
MatrixSymmetric3D::operator/=
MatrixSymmetric3D & operator/=(Mdouble a)
Scalar division.
Definition: MatrixSymmetric.cc:221
MatrixSymmetric3D::operator<<
friend std::ostream & operator<<(std::ostream &os, const MatrixSymmetric3D &A)
Add elements to an ostream.
Definition: MatrixSymmetric.cc:166
MatrixSymmetric3D::XZ
Mdouble XZ
Definition: MatrixSymmetric.h:42
MatrixSymmetric3D::trace
Mdouble trace() const
Returns the MEAN of the diagonal elements (i.e. the trace divided by three).
Definition: MatrixSymmetric.cc:80
MatrixSymmetric3D::operator/
MatrixSymmetric3D operator/(Mdouble a) const
Scalar division.
Definition: MatrixSymmetric.cc:155
MatrixSymmetric3D::ZZ
Mdouble ZZ
Definition: MatrixSymmetric.h:42
MatrixSymmetric3D::symmetrisedDyadic
static MatrixSymmetric3D symmetrisedDyadic(const Vec3D &a, const Vec3D &b)
Calculates the symmetrised dyadic product of two Vec3D: .
Definition: MatrixSymmetric.cc:277
MatrixSymmetric3D::selfDyadic
static MatrixSymmetric3D selfDyadic(const Vec3D &a)
Calculates the dyadic product of a Vec3D with itself: .
Definition: MatrixSymmetric.cc:263
MatrixSymmetric3D::XY
Mdouble XY
Definition: MatrixSymmetric.h:42
operator<<
std::ostream & operator<<(std::ostream &os, const MatrixSymmetric3D &A)
Definition: MatrixSymmetric.cc:166
operator>>
std::istream & operator>>(std::istream &is, MatrixSymmetric3D &A)
Definition: MatrixSymmetric.cc:178
MatrixSymmetric3D::sqrt
static MatrixSymmetric3D sqrt(const MatrixSymmetric3D &A)
Calculates the pointwise square root.
Definition: MatrixSymmetric.cc:250
Vec3D::Y
Mdouble Y
Definition: Vector.h:65
MatrixSymmetric3D::XX
Mdouble XX
The six distinctive matrix elements.
Definition: MatrixSymmetric.h:42
MatrixSymmetric3D::square
static MatrixSymmetric3D square(const MatrixSymmetric3D &A)
Calculates the pointwise square.
Definition: MatrixSymmetric.cc:238
MatrixSymmetric3D::YZ
Mdouble YZ
Definition: MatrixSymmetric.h:42
MatrixSymmetric3D
Implementation of a 3D symmetric matrix.
Definition: MatrixSymmetric.h:37
MatrixSymmetric3D::determinant
static Mdouble determinant(const MatrixSymmetric3D &A)
Computes the determinant of a matrix.
Definition: MatrixSymmetric.cc:313
Vec3D::Z
Mdouble Z
Definition: Vector.h:65
ExtendedMath.h
MatrixSymmetric.h
MatrixSymmetric3D::operator-=
MatrixSymmetric3D & operator-=(const MatrixSymmetric3D &A)
Matrix substraction.
Definition: MatrixSymmetric.cc:205
XY
@ XY
Definition: StatisticsVector.h:42
MatrixSymmetric3D::MatrixSymmetric3D
MatrixSymmetric3D()
Default constructor.
Definition: MatrixSymmetric.cc:42
MatrixSymmetric3D::YY
Mdouble YY
Definition: MatrixSymmetric.h:42