OGS
Tensor.h
Go to the documentation of this file.
1
/*
2
* \file
3
* \copyright
4
* Copyright (c) 2012-2024, OpenGeoSys Community (http://www.opengeosys.org)
5
* Distributed under a Modified BSD License.
6
* See accompanying file LICENSE.txt or
7
* http://www.opengeosys.org/project/license
8
*/
9
10
#pragma once
11
12
#include <Eigen/Core>
13
14
#include "
MaterialLib/MPL/Property.h
"
15
16
namespace
MaterialPropertyLib
17
{
19
constexpr
int
tensorSize
(
int
dim)
20
{
21
if
(dim == 1)
22
{
23
return
3;
// Diagonal entries.
24
}
25
if
(dim == 2)
26
{
27
return
5;
// 2x2 matrix and the 3rd diagonal entry.
28
}
29
if
(dim == 3)
30
{
31
return
9;
// Full 3x3 matrix.
32
}
33
OGS_FATAL
(
"Tensor size for dimension {} is not defined."
, dim);
34
}
35
51
template
<
int
Dim>
52
using
Tensor
= Eigen::Matrix<double,
tensorSize
(Dim), 1>;
53
54
}
// namespace MaterialPropertyLib
OGS_FATAL
#define OGS_FATAL(...)
Definition
Error.h:26
Property.h
MaterialPropertyLib
Definition
ChemicalSolverInterface.h:21
MaterialPropertyLib::Tensor
Eigen::Matrix< double, tensorSize(Dim), 1 > Tensor
Definition
Tensor.h:52
MaterialPropertyLib::tensorSize
constexpr int tensorSize(int dim)
See Tensor type for details.
Definition
Tensor.h:19
MaterialLib
MPL
Utils
Tensor.h
Generated by
1.12.0