OGS
MathLib Namespace Reference

Namespaces

namespace  detail
namespace  details
namespace  KelvinVector
namespace  LinAlg
namespace  Nonlinear
namespace  VectorizedTensor

Classes

class  CubicSolver
class  EigenBlockMatrixViewFunctor
struct  EigenIOFormat
class  EigenLinearSolver
class  EigenLinearSolverBase
class  EigenLisLinearSolver
class  EigenMatrix
struct  EigenOption
 Option for Eigen sparse solver. More...
class  EigenVector
 Global vector based on Eigen vector. More...
struct  GaussLegendre
struct  GaussLegendrePyramid
struct  GaussLegendrePyramid< 2 >
struct  GaussLegendrePyramid< 3 >
struct  GaussLegendreTet
struct  GaussLegendreTet< 2 >
struct  GaussLegendreTet< 3 >
struct  GaussLegendreTet< 4 >
struct  GaussLegendreTri
struct  GaussLegendreTri< 2 >
struct  GaussLegendreTri< 3 >
struct  GaussLegendreTri< 4 >
class  KahanSum
class  LinearIntervalInterpolation
 Class (template) LinearIntervalInterpolation is a functional object performing an interval mapping \(f: [a,b] \to [c,d]\). More...
struct  LinearSolverOptionsParser
struct  LinearSolverOptionsParser< EigenLinearSolver >
struct  LinearSolverOptionsParser< EigenLisLinearSolver >
struct  LinearSolverOptionsParser< PETScLinearSolver >
class  LisMatrix
 LisMatrix is a wrapper class for matrix types of the linear iterative solvers library. More...
class  LisVector
 Lis vector wrapper class. More...
struct  MatrixSpecifications
struct  MatrixVectorTraits
class  PETScLinearSolver
class  PETScMatrix
 Wrapper class for PETSc matrix routines for matrix. More...
struct  PETScMatrixOption
 This a struct data containing the configuration information to create a PETSc type matrix. More...
class  PETScVector
 Wrapper class for PETSc vector. More...
class  PiecewiseConstantInterpolation
struct  PiecewiseLinearCurveConfig
class  PiecewiseLinearInterpolation
class  PiecewiseLinearMonotonicCurve
 Class for strong monotonic curves. More...
class  Point3d
class  Point3dWithID
struct  RowColumnIndices
struct  SetMatrixSparsity
struct  SetMatrixSparsity< EigenMatrix, SPARSITY_PATTERN >
 Sets the sparsity pattern of the underlying EigenMatrix. More...
struct  SetMatrixSparsity< LisMatrix, SPARSITY_PATTERN >
 Sets the sparsity pattern of the underlying LisMatrix. More...
class  WeightedPoint
struct  WeightedSum

Typedefs

template<typename IndexType>
using SparsityPattern = std::vector<IndexType>
 A vector telling how many nonzeros there are in each global matrix row.

Enumerations

enum  TriangleTest { GAUSS , BARYCENTRIC }
enum class  VecNormType { NORM1 , NORM2 , INFINITY_N , INVALID }
enum class  DirichletBCApplicationMode { COMPLETE_MATRIX_UPDATE , FAST_INCOMPLETE_MATRIX_UPDATE }
enum class  LinearSolverBehaviour : int { RECOMPUTE , RECOMPUTE_AND_STORE , REUSE }

Functions

PiecewiseLinearCurveConfig parsePiecewiseLinearCurveConfig (BaseLib::ConfigTree const &config)
template<typename CurveType>
std::unique_ptr< CurveType > createPiecewiseLinearCurve (BaseLib::ConfigTree const &config)
template<int D, typename M>
constexpr Eigen::CwiseNullaryOp< EigenBlockMatrixViewFunctor< D, M >, typename EigenBlockMatrixViewFunctor< D, M >::Matrix > eigenBlockMatrixView (const Eigen::MatrixBase< M > &matrix)
double orientation3d (MathLib::Point3d const &p, MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c)
double calcTetrahedronVolume (MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c, MathLib::Point3d const &d)
double calcTriangleArea (MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c)
bool isPointInTetrahedron (MathLib::Point3d const &p, MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c, MathLib::Point3d const &d, double eps)
bool isPointInTriangle (MathLib::Point3d const &p, MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c, double eps_pnt_out_of_plane, double eps_pnt_out_of_tri, MathLib::TriangleTest algorithm)
bool gaussPointInTriangle (MathLib::Point3d const &q, MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c, double eps_pnt_out_of_plane, double eps_pnt_out_of_tri)
bool barycentricPointInTriangle (MathLib::Point3d const &p, MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c, double eps_pnt_out_of_plane, double eps_pnt_out_of_tri)
bool isPointInTriangleXY (MathLib::Point3d const &p, MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c)
bool dividedByPlane (const MathLib::Point3d &a, const MathLib::Point3d &b, const MathLib::Point3d &c, const MathLib::Point3d &d)
bool isCoplanar (const MathLib::Point3d &a, const MathLib::Point3d &b, const MathLib::Point3d &c, const MathLib::Point3d &d)
 Checks if the four given points are located on a plane.
static std::array< std::array< double, 3 >, GaussLegendreTet< 3 >::NPoints > initGLTet3X ()
static std::array< std::array< double, 3 >, GaussLegendreTet< 4 >::NPoints > initGLTet4X ()
template<typename Matrix>
Eigen::Map< Matrix > createZeroedMatrix (std::vector< double > &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)
Eigen::Map< Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > > createZeroedMatrix (std::vector< double > &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)
template<typename Matrix>
Eigen::Map< const Matrix > toMatrix (std::vector< double > const &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)
Eigen::Map< const Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > > toMatrix (std::vector< double > const &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)
template<typename Matrix>
Eigen::Map< Matrix > toMatrix (std::vector< double > &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)
Eigen::Map< Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > > toMatrix (std::vector< double > &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)
template<typename Vector>
Eigen::Map< Vector > createZeroedVector (std::vector< double > &data, Eigen::VectorXd::Index size)
template<typename Vector>
Eigen::Map< const Vector > toVector (std::vector< double > const &data, Eigen::VectorXd::Index size)
 Creates an Eigen mapped vector from the given data vector.
template<typename Vector>
Eigen::Map< Vector > toVector (std::vector< double > &data, Eigen::VectorXd::Index size)
 Creates an Eigen mapped vector from the given data vector.
Eigen::Map< const Eigen::VectorXd > toVector (std::vector< double > const &data)
Eigen::Map< Eigen::VectorXd > toVector (std::vector< double > &data)
void applyKnownSolution (EigenMatrix &A, EigenVector &b, EigenVector &, const std::vector< EigenMatrix::IndexType > &vec_knownX_id, const std::vector< double > &vec_knownX_x, DirichletBCApplicationMode const mode)
template<typename MAT_T>
bool finalizeMatrixAssembly (MAT_T &)
template<typename VEC_T>
void finalizeVectorAssembly (VEC_T &)
 General function to finalize the vector assembly.
std::string convertVecNormTypeToString (VecNormType normType)
 convert VecNormType to string
VecNormType convertStringToVecNormType (const std::string &str)
 convert string to VecNormType
void ignoreOtherLinearSolvers (const BaseLib::ConfigTree &config, const std::string &solver_name)
bool checkLisError (int err)
bool finalizeMatrixAssembly (LisMatrix &mat)
 finish assembly to make this matrix be ready for use
 SPECIALIZE_MATRIX_VECTOR_TRAITS (PETScMatrix, PETScMatrix::IndexType)
 SPECIALIZE_MATRIX_VECTOR_TRAITS (PETScVector, PETScVector::IndexType)
bool finalizeMatrixAssembly (PETScMatrix &mat, const MatAssemblyType asm_type=MAT_FINAL_ASSEMBLY)
 General interface for the matrix assembly.
void applyKnownSolution (PETScMatrix &A, PETScVector &b, PETScVector &x, const std::vector< PetscInt > &vec_knownX_id, const std::vector< PetscScalar > &vec_knownX_x, DirichletBCApplicationMode const mode)
 apply known solutions to a system of linear equations
void finalizeVectorAssembly (PETScVector &vec)
 Function to finalize the vector assembly.
template<typename MATRIX, typename SPARSITY_PATTERN>
void setMatrixSparsity (MATRIX &matrix, SPARSITY_PATTERN const &sparsity_pattern)
void setVector (PETScVector &v, std::initializer_list< double > values)
void setVector (PETScVector &v, MatrixVectorTraits< PETScVector >::Index const index, double const value)
void setMatrix (PETScMatrix &m, std::initializer_list< double > values)
void setMatrix (PETScMatrix &m, Eigen::MatrixXd const &tmp)
void addToMatrix (PETScMatrix &m, std::initializer_list< double > values)
double calcProjPntToLineAndDists (Point3d const &pp, Point3d const &pa, Point3d const &pb, double &lambda, double &d0)
double getAngle (Point3d const &p0, Point3d const &p1, Point3d const &p2)
MathLib::Point3d operator* (Eigen::Matrix3d const &mat, MathLib::Point3d const &p)
double sqrDist (MathLib::Point3d const &p0, MathLib::Point3d const &p1)
bool lessEq (Point3d const &a, Point3d const &b, double eps)
bool operator< (Point3d const &a, Point3d const &b)
std::ostream & operator<< (std::ostream &os, const Point3d &p)
bool operator== (Point3d const &a, Point3d const &b)
double sqrDist2d (MathLib::Point3d const &p0, MathLib::Point3d const &p1)
std::ostream & operator<< (std::ostream &os, MathLib::WeightedPoint const &wp)

Variables

template<>
double const GaussLegendre< 1 >::X [1] = {0.}
template<>
double const GaussLegendre< 1 >::W [1] = {2.}
template<>
double const GaussLegendre< 2 >::X [2] = {0.577350269189626, -0.577350269189626}
template<>
double const GaussLegendre< 2 >::W [2] = {1., 1.}
template<>
double const GaussLegendre< 3 >::X [3]
template<>
double const GaussLegendre< 3 >::W [3] = {5. / 9, 8. / 9, 5. / 9}
template<>
double const GaussLegendre< 4 >::X [4]
template<>
double const GaussLegendre< 4 >::W [4]
template<>
const std::array< std::array< double, 3 >, GaussLegendrePyramid< 1 >::NPoints > GaussLegendrePyramid< 1 >::X = {{{{0, 0, -0.5}}}}
template<>
double const GaussLegendrePyramid< 1 >::W [1] = {128. / 27.}
const std::array< std::array< double, 3 >, GaussLegendrePyramid< 2 >::NPoints > GaussLegendrePyramid< 2 >::X
double const GaussLegendrePyramid< 2 >::W [5]
const std::array< std::array< double, 3 >, GaussLegendrePyramid< 3 >::NPoints > GaussLegendrePyramid< 3 >::X
double const GaussLegendrePyramid< 3 >::W [13]
template<>
const std::array< std::array< double, 3 >, GaussLegendreTet< 1 >::NPoints > GaussLegendreTet< 1 >::X = {{{{1. / 4., 1. / 4., 1. / 4.}}}}
template<>
double const GaussLegendreTet< 1 >::W [1] = {1. / 6.}
const std::array< std::array< double, 3 >, GaussLegendreTet< 2 >::NPoints > GaussLegendreTet< 2 >::X
double const GaussLegendreTet< 2 >::W [5]
const std::array< std::array< double, 3 >, GaussLegendreTet< 3 >::NPoints > GaussLegendreTet< 3 >::X = initGLTet3X()
static const double p = 0.1126879257180162 / 6.
static const double q = 0.0734930431163619 / 6.
static const double r = 0.0425460207770812 / 6.
double const GaussLegendreTet< 3 >::W [GaussLegendreTet< 3 >::NPoints]
const std::array< std::array< double, 3 >, GaussLegendreTet< 4 >::NPoints > GaussLegendreTet< 4 >::X = initGLTet4X()
static const double s = 81. / 2240. / 6.
static const double t = 161051. / 2304960. / 6.
static const double u = 409. / 31395. / 6.
static const double v = 2679769. / 32305455. / 6.
double const GaussLegendreTet< 4 >::W [GaussLegendreTet< 4 >::NPoints]
template<>
const std::array< std::array< double, 2 >, GaussLegendreTri< 1 >::NPoints > GaussLegendreTri< 1 >::X = {{{{1. / 3., 1. / 3.}}}}
template<>
double const GaussLegendreTri< 1 >::W [1] = {1.0}
const std::array< std::array< double, 2 >, GaussLegendreTri< 2 >::NPoints > GaussLegendreTri< 2 >::X
double const GaussLegendreTri< 2 >::W [3] = {1. / 3., 1. / 3., 1. / 3.}
const std::array< std::array< double, 2 >, GaussLegendreTri< 3 >::NPoints > GaussLegendreTri< 3 >::X
double const GaussLegendreTri< 3 >::W [4]
const std::array< std::array< double, 2 >, GaussLegendreTri< 4 >::NPoints > GaussLegendreTri< 4 >::X
double const GaussLegendreTri< 4 >::W [7]
const Point3d ORIGIN {{{0.0, 0.0, 0.0}}}

