|
Implementation of a 3D matrix. More...
#include <Matrix.h>
Public Member Functions | |
Matrix3D () | |
default constructor More... | |
Matrix3D (Mdouble xx, Mdouble xy, Mdouble xz, Mdouble yx, Mdouble yy, Mdouble yz, Mdouble zx, Mdouble zy, Mdouble zz) | |
Alternative constructor, which let you define all elements. More... | |
Matrix3D (const SmallMatrix< 3, 3 > &matrix) | |
Alternative constructor, which takes a matrix of the same size. More... | |
void | setZero () |
Sets all elements to zero. More... | |
double | trace () const |
Sum of the diagonal elements. More... | |
Vec3D | diag () const |
The diagonal elements. More... | |
double | deviator () const |
Deviator. More... | |
Matrix3D | operator+ (const Matrix3D &A) const |
Matrix addition. More... | |
Matrix3D | operator- (const Matrix3D &A) const |
Matrix subtraction. More... | |
Matrix3D | operator+ (Mdouble a) const |
Scalar addition. More... | |
Matrix3D | operator- (Mdouble a) const |
Scalar subtraction. More... | |
Matrix3D | operator* (Mdouble a) const |
Scalar multiplication. More... | |
Vec3D | operator* (const Vec3D &a) const |
Vector multiplication. More... | |
Matrix3D | operator* (const Matrix3D &a) const |
Matrix multiplication. More... | |
Matrix3D | operator/ (Mdouble a) const |
Scalar division. More... | |
Matrix3D & | operator+= (const Matrix3D &A) |
Matrix addition. More... | |
Matrix3D & | operator-= (const Matrix3D &A) |
Matrix substraction. More... | |
Matrix3D & | operator/= (Mdouble a) |
Scalar division. More... | |
Vec3D | ldivide (const Vec3D &b) |
A.ldivide(b) computes the solution x to A*x=b. More... | |
Matrix3D | getCylindricalTensorField (const Vec3D &p) const |
Returns the matrix in cylindrical coordinates. More... | |
Static Public Member Functions | |
static Matrix3D | square (const Matrix3D &A) |
Calculates the pointwise square. More... | |
static Matrix3D | sqrt (const Matrix3D &A) |
Calculates the pointwise square root. More... | |
static Matrix3D | dyadic (const Vec3D &a, const Vec3D &b) |
Calculates the dyadic product of a two Vec3D: \(a \otimes b\). More... | |
static Matrix3D | cross (const Vec3D &a, const Matrix3D &b) |
'Special' cross product; CP of vector with each column of a matrix More... | |
static Matrix3D | inverse (const Matrix3D &A) |
Computes the inverse of a matrix. More... | |
Public Attributes | |
Mdouble | XX |
all nine matrix elements More... | |
Mdouble | XY |
Mdouble | XZ |
Mdouble | YX |
Mdouble | YY |
Mdouble | YZ |
Mdouble | ZX |
Mdouble | ZY |
Mdouble | ZZ |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Matrix3D &A) |
Add elements to ostream. More... | |
std::istream & | operator>> (std::istream &is, Matrix3D &A) |
Add elements to istream. More... | |
Implementation of a 3D matrix.
Matrix3D::Matrix3D | ( | ) |
default constructor
default constructor, which is empty (i.e., only creates the object)
References setZero().
Referenced by cross(), dyadic(), getCylindricalTensorField(), operator*(), operator+(), operator-(), operator/(), sqrt(), and square().
Matrix3D::Matrix3D | ( | Mdouble | xx, |
Mdouble | xy, | ||
Mdouble | xz, | ||
Mdouble | yx, | ||
Mdouble | yy, | ||
Mdouble | yz, | ||
Mdouble | zx, | ||
Mdouble | zy, | ||
Mdouble | zz | ||
) |
Alternative constructor, which let you define all elements.
Alternative constructor. Let's you specify ALL 9 elements of the 3x3 matrix.
[in] | [all] | xx/xy/xz /yx/yy/yz /zx/zy/zz are all nine elements (left-to-right, top-to-bottom) of the 3D matrix. |
Matrix3D::Matrix3D | ( | const SmallMatrix< 3, 3 > & | matrix | ) |
Alternative constructor, which takes a matrix of the same size.
'Special' cross product; CP of vector with each column of a matrix
Returns a matrix, who's columns are the inner product of a given vector with the corresponding columns of a given matrix
[in] | a | vector |
[in] | B | matrix |
References Matrix3D(), Vec3D::X, XX, XY, XZ, Vec3D::Y, YX, YY, YZ, Vec3D::Z, ZX, ZY, and ZZ.
Mdouble Matrix3D::deviator | ( | ) | const |
Deviator.
Returns an invariant of the deviatoric tensor, scaled such that it is equal to shear stress for the stress tensor.
References Global_Physical_Variables::P, mathsFunc::square(), trace(), XX, XY, XZ, YX, YY, YZ, ZX, ZY, and ZZ.
Vec3D Matrix3D::diag | ( | ) | const |
Calculates the dyadic product of a two Vec3D: \(a \otimes b\).
Dyadic product of two vectors
[in] | a | first vector |
[in] | b | second vector |
References Matrix3D(), Vec3D::X, Vec3D::Y, and Vec3D::Z.
Referenced by CGFields::GradVelocityField::addParticleDifferentialStatistics(), DPMBase::getKineticStress(), DPMBase::getStaticStress(), main(), and CGFields::StandardFields::setFields().
Returns the matrix in cylindrical coordinates.
Transforms the (Cartesian) vector to cylindrical coordinates. See https://en.wikipedia.org/wiki/Vector_fields_in_cylindrical_and_spherical_coordinates
References Matrix3D(), Vec3D::X, XX, XY, XZ, Vec3D::Y, YX, YY, YZ, ZX, ZY, and ZZ.
Referenced by main(), and CGFields::StandardFields::setCylindricalFields().
Computes the inverse of a matrix.
[in] | A | Matrix that should be inverted. |
A.ldivide(b) computes the solution x to A*x=b.
Solve the linear system Ax = b: A.ldivide(b) computes the solution x to A*x=b.
[in] | b | Right-handside in Ax = b, as a const-reference to a Vec3D |
References Vec3D::X, XX, XY, XZ, Vec3D::Y, YX, YY, YZ, Vec3D::Z, ZX, ZY, and ZZ.
Referenced by BasicIntersectionOfWalls::getDistanceAndNormal().
Matrix addition.
Adds all elements of a given matrix to its own
[in] | A | 3D matrix to be added |
Matrix substraction.
Substract all elements of a given matrix from its own
[in] | A | 3D matrix to be subtracted |
Scalar division.
Division by a scalar
[in] | a | scalar to be divided by |
void Matrix3D::setZero | ( | ) |
Sets all elements to zero.
Sets all elements to zero.
References XX, XY, XZ, YX, YY, YZ, ZX, ZY, and ZZ.
Referenced by Matrix3D(), CGFields::GradVelocityField::setZero(), CGFields::StandardFields::setZero(), and StressStrainControlBoundary::StressStrainControlBoundary().
Calculates the pointwise square root.
Takes the square root of all the elements in given matrix
[in] | A | Matrix to be pointwise square rooted |
References A, and Matrix3D().
Calculates the pointwise square.
Squares all the elements in given matrix
[in] | A | Matrix to be pointwise squared |
References A, Matrix3D(), and mathsFunc::square().
Referenced by CGFields::GradVelocityField::getSquared(), and CGFields::StandardFields::getSquared().
Mdouble Matrix3D::trace | ( | ) | const |
|
friend |
Add elements to ostream.
Adds all elements of a matrix to an ostream
[out] | os | output stream |
[in] | A | 3D matrix |
|
friend |
Mdouble Matrix3D::XX |
all nine matrix elements
Referenced by StressStrainControlBoundary::activateStrainRateControl(), StressStrainControlBoundary::checkBoundaryAfterParticlesMove(), StressStrainControlBoundary::computeStrainRate(), StressStrainControlBoundary::computeStressError(), cross(), deviator(), diag(), getCylindricalTensorField(), ClumpParticle::getInitPrincipalDirections_e1(), ClumpParticle::getPrincipalDirections_e1(), inverse(), mathsFunc::isEqual(), ldivide(), main(), Matrix3D(), operator*(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), StressStrainControlBoundary::set(), ClumpParticle::setPrincipalDirections_e1(), setZero(), Packing::test(), ShapeGradientHessianTester::testCushion(), ShapeGradientHessianTester::testEllipsoid(), ShapeGradientHessianTester::testRoundedBeam(), ShapeGradientHessianTester::testSphere(), trace(), and StressStrainControlBoundary::updateDomainSize().
Mdouble Matrix3D::XY |
Referenced by ShearStage::actionsAfterTimeStep(), StressStrainControlBoundary::activateStrainRateControl(), StressStrainControlBoundary::checkBoundaryAfterParticlesMove(), StressStrainControlBoundary::computeStrainRate(), cross(), StressStrainControlBoundary::determineStressControlledShearBoundaries(), deviator(), getCylindricalTensorField(), ClumpParticle::getInitPrincipalDirections_e2(), ClumpParticle::getPrincipalDirections_e2(), inverse(), mathsFunc::isEqual(), ldivide(), main(), Matrix3D(), operator*(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), ShearStage::printTime(), StressStrainControlBoundary::set(), ClumpParticle::setPrincipalDirections_e2(), setZero(), and ShapeGradientHessianTester::testCushion().
Mdouble Matrix3D::XZ |
Referenced by cross(), deviator(), getCylindricalTensorField(), ClumpParticle::getInitPrincipalDirections_e3(), ClumpParticle::getPrincipalDirections_e3(), inverse(), mathsFunc::isEqual(), ldivide(), Matrix3D(), operator*(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), StressStrainControlBoundary::set(), ClumpParticle::setPrincipalDirections_e3(), and setZero().
Mdouble Matrix3D::YX |
Referenced by cross(), deviator(), getCylindricalTensorField(), ClumpParticle::getInitPrincipalDirections_e1(), ClumpParticle::getPrincipalDirections_e1(), inverse(), mathsFunc::isEqual(), ldivide(), Matrix3D(), operator*(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), ClumpParticle::setPrincipalDirections_e1(), setZero(), and ShapeGradientHessianTester::testCushion().
Mdouble Matrix3D::YY |
Referenced by ShearStage::actionsAfterTimeStep(), StressStrainControlBoundary::activateStrainRateControl(), StressStrainControlBoundary::checkBoundaryAfterParticlesMove(), StressStrainControlBoundary::computeStrainRate(), cross(), deviator(), diag(), getCylindricalTensorField(), ClumpParticle::getInitPrincipalDirections_e2(), ClumpParticle::getPrincipalDirections_e2(), inverse(), mathsFunc::isEqual(), ldivide(), main(), Matrix3D(), operator*(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), ShearStage::printTime(), StressStrainControlBoundary::set(), ClumpParticle::setPrincipalDirections_e2(), setZero(), Packing::test(), ShapeGradientHessianTester::testCushion(), ShapeGradientHessianTester::testEllipsoid(), ShapeGradientHessianTester::testRoundedBeam(), ShapeGradientHessianTester::testSphere(), trace(), and StressStrainControlBoundary::updateDomainSize().
Mdouble Matrix3D::YZ |
Referenced by cross(), deviator(), getCylindricalTensorField(), ClumpParticle::getInitPrincipalDirections_e3(), ClumpParticle::getPrincipalDirections_e3(), inverse(), mathsFunc::isEqual(), ldivide(), Matrix3D(), operator*(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), StressStrainControlBoundary::set(), ClumpParticle::setPrincipalDirections_e3(), and setZero().
Mdouble Matrix3D::ZX |
Referenced by cross(), deviator(), getCylindricalTensorField(), ClumpParticle::getInitPrincipalDirections_e1(), ClumpParticle::getPrincipalDirections_e1(), inverse(), mathsFunc::isEqual(), ldivide(), Matrix3D(), operator*(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), StressStrainControlBoundary::set(), ClumpParticle::setPrincipalDirections_e1(), and setZero().
Mdouble Matrix3D::ZY |
Referenced by cross(), deviator(), getCylindricalTensorField(), ClumpParticle::getInitPrincipalDirections_e2(), ClumpParticle::getPrincipalDirections_e2(), inverse(), mathsFunc::isEqual(), ldivide(), Matrix3D(), operator*(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), StressStrainControlBoundary::set(), ClumpParticle::setPrincipalDirections_e2(), and setZero().
Mdouble Matrix3D::ZZ |
Referenced by StressStrainControlBoundary::activateStrainRateControl(), StressStrainControlBoundary::checkBoundaryAfterParticlesMove(), StressStrainControlBoundary::computeStrainRate(), cross(), deviator(), diag(), getCylindricalTensorField(), ClumpParticle::getInitPrincipalDirections_e3(), ClumpParticle::getPrincipalDirections_e3(), inverse(), mathsFunc::isEqual(), ldivide(), main(), Matrix3D(), operator*(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), StressStrainControlBoundary::set(), ClumpParticle::setPrincipalDirections_e3(), setZero(), Packing::test(), ShapeGradientHessianTester::testCushion(), ShapeGradientHessianTester::testEllipsoid(), ShapeGradientHessianTester::testRoundedBeam(), ShapeGradientHessianTester::testSphere(), trace(), and StressStrainControlBoundary::updateDomainSize().