MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
static MatrixSymmetric3D square(const MatrixSymmetric3D &A)
Calculates the pointwise square.
double Mdouble
Definition: GeneralDefine.h:34
MatrixSymmetric3D & operator-=(const MatrixSymmetric3D &A)
Matrix substraction.
friend std::istream & operator>>(std::istream &is, MatrixSymmetric3D &A)
Add elements to an istream.
MatrixSymmetric3D & operator/=(Mdouble a)
Scalar division.
friend std::ostream & operator<<(std::ostream &os, const MatrixSymmetric3D &A)
Add elements to an ostream.
MatrixSymmetric3D operator+(const MatrixSymmetric3D &A) const
Matrix addition.
MatrixSymmetric3D inverse() const
Computes the inverse of a matrix; exits if the inverse doesn't exist.
void setZero()
Sets all elements to zero.
MatrixSymmetric3D operator-(const MatrixSymmetric3D &A) const
Matrix substraction.
MatrixSymmetric3D & operator+=(const MatrixSymmetric3D &A)
Matrix addition.
static Mdouble determinant(const MatrixSymmetric3D &A)
Computes the determinant of a matrix.
static MatrixSymmetric3D symmetrisedDyadic(const Vec3D &a, const Vec3D &b)
Calculates the symmetrised dyadic product of two Vec3D: .
static MatrixSymmetric3D selfDyadic(const Vec3D &a)
Calculates the dyadic product of a Vec3D with itself: .
MatrixSymmetric3D operator/(Mdouble a) const
Scalar division.
MatrixSymmetric3D()
Default constructor.
friend Vec3D operator*(const MatrixSymmetric3D &A, const Vec3D &b)
Vector multiplication.
MatrixSymmetric3D getCylindricalTensorField(const Vec3D &p) const
Returns the matrix in cylindrical coordinates.
Implementation of a 3D matrix.
Definition: Matrix.h:37
Definition: Vector.h:49
Mdouble trace() const
Returns the MEAN of the diagonal elements (i.e. the trace divided by three).
static MatrixSymmetric3D sqrt(const MatrixSymmetric3D &A)
Calculates the pointwise square root.
Implementation of a 3D symmetric matrix.
Mdouble XX
The six distinctive matrix elements.