Typedef Documentation

◆ SparsityPattern

template<typename IndexType>
using MathLib::SparsityPattern = std::vector<IndexType>

A vector telling how many nonzeros there are in each global matrix row.

Definition at line 12 of file SparsityPattern.h.

Enumeration Type Documentation

◆ DirichletBCApplicationMode

Determines if Dirichlet BCs will be applied properly to both the global matrix A and the global rhs vector.

If the linear solver can reuse A from an earlier call, the Dirichlet BC application to A can be incomplete, thereby faster.

Enumerator
COMPLETE_MATRIX_UPDATE 

Both A and b fully updated.

FAST_INCOMPLETE_MATRIX_UPDATE 

A partially updated, b fully updated.

Definition at line 32 of file LinAlgEnums.h.

33{
36};
@ COMPLETE_MATRIX_UPDATE
Both A and b fully updated.
Definition LinAlgEnums.h:34
@ FAST_INCOMPLETE_MATRIX_UPDATE
A partially updated, b fully updated.
Definition LinAlgEnums.h:35

◆ LinearSolverBehaviour

enum class MathLib::LinearSolverBehaviour : int
strong
Enumerator
RECOMPUTE 
RECOMPUTE_AND_STORE 
REUSE 

Definition at line 8 of file LinearSolverBehaviour.h.

◆ TriangleTest

Enumerator
GAUSS 
BARYCENTRIC 

Definition at line 13 of file GeometricBasics.h.

14{
15 GAUSS,
17};

◆ VecNormType

enum class MathLib::VecNormType
strong

Norm type. Not declared as class type in order to use the members as integers.

Enumerator
NORM1 

\(\sum_i |x_i|\)

NORM2 

\(\sqrt(\sum_i (x_i)^2)\)

INFINITY_N 

\(\mathrm{max}_i |x_i|\)

INVALID 

Definition at line 13 of file LinAlgEnums.h.

Function Documentation

◆ addToMatrix()

void MathLib::addToMatrix ( PETScMatrix & m,
std::initializer_list< double > values )

Definition at line 64 of file UnifiedMatrixSetters.cpp.

65{
66 using IndexType = PETScMatrix::IndexType;
67
68 auto const rows = m.getNumberOfRows();
69 auto const cols = m.getNumberOfColumns();
70
71 assert((IndexType)values.size() == rows * cols);
72
73 Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> tmp(
74 rows, cols);
75
76 auto it = values.begin();
77 for (IndexType r = 0; r < rows; ++r)
78 {
79 for (IndexType c = 0; c < cols; ++c)
80 {
81 tmp(r, c) = *(it++);
82 }
83 }
84
85 std::vector<IndexType> row_idcs(rows);
86 std::vector<IndexType> col_idcs(cols);
87
88 std::iota(row_idcs.begin(), row_idcs.end(), 0);
89 std::iota(col_idcs.begin(), col_idcs.end(), 0);
90
91 m.add(row_idcs, col_idcs, tmp);
92}
PetscInt getNumberOfColumns() const
Get the number of columns.
Definition PETScMatrix.h:65
void add(const PetscInt i, const PetscInt j, const PetscScalar value)
Add value to a single entry.
PetscInt getNumberOfRows() const
Get the number of rows.
Definition PETScMatrix.h:63
static const double r

References MathLib::PETScMatrix::add(), MathLib::PETScMatrix::getNumberOfColumns(), MathLib::PETScMatrix::getNumberOfRows(), and r.

Referenced by setMatrix().

◆ applyKnownSolution() [1/2]

void MathLib::applyKnownSolution ( EigenMatrix & A,
EigenVector & b,
EigenVector & ,
const std::vector< EigenMatrix::IndexType > & vec_knownX_id,
const std::vector< double > & vec_knownX_x,
DirichletBCApplicationMode const mode )

apply known solutions to a system of linear equations

Parameters
ACoefficient matrix
bRHS vector
vec_knownX_ida vector of known solution entry IDs
vec_knownX_xa vector of known solutions
modedetermines if the modification of matrix A should be "complete", incomplete is faster but leaves A in a garbage state and only modifies b properly

Definition at line 123 of file EigenTools.cpp.

128{
129 using SpMat = EigenMatrix::RawMatrixType;
130 static_assert(SpMat::IsRowMajor, "matrix is assumed to be row major!");
131
132 auto& A_eigen = A.getRawMatrix();
133 auto& b_eigen = b.getRawVector();
134
136 switch (mode)
137 {
139 ::applyKnownSolutionComplete(A_eigen, b_eigen, vec_knownX_id,
140 vec_knownX_x);
141 return;
143 ::applyKnownSolutionIncomplete(A_eigen, b_eigen, vec_knownX_id,
144 vec_knownX_x);
145 return;
146 }
147
148 OGS_FATAL("Unhandled DirichletBCApplicationMode with integer value {}.",
149 std::to_underlying(mode));
150}
#define OGS_FATAL(...)
Definition Error.h:19
Eigen::SparseMatrix< double, Eigen::RowMajor > RawMatrixType
Definition EigenMatrix.h:24
RawMatrixType & getRawMatrix()
RawVectorType & getRawVector()
return a raw Eigen vector object
DirichletBCApplicationMode
Definition LinAlgEnums.h:33

References COMPLETE_MATRIX_UPDATE, FAST_INCOMPLETE_MATRIX_UPDATE, MathLib::EigenMatrix::getRawMatrix(), MathLib::EigenVector::getRawVector(), and OGS_FATAL.

Referenced by NumLib::TimeDiscretizedODESystem< ODESystemTag::FirstOrderImplicitQuasilinear, NonlinearSolverTag::Newton >::applyKnownSolutionsNewton(), NumLib::TimeDiscretizedODESystem< ODESystemTag::FirstOrderImplicitQuasilinear, NonlinearSolverTag::Newton >::applyKnownSolutionsPETScSNES(), and NumLib::TimeDiscretizedODESystem< ODESystemTag::FirstOrderImplicitQuasilinear, NonlinearSolverTag::Picard >::applyKnownSolutionsPicard().

◆ applyKnownSolution() [2/2]

void MathLib::applyKnownSolution ( PETScMatrix & A,
PETScVector & b,
PETScVector & x,
const std::vector< PetscInt > & vec_knownX_id,
const std::vector< PetscScalar > & vec_knownX_x,
DirichletBCApplicationMode const mode )

apply known solutions to a system of linear equations

Parameters
ACoefficient matrix
bRHS vector
xSolution vector
vec_knownX_idA vector of known solution entry IDs
vec_knownX_xA vector of known solutions
modeProvided for compatibility with Eigen, unused

Definition at line 8 of file PETScTools.cpp.

12{
14
15#ifndef NDEBUG
16 if (std::any_of(vec_knownX_id.begin(), vec_knownX_id.end(),
17 [](PetscInt const i) { return i < 0; }))
18 {
20 "Found negative indices in the vector of Dirichlet boundary "
21 "conditions.");
22 }
23#endif // NDEBUG
24
25 A.setRowsColumnsZero(vec_knownX_id);
27
30 if (vec_knownX_id.size() > 0)
31 {
32 x.set(vec_knownX_id, vec_knownX_x);
33 b.set(vec_knownX_id, vec_knownX_x);
34 }
35
38}
void finalizeAssembly(const MatAssemblyType asm_type=MAT_FINAL_ASSEMBLY)
Perform MPI collection of assembled entries in buffer.
Definition PETScMatrix.h:56
void setRowsColumnsZero(std::vector< PetscInt > const &row_pos)
Set the specified rows to zero except diagonal entries, i.e. , where This function must be called...
void finalizeAssembly()
Perform MPI collection of assembled entries in buffer.
void set(const PetscInt i, const PetscScalar value)
Definition PETScVector.h:92

References MathLib::PETScMatrix::finalizeAssembly(), MathLib::PETScVector::finalizeAssembly(), OGS_FATAL, MathLib::PETScVector::set(), and MathLib::PETScMatrix::setRowsColumnsZero().

◆ barycentricPointInTriangle()

bool MathLib::barycentricPointInTriangle ( MathLib::Point3d const & p,
MathLib::Point3d const & a,
MathLib::Point3d const & b,
MathLib::Point3d const & c,
double eps_pnt_out_of_plane = std::numeric_limits< float >::epsilon(),
double eps_pnt_out_of_tri = std::numeric_limits< float >::epsilon() )

Tests if the given point p is within the triangle, defined by its edge nodes a, b and c. Using two eps-values it is possible to test an 'epsilon' neighbourhood around the triangle as well as an 'epsilon' outside the triangles plane. Algorithm based on "Fundamentals of Computer Graphics" by Peter Shirley.

Parameters
ptest point
aedge node of triangle
bedge node of triangle
cedge node of triangle
eps_pnt_out_of_planeeps allowing for p to be slightly off the plane spanned by abc
eps_pnt_out_of_trieps allowing for p to be slightly off outside of abc
Returns
true if the test point p is within the 'epsilon'-neighbourhood of the triangle

Definition at line 142 of file GeometricBasics.cpp.

148{
149 if (std::abs(MathLib::orientation3d(p, a, b, c)) > eps_pnt_out_of_plane)
150 {
151 return false;
152 }
153
154 auto const& vp = p.asEigenVector3d();
155 Eigen::Vector3d const& pa = a.asEigenVector3d() - vp;
156 Eigen::Vector3d const& pb = b.asEigenVector3d() - vp;
157 Eigen::Vector3d const& pc = c.asEigenVector3d() - vp;
158 double const area_x_2(calcTriangleArea(a, b, c) * 2);
159
160 double const alpha((pb.cross(pc).norm()) / area_x_2);
161 if (alpha < -eps_pnt_out_of_tri || alpha > 1 + eps_pnt_out_of_tri)
162 {
163 return false;
164 }
165 double const beta((pc.cross(pa).norm()) / area_x_2);
166 if (beta < -eps_pnt_out_of_tri || beta > 1 + eps_pnt_out_of_tri)
167 {
168 return false;
169 }
170 double const gamma(1 - alpha - beta);
171 return !(gamma < -eps_pnt_out_of_tri || gamma > 1 + eps_pnt_out_of_tri);
172}
double orientation3d(MathLib::Point3d const &p, MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c)
double calcTriangleArea(MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c)
static const double p

References MathLib::Point3d::asEigenVector3d(), calcTriangleArea(), orientation3d(), and p.

Referenced by isPointInTriangle().

◆ calcProjPntToLineAndDists()

double MathLib::calcProjPntToLineAndDists ( MathLib::Point3d const & pp,
MathLib::Point3d const & pa,
MathLib::Point3d const & pb,
double & lambda,
double & d0 )

calcProjPntToLineAndDists computes the orthogonal projection of a point p to the line described by the points a and b, \(g(\lambda) = a + \lambda (b - a)\), the distance between p and the projected point and the distances between the projected point and the end points pa, pb of the line

Parameters
ppthe (mesh) point
pafirst point of line
pbsecond point of line
lambdathe projected point described by the line equation above
d0distance of the projected point to line point a
Returns
the distance between pp and the orthogonal projection of pp

Definition at line 13 of file MathTools.cpp.

