You are here:
Concepts
>
Concepts Web
>
Class documentation
Class documentation of Concepts
Loading...
Searching...
No Matches
formula
matrixElementFormula.hh
Go to the documentation of this file.
1
6
#ifndef matrixelementformula_hh
7
#define matrixelementformula_hh
8
9
#include <vector>
10
#include "
toolbox/sharedPointer.hh
"
11
#include "
elementFormula.hh
"
12
#include "
elementFormulaContainer.hh
"
13
14
namespace
concepts
{
15
16
17
// ************************************************** MatrixElementFormula **
18
23
template<typename F, int dim, typename G = typename Realtype<F>::type
>
24
class
MatrixElementFormula
:
public
ElementFormula
< Mapping<F, dim>, G >
25
{
26
public
:
27
typedef
Mapping<F, dim>
value_type
;
28
29
MatrixElementFormula<F,dim,G>
() : formulas_()
30
{
31
for
(
int
i=0; i < dim*dim; ++i)
32
formulas_.push_back(
ElementFormulaContainer<F>
());
33
}
34
35
42
MatrixElementFormula<F,dim,G>
(
const
std::vector<
ElementFormulaContainer<F>
>&
formulas
)
43
: formulas_(
formulas
)
44
{
45
conceptsAssert
(formulas_.size() == dim * dim,
concepts::Assertion
());
46
}
47
53
Mapping<F, dim>
operator()
(
const
ElementWithCell<G>
& elm,
const
Real
p,
54
const
Real
t = 0.0)
const
55
{
56
Mapping<F, dim>
ret
;
57
for
(
int
i=0; i < dim; ++i) {
58
for
(
int
j=0; j < dim; ++j)
59
ret
(i,j) =
60
!formulas_[i*dim + j].empty() ? formulas_[i*dim + j](elm, p, t) : F(0);
61
}
62
return
ret
;
63
}
64
65
Mapping<F, dim>
operator()
(
const
ElementWithCell<G>
& elm,
const
Real2d
& p,
66
const
Real
t = 0.0)
const
67
{
68
Mapping<F, dim>
ret
;
69
for
(
int
i=0; i < dim; ++i) {
70
for
(
int
j=0; j < dim; ++j)
71
ret
(i,j) =
72
!formulas_[i*dim + j].empty() ? formulas_[i*dim + j](elm, p, t) : F(0);
73
}
74
return
ret
;
75
}
76
77
Mapping<F, dim>
operator()
(
const
ElementWithCell<G>
& elm,
const
Real3d
& p,
78
const
Real
t = 0.0)
const
79
{
80
Mapping<F, dim>
ret
;
81
for
(
int
i=0; i < dim; ++i) {
82
for
(
int
j=0; j < dim; ++j)
83
ret
(i,j) =
84
!formulas_[i*dim + j].empty() ? formulas_[i*dim + j](elm, p, t) : F(0);
85
}
86
return
ret
;
87
}
88
90
virtual
MatrixElementFormula<F,dim,G>
*
clone
()
const
91
{
92
return
new
MatrixElementFormula<F, dim, G>
(*
this
);
93
}
94
95
#if 0
96
MatrixElementFormula<F,dim,G>
(
const
MatrixElementFormula<F,dim,G>
&
other
)
97
: formulas_(
other
.formulas_)
98
{ }
99
#endif
100
101
virtual
~MatrixElementFormula() { }
102
103
const
std::vector< ElementFormulaContainer<F> >& getFormulas()
104
{
105
return
formulas_;
106
}
107
108
ElementFormulaContainer<F>
&
operator()
(
int
i,
int
j)
109
{
110
conceptsAssert
(i < dim*dim,
concepts::Assertion
());
111
112
return
formulas_[i*dim +j];
113
}
114
protected
:
115
std::vector< ElementFormulaContainer<F> > formulas_;
116
};
117
118
119
}
// namespace concepts
120
121
122
#endif
// matrixelementformula_hh
concepts::Assertion
Definition
exceptions.hh:258
concepts::ElementFormulaContainer
Definition
elementFormulaContainer.hh:22
concepts::ElementFormula
Definition
elementFormula.hh:35
concepts::ElementWithCell
Definition
element.hh:79
concepts::Mapping
Definition
vectorsMatrices.hh:313
concepts::MatrixElementFormula
Definition
matrixElementFormula.hh:25
concepts::MatrixElementFormula::operator()
Mapping< F, dim > operator()(const ElementWithCell< G > &elm, const Real p, const Real t=0.0) const
Definition
matrixElementFormula.hh:53
concepts::MatrixElementFormula::clone
virtual MatrixElementFormula< F, dim, G > * clone() const
Virtual copy constructor.
Definition
matrixElementFormula.hh:90
concepts::Point< Real, 2 >
elementFormulaContainer.hh
elementFormula.hh
conceptsAssert
#define conceptsAssert(cond, exc)
Definition
exceptions.hh:394
concepts
Definition
pml_formula.h:16
concepts::Real
double Real
Definition
typedefs.hh:39
concepts::makeSet
Set< F > makeSet(uint n, const F &first,...)
Definition
set.hh:320
sharedPointer.hh
Generated on Wed Sep 13 2023 21:06:19 for Concepts by
1.9.8