Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
include
FEM
Constant.h
Go to the documentation of this file.
1
/* This file is part of MoDELib, the Mechanics Of Defects Evolution Library.
2
*
3
*
4
* MoDELib is distributed without any warranty under the
5
* GNU General Public License (GPL) v2 <http://www.gnu.org/licenses/>.
6
*/
7
8
#ifndef model_Constatnt_H_
9
#define model_Constatnt_H_
10
11
#include <memory>
12
#include <utility>
// for std::move
13
14
#include <Eigen/Dense>
15
//#include <EvalExpression.h>
16
#include <
EvalFunction.h
>
17
18
19
namespace
model
20
{
21
template
<
typename
T,
int
_rows,
int
_cols>
22
struct
Constant
:
public
EvalFunction
<Constant<T,_rows,_cols> >
23
{
24
constexpr
static
int
rows
=_rows;
25
constexpr
static
int
cols
=_cols;
26
27
const
T
c
;
28
Constant
(
const
T& c_in) :
c
(c_in)
29
{
30
}
31
32
template
<
typename
ElementType,
typename
BaryType>
33
const
T&
operator()
(
const
ElementType
&,
const
BaryType
&)
const
34
{
38
return
c
;
39
}
40
};
41
42
// Operators
43
template
<
int
rows,
int
cols>
44
auto
make_constant
(
const
Eigen::Matrix<double,rows,cols>&
c
)
45
{
46
return
std::make_shared<Constant<Eigen::Matrix<double,rows,cols>,rows,cols>>(
c
);
47
}
48
49
static
inline
auto
make_constant
(
const
double
&
c
)
50
{
51
return
std::make_shared<Constant<double,1,1>>(
c
);
52
}
53
54
}
// close namespace
55
#endif
EvalFunction.h
c
c
Definition
int_R.m:15
model
Definition
DD_converter.dox:2
model::make_constant
auto make_constant(const Eigen::Matrix< double, rows, cols > &c)
Definition
Constant.h:44
model::Constant< CmatrixType, dim *(dim+1)/2, dim *(dim+1)/2 >::c
const CmatrixType c
Definition
Constant.h:27
model::Constant::operator()
const T & operator()(const ElementType &, const BaryType &) const
Definition
Constant.h:33
model::Constant< CmatrixType, dim *(dim+1)/2, dim *(dim+1)/2 >::rows
static constexpr int rows
Definition
Constant.h:24
model::Constant::Constant
Constant(const T &c_in)
Definition
Constant.h:28
model::Constant< CmatrixType, dim *(dim+1)/2, dim *(dim+1)/2 >::cols
static constexpr int cols
Definition
Constant.h:25
model::EvalFunction
Definition
EvalFunction.h:25
model::ElementType
model::BaryType
Generated by
1.15.0