15{
16 auto const& a = pa.asEigenVector3d();
17 auto const& b = pb.asEigenVector3d();
18 auto const& p = pp.asEigenVector3d();
19
20 // g(lambda) = a + lambda v, v = b-a
21 Eigen::Vector3d const v = b - a;
22
23 // orthogonal projection: (p - g(lambda))^T * v = 0
24 // <=> (a-p - lambda (b-a))^T * (b-a) = 0
25 // <=> (a-p)^T * (b-a) = lambda (b-a)^T ) (b-a)
26 lambda = (((p - a).transpose() * v) / v.squaredNorm())(0, 0);
27
28 // compute projected point
29 Eigen::Vector3d const proj_pnt = a + lambda * v;
30
31 d0 = (proj_pnt - a).norm();
32
33 return (p - proj_pnt).norm();
34}
static const double v

References MathLib::Point3d::asEigenVector3d(), p, and v.

Referenced by GeoLib::Polyline::getDistanceAlongPolyline(), and MeshLib::LineRule::isPntInElement().

◆ calcTetrahedronVolume()

double MathLib::calcTetrahedronVolume ( MathLib::Point3d const & a,
MathLib::Point3d const & b,
MathLib::Point3d const & c,
MathLib::Point3d const & d )

Calculates the volume of a tetrahedron. The formula is V=1/6*|a(b x c)| with a=x1->x2, b=x1->x3 and c=x1->x4.

Definition at line 24 of file GeometricBasics.cpp.

28{
29 Eigen::Vector3d const w = b.asEigenVector3d() - a.asEigenVector3d();
30 Eigen::Vector3d const u = c.asEigenVector3d() - a.asEigenVector3d();
31 Eigen::Vector3d const v = d.asEigenVector3d() - a.asEigenVector3d();
32 return std::abs(u.cross(v).dot(w)) / 6.0;
33}
static const double u

References MathLib::Point3d::asEigenVector3d(), u, and v.

Referenced by MeshLib::HexRule::computeVolume(), MeshLib::PrismRule::computeVolume(), MeshLib::PyramidRule::computeVolume(), and MeshLib::TetRule::computeVolume().

◆ calcTriangleArea()

double MathLib::calcTriangleArea ( MathLib::Point3d const & a,
MathLib::Point3d const & b,
MathLib::Point3d const & c )

Calculates the area of the triangle defined by its edge nodes a, b and c. The formula is \(A= \frac{1}{2} \cdot |u \times v|\), i.e. half of the area of the parallelogram specified by the vectors \(u=b-a\) and \(v=c-a\).

Definition at line 35 of file GeometricBasics.cpp.

37{
38 Eigen::Vector3d const u = c.asEigenVector3d() - a.asEigenVector3d();
39 Eigen::Vector3d const v = b.asEigenVector3d() - a.asEigenVector3d();
40 Eigen::Vector3d const w = u.cross(v);
41 return 0.5 * w.norm();
42}

References MathLib::Point3d::asEigenVector3d(), u, and v.

Referenced by barycentricPointInTriangle(), MeshLib::QuadRule::computeVolume(), MeshLib::TriRule::computeVolume(), and GeoLib::IO::TINInterface::readTIN().

◆ checkLisError()

bool MathLib::checkLisError ( int err)
inline

check Lis error codes

Parameters
errLis error code
Returns
success or not

Definition at line 20 of file LisCheck.h.

21{
22 bool ok = (err == LIS_SUCCESS);
23 if (!ok)
24 {
25 ERR("***ERROR: Lis error code = {:d}", err);
26 }
27 return ok;
28}
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:40

References ERR().

Referenced by MathLib::LisMatrix::LisMatrix(), MathLib::LisMatrix::LisMatrix(), MathLib::LisMatrix::~LisMatrix(), MathLib::LisMatrix::finalizeMatrixAssembly, MathLib::SetMatrixSparsity< LisMatrix, SPARSITY_PATTERN >::operator()(), MathLib::LisMatrix::setZero(), MathLib::LisVector::size(), and MathLib::EigenLisLinearSolver::solve().

◆ convertStringToVecNormType()

VecNormType MathLib::convertStringToVecNormType ( const std::string & str)

convert string to VecNormType

Definition at line 23 of file LinAlgEnums.cpp.

24{
25 if (str == "NORM1")
26 {
27 return VecNormType::NORM1;
28 }
29 if (str == "NORM2")
30 {
31 return VecNormType::NORM2;
32 }
33 if (str == "INFINITY_N")
34 {
36 }
38}

References INFINITY_N, INVALID, NORM1, and NORM2.

Referenced by NumLib::createConvergenceCriterionDeltaX(), NumLib::createConvergenceCriterionPerComponentDeltaX(), NumLib::createConvergenceCriterionPerComponentResidual(), and NumLib::createConvergenceCriterionResidual().

◆ convertVecNormTypeToString()

std::string MathLib::convertVecNormTypeToString ( VecNormType normType)

convert VecNormType to string

Definition at line 8 of file LinAlgEnums.cpp.

9{
10 switch (normType)
11 {
13 return "NORM1";
15 return "NORM2";
17 return "INFINITY_N";
18 default:
19 return "INVALID";
20 }
21}

References INFINITY_N, NORM1, and NORM2.

◆ createPiecewiseLinearCurve()

template<typename CurveType>
std::unique_ptr< CurveType > MathLib::createPiecewiseLinearCurve ( BaseLib::ConfigTree const & config)

Create a curve

Parameters
configConfigTree object has a tag of <curve>

Definition at line 29 of file CreatePiecewiseLinearCurve.h.

31{
32 auto [xs, ys] = parsePiecewiseLinearCurveConfig(config);
33 return std::make_unique<CurveType>(std::move(xs), std::move(ys));
34}
PiecewiseLinearCurveConfig parsePiecewiseLinearCurveConfig(BaseLib::ConfigTree const &config)

References parsePiecewiseLinearCurveConfig().

Referenced by ProjectData::parseCurves().

◆ createZeroedMatrix() [1/2]

template<typename Matrix>
Eigen::Map< Matrix > MathLib::createZeroedMatrix ( std::vector< double > & data,
Eigen::MatrixXd::Index rows,
Eigen::MatrixXd::Index cols )

Creates an Eigen mapped matrix having its entries stored in the given data vector.

Returns
An Eigen mapped matrix of the given size. All values of the matrix are set to zero.
Precondition
The passed data vector must have zero size.
Postcondition
The data has size rows * cols.
Note
The data vector will have the same storage order (row or column major) as the requested matrix type.

Definition at line 25 of file EigenMapTools.h.

28{
29 static_assert(Matrix::IsRowMajor || Matrix::IsVectorAtCompileTime,
30 "The default storage order in OGS is row major storage for "
31 "dense matrices.");
32 assert(Matrix::RowsAtCompileTime == Eigen::Dynamic ||
33 Matrix::RowsAtCompileTime == rows);
34 assert(Matrix::ColsAtCompileTime == Eigen::Dynamic ||
35 Matrix::ColsAtCompileTime == cols);
36 assert(data.empty()); // in order that resize fills the vector with zeros.
37
38 data.resize(rows * cols);
39 return {data.data(), rows, cols};
40}

Referenced by ProcessLib::ThermoRichardsMechanics::ThermoRichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunction, DisplacementDim, ConstitutiveTraits >::addToLocalMatrixData(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assemble(), ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::assemble(), ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::assemble(), ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::assemble(), ProcessLib::HT::MonolithicHTFEM< ShapeFunction, GlobalDim >::assemble(), ProcessLib::RichardsComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assemble(), ProcessLib::RichardsFlow::LocalAssemblerData< ShapeFunction, GlobalDim >::assemble(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::assemble(), ProcessLib::SteadyStateDiffusion::LocalAssemblerData< ShapeFunction, GlobalDim >::assemble(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::assemble(), ProcessLib::ThermalTwoPhaseFlowWithPP::ThermalTwoPhaseFlowWithPPLocalAssembler< ShapeFunction, GlobalDim >::assemble(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowLocalAssembler< ShapeFunction, GlobalDim >::assemble(), ProcessLib::TwoPhaseFlowWithPP::TwoPhaseFlowWithPPLocalAssembler< ShapeFunction, GlobalDim >::assemble(), ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::assemble(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleComponentTransportEquation(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleHeatTransportEquation(), ProcessLib::HT::StaggeredHTFEM< ShapeFunction, GlobalDim >::assembleHeatTransportEquation(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleHydraulicEquation(), ProcessLib::HT::StaggeredHTFEM< ShapeFunction, GlobalDim >::assembleHydraulicEquation(), ProcessLib::LiquidFlow::LiquidFlowLocalAssembler< ShapeFunction, GlobalDim >::assembleMatrixAndVector(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleReactionEquationConcrete(), ProcessLib::CentralDifferencesJacobianAssembler::assembleWithJacobian(), ProcessLib::ForwardDifferencesJacobianAssembler::assembleWithJacobian(), ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleWithJacobian(), ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::assembleWithJacobian(), ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::assembleWithJacobian(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::assembleWithJacobian(), ProcessLib::LargeDeformation::LargeDeformationLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobian(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerMatrix< ShapeFunction, DisplacementDim >::assembleWithJacobian(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::assembleWithJacobian(), ProcessLib::SmallDeformation::SmallDeformationLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobian(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::assembleWithJacobian(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::assembleWithJacobian(), ProcessLib::ThermoMechanics::ThermoMechanicsLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobian(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowLocalAssembler< ShapeFunction, GlobalDim >::assembleWithJacobian(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleWithJacobianComponentTransportEquation(), ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobianForDeformationEquations(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::assembleWithJacobianForDeformationEquations(), ProcessLib::PhaseField::PhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobianForDeformationEquations(), ProcessLib::ThermoMechanics::ThermoMechanicsLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobianForDeformationEquations(), ProcessLib::ThermoMechanics::ThermoMechanicsLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobianForHeatConductionEquations(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::assembleWithJacobianForPressureEquations(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleWithJacobianHydraulicEquation(), ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobianHydroEquations(), ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobianPhaseFieldEquations(), ProcessLib::PhaseField::PhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobianPhaseFieldEquations(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::calculateIntPtDarcyVelocity(), createZeroedMatrix(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getEpsilon(), ProcessLib::PhaseField::PhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::getEpsilon(), ProcessLib::getIntegrationPointDimMatrixData(), ProcessLib::getIntegrationPointKelvinVectorData(), ProcessLib::getIntegrationPointScalarData(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtDarcyVelocity(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerMatrix< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtDarcyVelocity(), ProcessLib::LiquidFlow::LiquidFlowLocalAssembler< ShapeFunction, GlobalDim >::getIntPtDarcyVelocity(), ProcessLib::RichardsComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::getIntPtDarcyVelocity(), ProcessLib::RichardsFlow::LocalAssemblerData< ShapeFunction, GlobalDim >::getIntPtDarcyVelocity(), ProcessLib::SteadyStateDiffusion::LocalAssemblerData< ShapeFunction, GlobalDim >::getIntPtDarcyVelocity(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtDarcyVelocity(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowLocalAssembler< ShapeFunction, GlobalDim >::getIntPtDarcyVelocity(), ProcessLib::HT::HTFEM< ShapeFunction, GlobalDim >::getIntPtDarcyVelocityLocal(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerFracture< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtFractureStress(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerFracture< ShapeFunction, DisplacementDim >::getIntPtFractureStress(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerFracture< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::getIntPtFractureVelocity(), ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::getIntPtHeatFlux(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::getIntPtMolarFlux(), and ProcessLib::Deformation::CollectIntegrationPointDataForExtrapolation< InternalVariable >::operator()().

◆ createZeroedMatrix() [2/2]

Eigen::Map< Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > > MathLib::createZeroedMatrix ( std::vector< double > & data,
Eigen::MatrixXd::Index rows,
Eigen::MatrixXd::Index cols )
inline

Creates an Eigen mapped matrix having its entries stored in the given data vector.

This is a convenience method which makes the specification of dynamically allocated Eigen matrices as return type easier.

Definition at line 50 of file EigenMapTools.h.

53{
54 return createZeroedMatrix<
55 Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>>(
56 data, rows, cols);
57}
Eigen::Map< Matrix > createZeroedMatrix(std::vector< double > &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)

References createZeroedMatrix().

◆ createZeroedVector()

template<typename Vector>
Eigen::Map< Vector > MathLib::createZeroedVector ( std::vector< double > & data,
Eigen::VectorXd::Index size )

Creates an Eigen mapped vector having its entries stored in the given data vector.

Returns
An Eigen mapped vector of the given size. All values of the vector are set to zero.
Precondition
The passed data vector must have zero size.
Postcondition
The data has size size.

Definition at line 146 of file EigenMapTools.h.

148{
149 static_assert(Vector::IsVectorAtCompileTime, "A vector type is required.");
150 assert(Vector::SizeAtCompileTime == Eigen::Dynamic ||
151 Vector::SizeAtCompileTime == size);
152 assert(data.empty()); // in order that resize fills the vector with zeros.
153
154 data.resize(size);
155 return {data.data(), size};
156}

Referenced by ProcessLib::ThermoRichardsMechanics::ThermoRichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunction, DisplacementDim, ConstitutiveTraits >::addToLocalMatrixData(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assemble(), ProcessLib::HT::MonolithicHTFEM< ShapeFunction, GlobalDim >::assemble(), ProcessLib::RichardsComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assemble(), ProcessLib::RichardsFlow::LocalAssemblerData< ShapeFunction, GlobalDim >::assemble(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::assemble(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::assemble(), ProcessLib::ThermalTwoPhaseFlowWithPP::ThermalTwoPhaseFlowWithPPLocalAssembler< ShapeFunction, GlobalDim >::assemble(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowLocalAssembler< ShapeFunction, GlobalDim >::assemble(), ProcessLib::TwoPhaseFlowWithPP::TwoPhaseFlowWithPPLocalAssembler< ShapeFunction, GlobalDim >::assemble(), ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::assemble(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleHydraulicEquation(), ProcessLib::HT::StaggeredHTFEM< ShapeFunction, GlobalDim >::assembleHydraulicEquation(), ProcessLib::LiquidFlow::LiquidFlowLocalAssembler< ShapeFunction, GlobalDim >::assembleMatrixAndVector(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleReactionEquationConcrete(), ProcessLib::CentralDifferencesJacobianAssembler::assembleWithJacobian(), ProcessLib::ForwardDifferencesJacobianAssembler::assembleWithJacobian(), ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleWithJacobian(), ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::assembleWithJacobian(), ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::assembleWithJacobian(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::assembleWithJacobian(), ProcessLib::LargeDeformation::LargeDeformationLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobian(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerMatrix< ShapeFunction, DisplacementDim >::assembleWithJacobian(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::assembleWithJacobian(), ProcessLib::SmallDeformation::SmallDeformationLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobian(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::assembleWithJacobian(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::assembleWithJacobian(), ProcessLib::ThermoMechanics::ThermoMechanicsLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobian(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowLocalAssembler< ShapeFunction, GlobalDim >::assembleWithJacobian(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleWithJacobianComponentTransportEquation(), ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobianForDeformationEquations(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::assembleWithJacobianForDeformationEquations(), ProcessLib::PhaseField::PhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobianForDeformationEquations(), ProcessLib::ThermoMechanics::ThermoMechanicsLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobianForDeformationEquations(), ProcessLib::ThermoMechanics::ThermoMechanicsLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobianForHeatConductionEquations(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::assembleWithJacobianForPressureEquations(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleWithJacobianHydraulicEquation(), ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobianHydroEquations(), ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobianPhaseFieldEquations(), ProcessLib::PhaseField::PhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobianPhaseFieldEquations(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::calculateIntPtLiquidDensity(), ProcessLib::RichardsComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::getIntPtSaturation(), and ProcessLib::SmallDeformation::getMaterialForces().

◆ dividedByPlane()

bool MathLib::dividedByPlane ( const MathLib::Point3d & a,
const MathLib::Point3d & b,
const MathLib::Point3d & c,
const MathLib::Point3d & d )

Checks if a and b can be placed on a plane such that c and d lie on different sides of said plane. (In 2D space this checks if c and d are on different sides of a line through a and b.)

Parameters
afirst point on plane
bsecond point on plane
cfirst point to test
dsecond point to test
Returns
true, if such a plane can be found, false otherwise

Definition at line 194 of file GeometricBasics.cpp.

196{
197 for (unsigned x = 0; x < 3; ++x)
198 {
199 const unsigned y = (x + 1) % 3;
200 const double abc =
201 (b[x] - a[x]) * (c[y] - a[y]) - (b[y] - a[y]) * (c[x] - a[x]);
202 const double abd =
203 (b[x] - a[x]) * (d[y] - a[y]) - (b[y] - a[y]) * (d[x] - a[x]);
204
205 if ((abc > 0 && abd < 0) || (abc < 0 && abd > 0))
206 {
207 return true;
208 }
209 }
210 return false;
211}

Referenced by MeshLib::QuadRule::validate().

◆ eigenBlockMatrixView()

template<int D, typename M>
Eigen::CwiseNullaryOp< EigenBlockMatrixViewFunctor< D, M >, typename EigenBlockMatrixViewFunctor< D, M >::Matrix > MathLib::eigenBlockMatrixView ( const Eigen::MatrixBase< M > & matrix)
constexpr

Definition at line 43 of file EigenBlockMatrixView.h.

44{
45 using Matrix = typename EigenBlockMatrixViewFunctor<D, M>::Matrix;
46 return Matrix::NullaryExpr(
47 D * matrix.rows(), D * matrix.cols(),
48 EigenBlockMatrixViewFunctor<D, M>(matrix.derived()));
49}
Eigen::Matrix< Scalar, rows, cols, Eigen::ColMajor > Matrix

Referenced by ProcessLib::LargeDeformation::computeSigmaGeom().

◆ finalizeMatrixAssembly() [1/3]

bool MathLib::finalizeMatrixAssembly ( LisMatrix & mat)

finish assembly to make this matrix be ready for use

Definition at line 112 of file LisMatrix.cpp.

113{
114 LIS_MATRIX& A = mat.getRawMatrix();
115
116 if (!mat.isAssembled())
117 {
118 int ierr =
119 lis_matrix_set_type(A, static_cast<int>(mat.getMatrixType()));
120 checkLisError(ierr);
121 ierr = lis_matrix_assemble(A);
122 checkLisError(ierr);
123 mat.is_assembled_ = true;
124 }
125 return true;
126}
MatrixType getMatrixType() const
get this matrix type
Definition LisMatrix.h:129
LIS_MATRIX & getRawMatrix()
return a raw Lis matrix object
Definition LisMatrix.h:102
bool isAssembled() const
return if this matrix is already assembled or not
Definition LisMatrix.h:132
bool checkLisError(int err)
Definition LisCheck.h:20

◆ finalizeMatrixAssembly() [2/3]

template<typename MAT_T>
bool MathLib::finalizeMatrixAssembly ( MAT_T & )

◆ finalizeMatrixAssembly() [3/3]

bool MathLib::finalizeMatrixAssembly ( PETScMatrix & mat,
const MatAssemblyType asm_type = MAT_FINAL_ASSEMBLY )

General interface for the matrix assembly.

Parameters
matThe matrix to be finalized.
asm_typeAssembly type, either MAT_FLUSH_ASSEMBLY or MAT_FINAL_ASSEMBLY.

Definition at line 145 of file PETScMatrix.cpp.

146{
147 mat.finalizeAssembly(asm_type);
148 return true;
149}

◆ finalizeVectorAssembly() [1/2]

void MathLib::finalizeVectorAssembly ( PETScVector & vec)

Function to finalize the vector assembly.

Definition at line 293 of file PETScVector.cpp.

294{
295 vec.finalizeAssembly();
296}

◆ finalizeVectorAssembly() [2/2]

template<typename VEC_T>
void MathLib::finalizeVectorAssembly ( VEC_T & )

◆ gaussPointInTriangle()

bool MathLib::gaussPointInTriangle ( MathLib::Point3d const & q,
MathLib::Point3d const & a,
MathLib::Point3d const & b,
MathLib::Point3d const & c,
double eps_pnt_out_of_plane = std::numeric_limits< float >::epsilon(),
double eps_pnt_out_of_tri = std::numeric_limits< float >::epsilon() )

Tests if the given point q is within the triangle, defined by its edge nodes a, b and c. Using two eps-values it is possible to test an 'epsilon' neighbourhood around the triangle as well as an 'epsilon' outside the triangles plane.

Parameters
qtest point
aedge node of triangle
bedge node of triangle
cedge node of triangle
eps_pnt_out_of_planeeps allowing for p to be slightly off the plane spanned by abc ((orthogonal distance to the plane spaned by triangle)
eps_pnt_out_of_trieps allowing for p to be slightly off outside of abc
Returns
true if the test point p is within the 'epsilon'-neighbourhood of the triangle

Definition at line 102 of file GeometricBasics.cpp.

108{
109 auto const& pa = a.asEigenVector3d();
110 Eigen::Vector3d const v = b.asEigenVector3d() - pa;
111 Eigen::Vector3d const w = c.asEigenVector3d() - pa;
112
113 Eigen::Matrix2d mat;
114 mat(0, 0) = v.squaredNorm();
115 mat(0, 1) = v[0] * w[0] + v[1] * w[1] + v[2] * w[2];
116 mat(1, 0) = mat(0, 1);
117 mat(1, 1) = w.squaredNorm();
118 Eigen::Vector2d y(
119 v[0] * (q[0] - a[0]) + v[1] * (q[1] - a[1]) + v[2] * (q[2] - a[2]),
120 w[0] * (q[0] - a[0]) + w[1] * (q[1] - a[1]) + w[2] * (q[2] - a[2]));
121
122 y = mat.partialPivLu().solve(y);
123
124 const double lower(eps_pnt_out_of_tri);
125 const double upper(1 + lower);
126
127 if (-lower <= y[0] && y[0] <= upper && -lower <= y[1] && y[1] <= upper &&
128 y[0] + y[1] <= upper)
129 {
130 MathLib::Point3d const q_projected(std::array<double, 3>{
131 {a[0] + y[0] * v[0] + y[1] * w[0], a[1] + y[0] * v[1] + y[1] * w[1],
132 a[2] + y[0] * v[2] + y[1] * w[2]}});
133 if (MathLib::sqrDist(q, q_projected) <= eps_pnt_out_of_plane)
134 {
135 return true;
136 }
137 }
138
139 return false;
140}
static const double q
double sqrDist(MathLib::Point3d const &p0, MathLib::Point3d const &p1)
Definition Point3d.cpp:19

References MathLib::Point3d::asEigenVector3d(), q, sqrDist(), and v.

Referenced by isPointInTriangle().

◆ getAngle()

double MathLib::getAngle ( Point3d const & p0,
Point3d const & p1,
Point3d const & p2 )

Let \(p_0, p_1, p_2 \in R^3\). The function getAngle computes the angle between the edges \((p_0,p_1)\) and \((p_1,p_2)\)

Parameters
p0start point of edge 0
p1end point of edge 0 and start point of edge 1
p2end point of edge 1
Returns
the angle between the edges

Definition at line 36 of file MathTools.cpp.

37{
38 auto const& b = p1.asEigenVector3d();
39 Eigen::Vector3d const v0 = p0.asEigenVector3d() - b;
40 Eigen::Vector3d const v1 = p2.asEigenVector3d() - b;
41
42 // apply Cauchy Schwarz inequality
43 return std::acos(v0.dot(v1) / (v0.norm() * v1.norm()));
44}

References MathLib::Point3d::asEigenVector3d().

Referenced by MeshToolsLib::anonymous_namespace{AngleSkewMetric.cpp}::getMinMaxAngle().

◆ ignoreOtherLinearSolvers()

void MathLib::ignoreOtherLinearSolvers ( BaseLib::ConfigTree const & config,
std::string const & solver_name )

Ignore linear solver settings not needed for the selected one.

The project files support specifying linear solver options for all known solver libraries (currently PETSC, LIS, Eigen) even though for a specific build only one of those settings is used. That clearly conflicts with the requirement of the config tree that each setting present in the project file must be read exactly once.

The purpose of this function is to explicitly ignore all the settings that are not relevant for the currently used linear solver

Parameters
configThe config tree snippet for the linear solver.
solver_nameThe tag under which the relevant configuration is found. All other configurations will be ignored.

This function is currently used in the option parsing code of our EigenLinearSolver, LisOption and PETScLinearSolver

Definition at line 17 of file LinearSolverOptions.cpp.

19{
20 for (auto const& s : known_linear_solvers)
21 {
22 if (s != solver_name)
23 {
25 }
26 }
27}
static std::set< std::string > known_linear_solvers
void ignoreConfigParameter(std::string const &param) const
static const double s

References BaseLib::ConfigTree::ignoreConfigParameter(), known_linear_solvers, and s.

Referenced by MathLib::LinearSolverOptionsParser< EigenLinearSolver >::parseNameAndOptions(), MathLib::LinearSolverOptionsParser< EigenLisLinearSolver >::parseNameAndOptions(), and MathLib::LinearSolverOptionsParser< PETScLinearSolver >::parseNameAndOptions().

◆ initGLTet3X()

std::array< std::array< double, 3 >, GaussLegendreTet< 3 >::NPoints > MathLib::initGLTet3X ( )
static

Definition at line 24 of file GaussLegendreTet.cpp.

25{
26 // Cf. Gellert, M., Harbord, R., 1991. Moderate degree cubature formulas for
27 // 3-D tetrahedral finite-element approximations. Communications in Applied
28 // Numerical Methods 7, 487-495. doi:10.1002/cnm.1630070609
29 const double a = 0.0673422422100983;
30 const double b = 0.3108859192633005;
31 const double c = 0.7217942490673264;
32 const double d = 0.0927352503108912;
33 const double e = 0.4544962958743506;
34 const double f = 0.045503704125649;
35
36 return {{{{a, b, b}},
37 {{b, a, b}},
38 {{b, b, a}},
39 {{b, b, b}},
40 {{c, d, d}},
41 {{d, c, d}},
42 {{d, d, c}},
43 {{d, d, d}},
44 {{e, e, f}},
45 {{e, f, e}},
46 {{e, f, f}},
47 {{f, e, e}},
48 {{f, e, f}},
49 {{f, f, e}}}};
50}

◆ initGLTet4X()

std::array< std::array< double, 3 >, GaussLegendreTet< 4 >::NPoints > MathLib::initGLTet4X ( )
static

Definition at line 63 of file GaussLegendreTet.cpp.

64{
65 // Cf. Gellert, M., Harbord, R., 1991. Moderate degree cubature formulas for
66 // 3-D tetrahedral finite-element approximations. Communications in Applied
67 // Numerical Methods 7, 487-495. doi:10.1002/cnm.1630070609
68 const double a = 0.3797582452067875;
69 const double b = 0.1202417547932126;
70
71 return {{{{0.0, 1. / 3, 1. / 3}},
72 {{1. / 3, 0.0, 1. / 3}},
73 {{1. / 3, 1. / 3, 0.0}},
74 {{1. / 3, 1. / 3, 1. / 3}},
75 {{8. / 11, 1. / 11, 1. / 11}},
76 {{1. / 11, 8. / 11, 1. / 11}},
77 {{1. / 11, 1. / 11, 8. / 11}},
78 {{1. / 11, 1. / 11, 1. / 11}},
79 {{0.0, 0.0, 0.5}},
80 {{0.0, 0.5, 0.0}},
81 {{0.0, 0.5, 0.5}},
82 {{0.5, 0.0, 0.0}},
83 {{0.5, 0.0, 0.5}},
84 {{0.5, 0.5, 0.0}},
85 {{a, a, b}},
86 {{a, b, a}},
87 {{a, b, b}},
88 {{b, a, a}},
89 {{b, a, b}},
90 {{b, b, a}}}};
91}

◆ isCoplanar()

bool MathLib::isCoplanar ( const MathLib::Point3d & a,
const MathLib::Point3d & b,
const MathLib::Point3d & c,
const MathLib::Point3d & d )

Checks if the four given points are located on a plane.

Definition at line 213 of file GeometricBasics.cpp.

215{
216 Eigen::Vector3d const ab = b.asEigenVector3d() - a.asEigenVector3d();
217 Eigen::Vector3d const ac = c.asEigenVector3d() - a.asEigenVector3d();
218 Eigen::Vector3d const ad = d.asEigenVector3d() - a.asEigenVector3d();
219
220 auto const eps_squared =
221 std::pow(std::numeric_limits<double>::epsilon(), 2);
222 if (ab.squaredNorm() < eps_squared || ac.squaredNorm() < eps_squared ||
223 ad.squaredNorm() < eps_squared)
224 {
225 return true;
226 }
227
228 // In exact arithmetic <ac*ad^T, ab> should be zero
229 // if all four points are coplanar.
230 const double sqr_scalar_triple(std::pow(ac.cross(ad).dot(ab), 2));
231 // Due to evaluating the above numerically some cancellation or rounding
232 // can occur. For this reason a normalisation factor is introduced.
233 const double normalisation_factor =
234 (ab.squaredNorm() * ac.squaredNorm() * ad.squaredNorm());
235
236 // tolerance 1e-11 is chosen such that
237 // a = (0,0,0), b=(1,0,0), c=(0,1,0) and d=(1,1,1e-6) are considered as
238 // coplanar
239 // a = (0,0,0), b=(1,0,0), c=(0,1,0) and d=(1,1,1e-5) are considered as not
240 // coplanar
241 return (sqr_scalar_triple / normalisation_factor < 1e-11);
242}
Eigen::Vector3d const & asEigenVector3d() const
Definition Point3d.h:55

References MathLib::Point3d::asEigenVector3d().

Referenced by GeoLib::MinimalBoundingSphere::MinimalBoundingSphere(), anonymous_namespace{MeshRevision.cpp}::constructFourNodeElement(), GeoLib::Polyline::isCoplanar(), anonymous_namespace{MeshRevision.cpp}::reducePrism(), and MeshLib::QuadRule::validate().

◆ isPointInTetrahedron()

bool MathLib::isPointInTetrahedron ( MathLib::Point3d const & p,
MathLib::Point3d const & a,
MathLib::Point3d const & b,
MathLib::Point3d const & c,
MathLib::Point3d const & d,
double eps = std::numeric_limits< double >::epsilon() )

Tests if the given point p is located within a tetrahedron spanned by points a, b, c, d. If the tet specified by a, b, c, d is degenerated (i.e. all points are coplanar) the function will return false because there is no meaningful concept of "inside" for such elements.

Parameters
ptest point
aedge node of tetrahedron
bedge node of tetrahedron
cedge node of tetrahedron
dedge node of tetrahedron
epsAccounts for numerical inaccuracies by allowing a point to be slightly outside of the element and still be regarded as inside.
Returns
true if the test point p is not located outside of abcd (i.e. inside or on a plane/edge).

Definition at line 44 of file GeometricBasics.cpp.

47{
48 double const d0(MathLib::orientation3d(d, a, b, c));
49 // if tetrahedron is not coplanar
50 if (std::abs(d0) > std::numeric_limits<double>::epsilon())
51 {
52 bool const d0_sign(d0 > 0);
53 // if p is on the same side of bcd as a
54 double const d1(MathLib::orientation3d(d, p, b, c));
55 if (!(d0_sign == (d1 >= 0) || std::abs(d1) < eps))
56 {
57 return false;
58 }
59 // if p is on the same side of acd as b
60 double const d2(MathLib::orientation3d(d, a, p, c));
61 if (!(d0_sign == (d2 >= 0) || std::abs(d2) < eps))
62 {
63 return false;
64 }
65 // if p is on the same side of abd as c
66 double const d3(MathLib::orientation3d(d, a, b, p));
67 if (!(d0_sign == (d3 >= 0) || std::abs(d3) < eps))
68 {
69 return false;
70 }
71 // if p is on the same side of abc as d
72 double const d4(MathLib::orientation3d(p, a, b, c));
73 return d0_sign == (d4 >= 0) || std::abs(d4) < eps;
74 }
75 return false;
76}

References orientation3d(), and p.

Referenced by MeshLib::HexRule::isPntInElement(), MeshLib::PrismRule::isPntInElement(), MeshLib::PyramidRule::isPntInElement(), and MeshLib::TetRule::isPntInElement().

◆ isPointInTriangle()

bool MathLib::isPointInTriangle ( MathLib::Point3d const & p,
MathLib::Point3d const & a,
MathLib::Point3d const & b,
MathLib::Point3d const & c,
double eps_pnt_out_of_plane = std::numeric_limits< float >::epsilon(),
double eps_pnt_out_of_tri = std::numeric_limits< float >::epsilon(),
MathLib::TriangleTest algorithm = MathLib::GAUSS )

Tests if the given point p is within the triangle, defined by its edge nodes a, b and c.Using two eps-values it is possible to test an 'epsilon' neighbourhood around the triangle as well as an 'epsilon' outside the triangles plane.

Parameters
ptest point
aedge node of triangle
bedge node of triangle
cedge node of triangle
eps_pnt_out_of_planeeps allowing for p to be slightly off the plane spanned by abc
eps_pnt_out_of_trieps allowing for p to be slightly off outside of abc
algorithmdefines the method to use
Returns
true if the test point p is within the 'epsilon'-neighbourhood of the triangle

Definition at line 78 of file GeometricBasics.cpp.

85{
86 switch (algorithm)
87 {
88 case MathLib::GAUSS:
89 return gaussPointInTriangle(p, a, b, c, eps_pnt_out_of_plane,
90 eps_pnt_out_of_tri);
92 return barycentricPointInTriangle(p, a, b, c, eps_pnt_out_of_plane,
93 eps_pnt_out_of_tri);
94 default:
95 ERR("Selected algorithm for point in triangle testing not found, "
96 "falling back on default.");
97 }
98 return gaussPointInTriangle(p, a, b, c, eps_pnt_out_of_plane,
99 eps_pnt_out_of_tri);
100}
bool gaussPointInTriangle(MathLib::Point3d const &q, MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c, double eps_pnt_out_of_plane, double eps_pnt_out_of_tri)
bool barycentricPointInTriangle(MathLib::Point3d const &p, MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c, double eps_pnt_out_of_plane, double eps_pnt_out_of_tri)

References BARYCENTRIC, barycentricPointInTriangle(), ERR(), GAUSS, gaussPointInTriangle(), and p.

Referenced by GeoLib::Triangle::containsPoint(), GeoLib::EarClippingTriangulation::isEar(), MeshLib::QuadRule::isPntInElement(), and MeshLib::TriRule::isPntInElement().

◆ isPointInTriangleXY()

bool MathLib::isPointInTriangleXY ( MathLib::Point3d const & p,
MathLib::Point3d const & a,
MathLib::Point3d const & b,
MathLib::Point3d const & c )

Checks if the point \(p'\) is in the triangle defined by the points \(a', b', c'\), where the \(p', a', b', c' \) are the orthogonal projections to the \(x\)- \(y\) plane of the points \(p, a, b, c\), respectively.

Definition at line 174 of file GeometricBasics.cpp.

178{
179 // criterion: p-a = u0 * (b-a) + u1 * (c-a); 0 <= u0, u1 <= 1, u0+u1 <= 1
180 Eigen::Matrix2d mat;
181 mat(0, 0) = b[0] - a[0];
182 mat(0, 1) = c[0] - a[0];
183 mat(1, 0) = b[1] - a[1];
184 mat(1, 1) = c[1] - a[1];
185 Eigen::Vector2d y;
186 y << p[0] - a[0], p[1] - a[1];
187
188 y = mat.partialPivLu().solve(y);
189
190 // check if u0 and u1 fulfills the condition
191 return 0 <= y[0] && y[0] <= 1 && 0 <= y[1] && y[1] <= 1 && y[0] + y[1] <= 1;
192}

References p.

Referenced by MeshLib::isPointInElementXY().

◆ lessEq()

bool MathLib::lessEq ( Point3d const & a,
Point3d const & b,
double eps = std::numeric_limits< double >::epsilon() )

Lexicographic comparison of points taking an epsilon into account.

Parameters
afirst input point.
bsecond input point.
epstolerance used in comparison of coordinates.
Returns
true, if a is smaller than or equal to b according to the following test \( |a_i - b_i| > \epsilon \cdot \min (|a_i|, |b_i|) \) and \( |a_i - b_i| > \epsilon \) for all coordinates \( 0 \le i < 3 \).

Definition at line 24 of file Point3d.cpp.

25{
26 auto absAndRelDiffLargerThanEps = [eps](double const u,
27 double const v) -> bool
28 {
29 return std::abs(u - v) > eps * std::min(std::abs(v), std::abs(u)) &&
30 std::abs(u - v) > eps;
31 };
32
33 return std::lexicographical_compare(
34 a.data(), a.data() + 3, b.data(), b.data() + 3,
35 [&absAndRelDiffLargerThanEps](auto const u, auto const v)
36 {
37 if (absAndRelDiffLargerThanEps(u, v))
38 {
39 return u <= v;
40 }
41 return true;
42 });
43}

References MathLib::Point3d::data(), u, and v.

◆ operator*()

MathLib::Point3d MathLib::operator* ( Eigen::Matrix3d const & mat,
MathLib::Point3d const & p )

rotation of points

Parameters
mata rotation matrix
pa point to be transformed
Returns
a rotated point

Definition at line 12 of file Point3d.cpp.

14{
15 auto const& result = (mat * p.asEigenVector3d()).eval();
16 return MathLib::Point3d{{result[0], result[1], result[2]}};
17}

References p.

◆ operator<()

bool MathLib::operator< ( Point3d const & a,
Point3d const & b )
inline

Definition at line 62 of file Point3d.h.

63{
64 return std::lexicographical_compare(a.data(), a.data() + 3, b.data(),
65 b.data() + 3);
66}

References MathLib::Point3d::data().

◆ operator<<() [1/2]

std::ostream & MathLib::operator<< ( std::ostream & os,
const Point3d & p )
inline

overload the output operator for class Point

Definition at line 83 of file Point3d.h.

84{
85 os << p[0] << " " << p[1] << " " << p[2];
86 return os;
87}

References p.

◆ operator<<() [2/2]

std::ostream & MathLib::operator<< ( std::ostream & os,
MathLib::WeightedPoint const & wp )

Definition at line 11 of file WeightedPoint.cpp.

12{
13 auto const dim = wp.getDimension();
14 os << "WP[" << dim << "D]{{";
15 for (std::size_t comp = 0; comp < 3; ++comp)
16 {
17 if (comp != 0)
18 {
19 os << ", ";
20 }
21 os << wp[comp];
22 }
23 os << "}, weight=" << wp.getWeight() << '}';
24 return os;
25}

References MathLib::WeightedPoint::getDimension(), and MathLib::WeightedPoint::getWeight().

◆ operator==()

bool MathLib::operator== ( Point3d const & a,
Point3d const & b )
inline

Equality of Point3d's up to an epsilon.

Definition at line 105 of file Point3d.h.

106{
107 auto const sqr_dist(sqrDist(a, b));
108 auto const eps = std::numeric_limits<double>::epsilon();
109 return (sqr_dist < eps * eps);
110}

References sqrDist().

◆ orientation3d()

double MathLib::orientation3d ( MathLib::Point3d const & p,
MathLib::Point3d const & a,
MathLib::Point3d const & b,
MathLib::Point3d const & c )

Checks if a point p is on the left or right side of a plane spanned by three points a, b, c.

Parameters
ppoint to test
afirst point on plane
bsecond point on plane
cthird point on plane
Returns
If the triangle abc is ordered counterclockwise when viewed from p, the method will return a negative value, otherwise it will return a positive value. If p is coplanar with abc, the function will return 0.

Definition at line 13 of file GeometricBasics.cpp.

17{
18 Eigen::Vector3d const u = p.asEigenVector3d() - a.asEigenVector3d();
19 Eigen::Vector3d const v = p.asEigenVector3d() - b.asEigenVector3d();
20 Eigen::Vector3d const w = p.asEigenVector3d() - c.asEigenVector3d();
21 return u.cross(v).dot(w);
22}

References MathLib::Point3d::asEigenVector3d(), p, u, and v.

Referenced by barycentricPointInTriangle(), and isPointInTetrahedron().

◆ parsePiecewiseLinearCurveConfig()

PiecewiseLinearCurveConfig MathLib::parsePiecewiseLinearCurveConfig ( BaseLib::ConfigTree const & config)
Input File Parameter
curve__read_from_file
Input File Parameter
curve__coords
Input File Parameter
curve__values
Input File Parameter
curve__coords
Input File Parameter
curve__values

Definition at line 18 of file CreatePiecewiseLinearCurve.cpp.

20{
21 const bool read_from_file =
22 config.getConfigParameter<bool>("read_from_file", false);
23
24 std::vector<double> x;
25 std::vector<double> y;
26
27 if (read_from_file == true)
28 {
29 auto const coords_file_name =
31 config.getConfigParameter<std::string>("coords");
32
33 auto const values_file_name =
35 config.getConfigParameter<std::string>("values");
36
38 coords_file_name, config.projectDirectory().string());
39
41 values_file_name, config.projectDirectory().string());
42 }
43 else
44 {
45 x =
47 config.getConfigParameter<std::vector<double>>("coords");
48 y =
50 config.getConfigParameter<std::vector<double>>("values");
51 }
52
53 if (x.empty() || y.empty())
54 {
55 OGS_FATAL("The given coordinates or values vector is empty.");
56 }
57 if (x.size() != y.size())
58 {
60 "The given coordinates and values vector sizes are "
61 "different.");
62 }
63
64 return {std::move(x), std::move(y)};
65}
std::vector< double > readDoublesFromBinaryFile(const std::string &filename, const std::string &project_directory)

References BaseLib::ConfigTree::getConfigParameter(), OGS_FATAL, BaseLib::ConfigTree::projectDirectory(), and BaseLib::readDoublesFromBinaryFile().

Referenced by createPiecewiseLinearCurve().

◆ setMatrix() [1/2]

void MathLib::setMatrix ( PETScMatrix & m,
Eigen::MatrixXd const & tmp )

Definition at line 41 of file UnifiedMatrixSetters.cpp.

42{
43 using IndexType = PETScMatrix::IndexType;
44
45 auto const rows = tmp.rows();
46 auto const cols = tmp.cols();
47
48 assert(rows == m.getNumberOfRows() && cols == m.getNumberOfColumns());
49
50 m.setZero();
51 std::vector<IndexType> row_idcs(rows);
52 std::vector<IndexType> col_idcs(cols);
53
54 std::iota(row_idcs.begin(), row_idcs.end(), 0);
55 std::iota(col_idcs.begin(), col_idcs.end(), 0);
56
57 // PETSc wants row-major
58 Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
59 tmp_ = tmp;
60
61 m.add(row_idcs, col_idcs, tmp_);
62}
void setZero()
Set all entries to zero.
Definition PETScMatrix.h:84

References MathLib::PETScMatrix::add(), MathLib::PETScMatrix::getNumberOfColumns(), MathLib::PETScMatrix::getNumberOfRows(), and MathLib::PETScMatrix::setZero().

◆ setMatrix() [2/2]

void MathLib::setMatrix ( PETScMatrix & m,
std::initializer_list< double > values )

Definition at line 35 of file UnifiedMatrixSetters.cpp.

36{
37 m.setZero();
38 addToMatrix(m, values);
39}
void addToMatrix(PETScMatrix &m, std::initializer_list< double > values)

References addToMatrix(), and MathLib::PETScMatrix::setZero().

◆ setMatrixSparsity()

template<typename MATRIX, typename SPARSITY_PATTERN>
void MathLib::setMatrixSparsity ( MATRIX & matrix,
SPARSITY_PATTERN const & sparsity_pattern )

Sets the sparsity pattern of the underlying matrix. To allow partial specialization a SetMatrixSparsity template is instantiated, to which the matrix and the sparsity_pattern are passed.

Definition at line 25 of file SetMatrixSparsity.h.

26{
28 set_sparsity(matrix, sparsity_pattern);
29}

Referenced by ProcessLib::HeatTransportBHE::HeatTransportBHEProcess::assembleConcreteProcess().

◆ setVector() [1/2]

void MathLib::setVector ( PETScVector & v,
MatrixVectorTraits< PETScVector >::Index const index,
double const value )

Definition at line 28 of file UnifiedMatrixSetters.cpp.

31{
32 v.set(index, value); // TODO handle negative indices
33}

References v.

◆ setVector() [2/2]

void MathLib::setVector ( PETScVector & v,
std::initializer_list< double > values )

Definition at line 19 of file UnifiedMatrixSetters.cpp.

20{
21 std::vector<double> const vals(values);
22 std::vector<PETScVector::IndexType> idcs(vals.size());
23 std::iota(idcs.begin(), idcs.end(), 0);
24
25 v.set(idcs, vals);
26}

References v.

Referenced by detail::applyKnownSolutions().

◆ SPECIALIZE_MATRIX_VECTOR_TRAITS() [1/2]

MathLib::SPECIALIZE_MATRIX_VECTOR_TRAITS ( PETScMatrix ,
PETScMatrix::IndexType  )

◆ SPECIALIZE_MATRIX_VECTOR_TRAITS() [2/2]

MathLib::SPECIALIZE_MATRIX_VECTOR_TRAITS ( PETScVector ,
PETScVector::IndexType  )

◆ sqrDist()

◆ sqrDist2d()

double MathLib::sqrDist2d ( MathLib::Point3d const & p0,
MathLib::Point3d const & p1 )
inline

Computes the squared distance between the orthogonal projection of the two points p0 and p1 onto the \(xy\)-plane.

Definition at line 114 of file Point3d.h.

115{
116 return (p0[0] - p1[0]) * (p0[0] - p1[0]) +
117 (p0[1] - p1[1]) * (p0[1] - p1[1]);
118}

Referenced by MeshLib::isPointInElementXY(), GeoLib::lineSegmentIntersect2d(), and MeshGeoToolsLib::snapPointToElementNode().

◆ toMatrix() [1/4]

template<typename Matrix>
Eigen::Map< Matrix > MathLib::toMatrix ( std::vector< double > & data,
Eigen::MatrixXd::Index rows,
Eigen::MatrixXd::Index cols )

Creates an Eigen mapped matrix from the given data vector.

Attention
The data vector must have the same storage order (row or column major) as the requested matrix type.

Definition at line 104 of file EigenMapTools.h.

107{
108 static_assert(Matrix::IsRowMajor || Matrix::IsVectorAtCompileTime,
109 "The default storage order in OGS is row major storage for "
110 "dense matrices.");
111 assert(Matrix::RowsAtCompileTime == Eigen::Dynamic ||
112 Matrix::RowsAtCompileTime == rows);
113 assert(Matrix::ColsAtCompileTime == Eigen::Dynamic ||
114 Matrix::ColsAtCompileTime == cols);
115 assert(static_cast<Eigen::MatrixXd::Index>(data.size()) == rows * cols);
116
117 return {data.data(), rows, cols};
118}

◆ toMatrix() [2/4]

Eigen::Map< Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > > MathLib::toMatrix ( std::vector< double > & data,
Eigen::MatrixXd::Index rows,
Eigen::MatrixXd::Index cols )
inline

Creates an Eigen mapped matrix from the given data vector.

This is a convenience method which makes the specification of dynamically allocated Eigen matrices as return type easier.

Definition at line 127 of file EigenMapTools.h.

130{
131 return toMatrix<
132 Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>>(
133 data, rows, cols);
134}
Eigen::Map< const Matrix > toMatrix(std::vector< double > const &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)

References toMatrix().

◆ toMatrix() [3/4]

template<typename Matrix>
Eigen::Map< const Matrix > MathLib::toMatrix ( std::vector< double > const & data,
Eigen::MatrixXd::Index rows,
Eigen::MatrixXd::Index cols )

Creates an Eigen mapped matrix from the given data vector.

Attention
The data vector must have the same storage order (row or column major) as the requested matrix type.

Definition at line 65 of file EigenMapTools.h.

68{
69 static_assert(Matrix::IsRowMajor || Matrix::IsVectorAtCompileTime,
70 "The default storage order in OGS is row major storage for "
71 "dense matrices.");
72 assert(Matrix::RowsAtCompileTime == Eigen::Dynamic ||
73 Matrix::RowsAtCompileTime == rows);
74 assert(Matrix::ColsAtCompileTime == Eigen::Dynamic ||
75 Matrix::ColsAtCompileTime == cols);
76 assert(static_cast<Eigen::MatrixXd::Index>(data.size()) == rows * cols);
77
78 return {data.data(), rows, cols};
79}

Referenced by ProcessLib::Assembly::MatrixElementCache< Dim >::add(), ProcessLib::VectorMatrixAssembler::assemble(), ProcessLib::ComponentTransport::ComponentTransportLocalAssemblerInterface::assembleReactionEquation(), ProcessLib::CentralDifferencesJacobianAssembler::assembleWithJacobian(), ProcessLib::CompareJacobiansJacobianAssembler::assembleWithJacobian(), ProcessLib::ForwardDifferencesJacobianAssembler::assembleWithJacobian(), ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::assembleWithJacobian(), ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::assembleWithJacobian(), ProcessLib::VectorMatrixAssembler::assembleWithJacobian(), NumLib::LocalLinearLeastSquaresExtrapolator::calculateResidualElement(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::computeSecondaryVariableConcrete(), NumLib::LocalLinearLeastSquaresExtrapolator::extrapolateElement(), toMatrix(), toMatrix(), ProcessLib::transposeInPlace(), ProcessLib::transposeInPlace(), and ProcessLib::transposeInPlace().

◆ toMatrix() [4/4]

Eigen::Map< const Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > > MathLib::toMatrix ( std::vector< double > const & data,
Eigen::MatrixXd::Index rows,
Eigen::MatrixXd::Index cols )
inline

Creates an Eigen mapped matrix from the given data vector.

This is a convenience method which makes the specification of dynamically allocated Eigen matrices as return type easier.

Definition at line 89 of file EigenMapTools.h.

92{
93 return toMatrix<
94 Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>>(
95 data, rows, cols);
96}

References toMatrix().

◆ toVector() [1/4]

Eigen::Map< Eigen::VectorXd > MathLib::toVector ( std::vector< double > & data)
inline

Creates an Eigen mapped vector from the given data vector.

This is a convenience method which makes the specification of dynamically allocated Eigen vectors as return type easier.

Definition at line 200 of file EigenMapTools.h.

201{
202 return {data.data(), static_cast<Eigen::VectorXd::Index>(data.size())};
203}

◆ toVector() [2/4]

template<typename Vector>
Eigen::Map< Vector > MathLib::toVector ( std::vector< double > & data,
Eigen::VectorXd::Index size )

Creates an Eigen mapped vector from the given data vector.

Definition at line 173 of file EigenMapTools.h.

175{
176 static_assert(Vector::IsVectorAtCompileTime, "A vector type is required.");
177 assert(Vector::SizeAtCompileTime == Eigen::Dynamic ||
178 Vector::SizeAtCompileTime == size);
179 assert(static_cast<Eigen::VectorXd::Index>(data.size()) == size);
180
181 return {data.data(), size};
182}

◆ toVector() [3/4]

Eigen::Map< const Eigen::VectorXd > MathLib::toVector ( std::vector< double > const & data)
inline

Creates an Eigen mapped vector from the given data vector.

This is a convenience method which makes the specification of dynamically allocated Eigen vectors as return type easier.

Definition at line 189 of file EigenMapTools.h.

191{
192 return {data.data(), static_cast<Eigen::VectorXd::Index>(data.size())};
193}

◆ toVector() [4/4]

template<typename Vector>
Eigen::Map< const Vector > MathLib::toVector ( std::vector< double > const & data,
Eigen::VectorXd::Index size )

Creates an Eigen mapped vector from the given data vector.

Definition at line 160 of file EigenMapTools.h.

162{
163 static_assert(Vector::IsVectorAtCompileTime, "A vector type is required.");
164 assert(Vector::SizeAtCompileTime == Eigen::Dynamic ||
165 Vector::SizeAtCompileTime == size);
166 assert(static_cast<Eigen::VectorXd::Index>(data.size()) == size);
167
168 return {data.data(), size};
169}

Referenced by ProcessLib::BoundaryConditionAndSourceTerm::Python::BcAndStLocalAssemblerImpl< BcOrStData, ShapeFunction, LowerOrderShapeFunction, GlobalDim >::assemble(), ProcessLib::RobinBoundaryConditionLocalAssembler< ShapeFunction, GlobalDim >::assemble(), ProcessLib::VectorMatrixAssembler::assemble(), anonymous_namespace{ParallelVectorMatrixAssembler.cpp}::assembleForStaggeredSchemeOneElement(), ProcessLib::LiquidFlow::LiquidFlowLocalAssembler< ShapeFunction, GlobalDim >::assembleMatrixAndVector(), ProcessLib::ComponentTransport::ComponentTransportLocalAssemblerInterface::assembleReactionEquation(), ProcessLib::CentralDifferencesJacobianAssembler::assembleWithJacobian(), ProcessLib::CompareJacobiansJacobianAssembler::assembleWithJacobian(), ProcessLib::ForwardDifferencesJacobianAssembler::assembleWithJacobian(), ProcessLib::VectorMatrixAssembler::assembleWithJacobian(), anonymous_namespace{ParallelVectorMatrixAssembler.cpp}::assembleWithJacobianForStaggeredSchemeOneElement(), ProcessLib::LiquidFlow::LiquidFlowLocalAssembler< ShapeFunction, GlobalDim >::computeProjectedDarcyVelocity(), ProcessLib::LocalAssemblerInterface::computeSecondaryVariable(), MathLib::EigenVector::copyValues(), ProcessLib::ComponentTransport::createComponentTransportProcess(), ProcessLib::HT::createHTProcess(), ProcessLib::LiquidFlow::createLiquidFlowProcess(), ProcessLib::RichardsComponentTransport::createRichardsComponentTransportProcess(), ProcessLib::RichardsFlow::createRichardsFlowProcess(), ProcessLib::ThermalTwoPhaseFlowWithPP::createThermalTwoPhaseFlowWithPPProcess(), ProcessLib::TwoPhaseFlowWithPP::createTwoPhaseFlowWithPPProcess(), ProcessLib::WellboreSimulator::createWellboreSimulatorProcess(), NumLib::LocalLinearLeastSquaresExtrapolator::extrapolateElement(), MaterialLib::Solids::Ehlers::SolidEhlers< DisplacementDim >::getInternalVariables(), ProcessLib::SteadyStateDiffusion::LocalAssemblerData< ShapeFunction, GlobalDim >::getIntPtDarcyVelocity(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::getIntPtMolarFlux(), NumLib::getLocalX(), ProcessLib::EmbeddedAnchor< GlobalDim >::getShapeMatricesAndGlobalIndicesAndDisplacements(), ProcessLib::ComponentTransport::ComponentTransportLocalAssemblerInterface::initializeChemicalSystem(), ProcessLib::AnchorTerm< GlobalDim >::integrate(), ProcessLib::Assembly::LocalMatrixOutput::operator()(), ProcessLib::Assembly::LocalMatrixOutput::operator()(), ProcessLib::Deformation::CollectIntegrationPointDataForExtrapolation< InternalVariable >::operator()(), and ProcessLib::ComponentTransport::ComponentTransportLocalAssemblerInterface::setChemicalSystem().

Variable Documentation

◆ GaussLegendre< 1 >::W

template<>
double const MathLib::GaussLegendre< 1 >::W[1] = {2.}

Definition at line 11 of file GaussLegendre.cpp.

11{2.};

◆ GaussLegendre< 1 >::X

template<>
double const MathLib::GaussLegendre< 1 >::X[1] = {0.}

Definition at line 9 of file GaussLegendre.cpp.

9{0.};

Referenced by MathLib::LinAlg::axpy(), and MathLib::LinAlg::aypx().

◆ GaussLegendre< 2 >::W

template<>
double const MathLib::GaussLegendre< 2 >::W[2] = {1., 1.}

Definition at line 16 of file GaussLegendre.cpp.

16{1., 1.};

◆ GaussLegendre< 2 >::X

template<>
double const MathLib::GaussLegendre< 2 >::X[2] = {0.577350269189626, -0.577350269189626}

Definition at line 14 of file GaussLegendre.cpp.

14{0.577350269189626, -0.577350269189626};

◆ GaussLegendre< 3 >::W

template<>
double const MathLib::GaussLegendre< 3 >::W[3] = {5. / 9, 8. / 9, 5. / 9}

Definition at line 22 of file GaussLegendre.cpp.

22{5. / 9, 8. / 9, 5. / 9};

◆ GaussLegendre< 3 >::X

template<>
double const MathLib::GaussLegendre< 3 >::X[3]
Initial value:
= {0.774596669241483, 0.,
-0.774596669241483}

Definition at line 19 of file GaussLegendre.cpp.

19 {0.774596669241483, 0.,
20 -0.774596669241483};

◆ GaussLegendre< 4 >::W

template<>
double const MathLib::GaussLegendre< 4 >::W[4]
Initial value:
= {0.347854845137454, 0.652145154862546,
0.652145154862546, 0.347854845137454}

Definition at line 28 of file GaussLegendre.cpp.

28 {0.347854845137454, 0.652145154862546,
29 0.652145154862546, 0.347854845137454};

◆ GaussLegendre< 4 >::X

template<>
double const MathLib::GaussLegendre< 4 >::X[4]
Initial value:
= {-0.861136311594053, -0.339981043584856,
0.339981043584856, 0.861136311594053}

Definition at line 25 of file GaussLegendre.cpp.

25 {-0.861136311594053, -0.339981043584856,
26 0.339981043584856, 0.861136311594053};

◆ GaussLegendrePyramid< 1 >::W

template<>
double const MathLib::GaussLegendrePyramid< 1 >::W[1] = {128. / 27.}

Definition at line 12 of file GaussLegendrePyramid.cpp.

12{128. / 27.};

◆ GaussLegendrePyramid< 1 >::X

template<>
const std::array<std::array<double, 3>, GaussLegendrePyramid<1>::NPoints> MathLib::GaussLegendrePyramid< 1 >::X = {{{{0, 0, -0.5}}}}

Definition at line 10 of file GaussLegendrePyramid.cpp.

10{{{{0, 0, -0.5}}}}; // center of mass

◆ GaussLegendrePyramid< 2 >::W

double const MathLib::GaussLegendrePyramid< 2 >::W[5]
Initial value:
= {
81. / 100., 81. / 100., 81. / 100., 81. / 100., 125. / 27.}

Definition at line 21 of file GaussLegendrePyramid.cpp.

21 {
22 81. / 100., 81. / 100., 81. / 100., 81. / 100., 125. / 27.};

◆ GaussLegendrePyramid< 2 >::X

const std::array<std::array<double, 3>, GaussLegendrePyramid<2>::NPoints> MathLib::GaussLegendrePyramid< 2 >::X
Initial value:
= {
{{{-0.584237394672177188, -0.584237394672177188, -2. / 3.}},
{{0.584237394672177188, -0.584237394672177188, -2. / 3.}},
{{0.584237394672177188, 0.584237394672177188, -2. / 3.}},
{{-0.584237394672177188, 0.584237394672177188, -2. / 3.}},
{{0., 0., 2. / 5.}}}}

Definition at line 15 of file GaussLegendrePyramid.cpp.

15 {
16 {{{-0.584237394672177188, -0.584237394672177188, -2. / 3.}},
17 {{0.584237394672177188, -0.584237394672177188, -2. / 3.}},
18 {{0.584237394672177188, 0.584237394672177188, -2. / 3.}},
19 {{-0.584237394672177188, 0.584237394672177188, -2. / 3.}},
20 {{0., 0., 2. / 5.}}}};

◆ GaussLegendrePyramid< 3 >::W

double const MathLib::GaussLegendrePyramid< 3 >::W[13]
Initial value:
= {
0.515003019323671498, 0.515003019323671498, 0.515003019323671498,
0.515003019323671498, 0.257183745242064659, 0.257183745242064659,
0.257183745242064659, 0.257183745242064659, 2.474004977113405936,
0.419515737191525950, 0.419515737191525950, 0.419515737191525950,
0.419515737191525950}

Definition at line 42 of file GaussLegendrePyramid.cpp.

42 {
43 0.515003019323671498, 0.515003019323671498, 0.515003019323671498,
44 0.515003019323671498, 0.257183745242064659, 0.257183745242064659,
45 0.257183745242064659, 0.257183745242064659, 2.474004977113405936,
46 0.419515737191525950, 0.419515737191525950, 0.419515737191525950,
47 0.419515737191525950};

◆ GaussLegendrePyramid< 3 >::X

const std::array<std::array<double, 3>, GaussLegendrePyramid<3>::NPoints> MathLib::GaussLegendrePyramid< 3 >::X
Initial value:
= {
{{{-0.673931986207731726, -0.673931986207731726,
-0.142857142857142857}},
{{0.673931986207731726, -0.673931986207731726, -0.142857142857142857}},
{{0.673931986207731726, 0.673931986207731726, -0.142857142857142857}},
{{-0.673931986207731726, 0.673931986207731726, -0.142857142857142857}},
{{-0.610639618865075532, 0.0, -0.321428571428571429}},
{{0.610639618865075532, 0.0, -0.321428571428571429}},
{{0.0, -0.610639618865075532, -0.321428571428571429}},
{{0.0, 0.610639618865075532, -0.321428571428571429}},
{{0.0, 0.0, 0.524394036075370072}},
{{-0.580939660561084423, -0.580939660561084423,
-0.830065359477124183}},
{{0.580939660561084423, -0.580939660561084423, -0.830065359477124183}},
{{0.580939660561084423, 0.580939660561084423, -0.830065359477124183}},
{{-0.580939660561084423, 0.580939660561084423,
-0.830065359477124183}}}}

Definition at line 25 of file GaussLegendrePyramid.cpp.

25 {
26 {{{-0.673931986207731726, -0.673931986207731726,
27 -0.142857142857142857}},
28 {{0.673931986207731726, -0.673931986207731726, -0.142857142857142857}},
29 {{0.673931986207731726, 0.673931986207731726, -0.142857142857142857}},
30 {{-0.673931986207731726, 0.673931986207731726, -0.142857142857142857}},
31 {{-0.610639618865075532, 0.0, -0.321428571428571429}},
32 {{0.610639618865075532, 0.0, -0.321428571428571429}},
33 {{0.0, -0.610639618865075532, -0.321428571428571429}},
34 {{0.0, 0.610639618865075532, -0.321428571428571429}},
35 {{0.0, 0.0, 0.524394036075370072}},
36 {{-0.580939660561084423, -0.580939660561084423,
37 -0.830065359477124183}},
38 {{0.580939660561084423, -0.580939660561084423, -0.830065359477124183}},
39 {{0.580939660561084423, 0.580939660561084423, -0.830065359477124183}},
40 {{-0.580939660561084423, 0.580939660561084423,
41 -0.830065359477124183}}}};

◆ GaussLegendreTet< 1 >::W

template<>
double const MathLib::GaussLegendreTet< 1 >::W[1] = {1. / 6.}

Definition at line 12 of file GaussLegendreTet.cpp.

12{1. / 6.};

◆ GaussLegendreTet< 1 >::X

template<>
const std::array<std::array<double, 3>, GaussLegendreTet<1>::NPoints> MathLib::GaussLegendreTet< 1 >::X = {{{{1. / 4., 1. / 4., 1. / 4.}}}}

Definition at line 10 of file GaussLegendreTet.cpp.

10{{{{1. / 4., 1. / 4., 1. / 4.}}}};

◆ GaussLegendreTet< 2 >::W

double const MathLib::GaussLegendreTet< 2 >::W[5]
Initial value:
= {-2. / 15., 0.075, 0.075, 0.075,
0.075}

Definition at line 20 of file GaussLegendreTet.cpp.

20 {-2. / 15., 0.075, 0.075, 0.075,
21 0.075};

◆ GaussLegendreTet< 2 >::X

const std::array<std::array<double, 3>, GaussLegendreTet<2>::NPoints> MathLib::GaussLegendreTet< 2 >::X
Initial value:
= {{{{1. / 4., 1. / 4., 1. / 4.}},
{{1. / 6., 1. / 6., 1. / 6.}},
{{1. / 2., 1. / 6., 1. / 6.}},
{{1. / 6., 1. / 2., 1. / 6.}},
{{1. / 6., 1. / 6., 1. / 2.}}}}

Definition at line 15 of file GaussLegendreTet.cpp.

15 {{{{1. / 4., 1. / 4., 1. / 4.}},
16 {{1. / 6., 1. / 6., 1. / 6.}},
17 {{1. / 2., 1. / 6., 1. / 6.}},
18 {{1. / 6., 1. / 2., 1. / 6.}},
19 {{1. / 6., 1. / 6., 1. / 2.}}}};

◆ GaussLegendreTet< 3 >::W

double const MathLib::GaussLegendreTet< 3 >::W[GaussLegendreTet< 3 >::NPoints]
Initial value:
= {
p, p, p, p, q, q, q, q, r, r, r, r, r, r}

Definition at line 59 of file GaussLegendreTet.cpp.

59 {
60 p, p, p, p, q, q, q, q, r, r, r, r, r, r};

◆ GaussLegendreTet< 3 >::X

const std::array<std::array<double, 3>, GaussLegendreTet<3>::NPoints> MathLib::GaussLegendreTet< 3 >::X = initGLTet3X()

Definition at line 53 of file GaussLegendreTet.cpp.

◆ GaussLegendreTet< 4 >::W

double const MathLib::GaussLegendreTet< 4 >::W[GaussLegendreTet< 4 >::NPoints]
Initial value:
= {
s, s, s, s, t, t, t, t, u, u, u, u, u, u, v, v, v, v, v, v}
static const double t

Definition at line 100 of file GaussLegendreTet.cpp.

100 {
101 s, s, s, s, t, t, t, t, u, u, u, u, u, u, v, v, v, v, v, v};

◆ GaussLegendreTet< 4 >::X

const std::array<std::array<double, 3>, GaussLegendreTet<4>::NPoints> MathLib::GaussLegendreTet< 4 >::X = initGLTet4X()

Definition at line 93 of file GaussLegendreTet.cpp.

◆ GaussLegendreTri< 1 >::W

template<>
double const MathLib::GaussLegendreTri< 1 >::W[1] = {1.0}

Definition at line 12 of file GaussLegendreTri.cpp.

12{1.0};

◆ GaussLegendreTri< 1 >::X

template<>
const std::array<std::array<double, 2>, GaussLegendreTri<1>::NPoints> MathLib::GaussLegendreTri< 1 >::X = {{{{1. / 3., 1. / 3.}}}}

Definition at line 10 of file GaussLegendreTri.cpp.

10{{{{1. / 3., 1. / 3.}}}};

◆ GaussLegendreTri< 2 >::W

double const MathLib::GaussLegendreTri< 2 >::W[3] = {1. / 3., 1. / 3., 1. / 3.}

Definition at line 17 of file GaussLegendreTri.cpp.

17{1. / 3., 1. / 3., 1. / 3.};

◆ GaussLegendreTri< 2 >::X

const std::array<std::array<double, 2>, GaussLegendreTri<2>::NPoints> MathLib::GaussLegendreTri< 2 >::X
Initial value:
= {
{{{1. / 6., 1. / 6.}}, {{2. / 3., 1. / 6.}}, {{1. / 6., 2. / 3.}}}}

Definition at line 15 of file GaussLegendreTri.cpp.

15 {
16 {{{1. / 6., 1. / 6.}}, {{2. / 3., 1. / 6.}}, {{1. / 6., 2. / 3.}}}};

◆ GaussLegendreTri< 3 >::W

double const MathLib::GaussLegendreTri< 3 >::W[4]
Initial value:
= {-27. / 48., 25. / 48., 25. / 48.,
25. / 48.}

Definition at line 24 of file GaussLegendreTri.cpp.

24 {-27. / 48., 25. / 48., 25. / 48.,
25 25. / 48.};

◆ GaussLegendreTri< 3 >::X

const std::array<std::array<double, 2>, GaussLegendreTri<3>::NPoints> MathLib::GaussLegendreTri< 3 >::X
Initial value:
= {{{{1. / 3., 1. / 3.}},
{{1. / 5., 3. / 5.}},
{{1. / 5., 1. / 5.}},
{{3. / 5., 1. / 5.}}}}

Definition at line 20 of file GaussLegendreTri.cpp.

20 {{{{1. / 3., 1. / 3.}},
21 {{1. / 5., 3. / 5.}},
22 {{1. / 5., 1. / 5.}},
23 {{3. / 5., 1. / 5.}}}};

◆ GaussLegendreTri< 4 >::W

double const MathLib::GaussLegendreTri< 4 >::W[7]
Initial value:
= {0.225,
0.132394152788506,
0.132394152788506,
0.132394152788506,
0.125939180544827,
0.125939180544827,
0.125939180544827}

Definition at line 35 of file GaussLegendreTri.cpp.

35 {0.225,
36 0.132394152788506,
37 0.132394152788506,
38 0.132394152788506,
39 0.125939180544827,
40 0.125939180544827,
41 0.125939180544827};

◆ GaussLegendreTri< 4 >::X

const std::array<std::array<double, 2>, GaussLegendreTri<4>::NPoints> MathLib::GaussLegendreTri< 4 >::X
Initial value:
= {{{{1. / 3., 1. / 3.}},
{{0.059715871789770, 0.470142064105115}},
{{0.470142064105115, 0.059715871789770}},
{{0.470142064105115, 0.470142064105115}},
{{0.797426985353087, 0.101286507323456}},
{{0.101286507323456, 0.797426985353087}},
{{0.101286507323456, 0.101286507323456}}}}

Definition at line 28 of file GaussLegendreTri.cpp.

28 {{{{1. / 3., 1. / 3.}},
29 {{0.059715871789770, 0.470142064105115}},
30 {{0.470142064105115, 0.059715871789770}},
31 {{0.470142064105115, 0.470142064105115}},
32 {{0.797426985353087, 0.101286507323456}},
33 {{0.101286507323456, 0.797426985353087}},
34 {{0.101286507323456, 0.101286507323456}}}};

◆ ORIGIN

MATHLIB_EXPORT const Point3d MathLib::ORIGIN {{{0.0, 0.0, 0.0}}}
extern

Definition at line 89 of file Point3d.h.

Referenced by MeshLib::getBulkElementPoint(), and getOrigin().

◆ p

◆ q

const double MathLib::q = 0.0734930431163619 / 6.
static

Definition at line 56 of file GaussLegendreTet.cpp.

Referenced by gaussPointInTriangle().

◆ r

const double MathLib::r = 0.0425460207770812 / 6.
static

Definition at line 57 of file GaussLegendreTet.cpp.

Referenced by addToMatrix().

◆ s

◆ t

◆ u

◆ v

const double MathLib::v = 2679769. / 32305455. / 6.
static

Definition at line 98 of file GaussLegendreTet.cpp.

Referenced by MathLib::KahanSum::KahanSum(), MathLib::EigenVector::add(), MathLib::LisMatrix::add(), MathLib::LisVector::add(), calcProjPntToLineAndDists(), calcTetrahedronVolume(), calcTriangleArea(), MathLib::KelvinVector::Invariants< KelvinVectorSize >::determinant(), MathLib::KelvinVector::Invariants< KelvinVectorSize >::determinant(), MathLib::KelvinVector::Invariants< KelvinVectorSize >::determinant(), MathLib::KelvinVector::Invariants< KelvinVectorSize >::diagonal(), MathLib::KelvinVector::fourthOrderRotationMatrix< 2 >(), gaussPointInTriangle(), MathLib::LisVector::get(), MathLib::Nonlinear::AndersonBjorck::get_m(), MaterialLib::Solids::MFront::MFrontGeneric< DisplacementDim, boost::mp11::mp_list< Strain >, boost::mp11::mp_list< Stress >, boost::mp11::mp_list< Temperature > >::integrateStress(), MathLib::KelvinVector::inverse(), MathLib::KelvinVector::inverse(), MathLib::KelvinVector::inverse(), MathLib::KelvinVector::kelvinVectorToSymmetricTensor(), MathLib::KelvinVector::kelvinVectorToSymmetricTensor(), MathLib::KelvinVector::kelvinVectorToSymmetricTensor(), MathLib::KelvinVector::kelvinVectorToTensor(), MathLib::KelvinVector::kelvinVectorToTensor(), MathLib::KelvinVector::kelvinVectorToTensor(), MathLib::KelvinVector::kelvinVectorToTensor(), lessEq(), MathLib::KelvinVector::liftVectorToKelvin(), orientation3d(), MathLib::EigenVector::set(), MathLib::LisVector::set(), MathLib::LisMatrix::setValue(), setVector(), setVector(), MathLib::PETScVector::shallowCopy(), MathLib::KelvinVector::symmetricTensorToKelvinVector(), and MathLib::KelvinVector::Invariants< KelvinVectorSize >::trace().