FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
evaluator.hpp
1// FEAT3: Finite Element Analysis Toolbox, Version 3
2// Copyright (C) 2010 by Stefan Turek & the FEAT group
3// FEAT3 is released under the GNU General Public License version 3,
4// see the file 'copyright.txt' in the top level directory for details.
5
6#pragma once
7
8// includes, FEAT
9#include <kernel/trafo/evaluator_base.hpp>
10#include <kernel/trafo/standard/details.hpp>
11
12namespace FEAT
13{
14 namespace Trafo
15 {
16 namespace Standard
17 {
23 template<
24 typename Trafo_,
25 typename EvalPolicy_,
26 typename Shape_ = typename EvalPolicy_::ShapeType>
27 class Evaluator:
28 public EvaluatorBase<Trafo_, Evaluator<Trafo_, EvalPolicy_, Shape_ >, EvalPolicy_>
29 {
30 public:
34 typedef Shape_ ShapeType;
36 typedef Trafo_ TrafoType;
38 typedef EvalPolicy_ EvalPolicy;
39
41 typedef typename TrafoType::MeshType MeshType;
42
44 typedef typename EvalPolicy::DataType DataType;
46 typedef typename EvalPolicy::DomainPointType DomainPointType;
48 typedef typename EvalPolicy::ImagePointType ImagePointType;
50 typedef typename EvalPolicy::JacobianMatrixType JacobianMatrixType;
52 typedef typename EvalPolicy::JacobianInverseType JacobianInverseType;
54 typedef typename EvalPolicy::JacobianDeterminantType JacobianDeterminantType;
56 typedef typename EvalPolicy::HessianTensorType HessianTensorType;
58 typedef typename EvalPolicy::HessianInverseType HessianInverseType;
59
61 static constexpr int domain_dim = EvalPolicy::domain_dim;
63 static constexpr int image_dim = EvalPolicy::image_dim;
66
70
73 static constexpr TrafoTags eval_caps =
77
78 protected:
81
82 public:
89 explicit Evaluator(const TrafoType& trafo) :
90 BaseClass(trafo)
91 {
92 }
93
100 void prepare(Index cell_index)
101 {
102 // prepare base-class
103 BaseClass::prepare(cell_index);
104
105 // fetch the mesh from the trafo
106 const MeshType& mesh = this->_trafo.get_mesh();
107
108 // fetch the vertex set from the mesh
109 typedef typename MeshType::VertexSetType VertexSetType;
110 const VertexSetType& vertex_set = mesh.get_vertex_set();
111
112 // fetch the index set
113 typedef typename MeshType::template IndexSet<domain_dim, 0>::Type IndexSetType;
114 const IndexSetType& index_set = mesh.template get_index_set<domain_dim, 0>();
115
116 EvalHp::set_coefficients(_coeff, vertex_set, index_set, cell_index);
117 }
118
129 {
130 EvalHp::map_point(img_point, dom_point, _coeff);
131 }
132
143 {
144 EvalHp::calc_jac_mat(jac_mat, dom_point, _coeff);
145 }
146
157 {
158 EvalHp::calc_hess_ten(hess_ten, dom_point, _coeff);
159 }
160
168 {
169 return EvalHp::volume(_coeff);
170 }
171
184 {
185 return EvalHp::width_directed(ray, _coeff);
186 }
187 }; // class Evaluator<Hypercube<1>,...>
188
189 // /* ************************************************************************************* */
190
196 template<
197 typename Trafo_,
198 typename EvalPolicy_>
199 class Evaluator<Trafo_, EvalPolicy_, Shape::Vertex > :
200 public EvaluatorBase<Trafo_, Evaluator<Trafo_, EvalPolicy_, Shape::Vertex >, EvalPolicy_>
201 {
202 public:
208 typedef Trafo_ TrafoType;
210 typedef EvalPolicy_ EvalPolicy;
211
213 typedef typename TrafoType::MeshType MeshType;
214
216 typedef typename EvalPolicy::DataType DataType;
218 typedef typename EvalPolicy::DomainPointType DomainPointType;
220 typedef typename EvalPolicy::ImagePointType ImagePointType;
222 typedef typename EvalPolicy::JacobianMatrixType JacobianMatrixType;
224 typedef typename EvalPolicy::JacobianInverseType JacobianInverseType;
226 typedef typename EvalPolicy::JacobianDeterminantType JacobianDeterminantType;
228 typedef typename EvalPolicy::HessianTensorType HessianTensorType;
230 typedef typename EvalPolicy::HessianInverseType HessianInverseType;
231
233 static constexpr int domain_dim = EvalPolicy::domain_dim;
235 static constexpr int image_dim = EvalPolicy::image_dim;
236
239
240 protected:
243
244 public:
251 explicit Evaluator(const TrafoType& trafo) :
252 BaseClass(trafo)
253 {
254 }
255
262 void prepare(Index cell_index)
263 {
264 // prepare base-class
265 BaseClass::prepare(cell_index);
266
267 // fetch the mesh from the trafo
268 const MeshType& mesh = this->_trafo.get_mesh();
269
270 // fetch the vertex set from the mesh
271 typedef typename MeshType::VertexSetType VertexSetType;
272 const VertexSetType& vertex_set = mesh.get_vertex_set();
273
274 // fetch the vertex
275 typedef typename VertexSetType::VertexType VertexType;
276 const VertexType& vtx = vertex_set[cell_index];
277
278 // calculate transformation coefficients
279 for(int i(0); i < image_dim; ++i)
280 {
281 _coeff[i] = DataType(vtx[i]);
282 }
283 }
284
295 {
296 for(int i(0); i < image_dim; ++i)
297 {
298 img_point[i] = _coeff[i];
299 }
300 }
301 }; // class Evaluator<Vertex,...>
302 } // namespace Standard
303 } // namespace Trafo
304} // namespace FEAT
Tiny Matrix class template.
Tiny Vector class template.
Trafo Evaluator CRTP base-class template.
void prepare(const CellIterator &cell)
Prepares the evaluator for a given cell.
const TrafoType & _trafo
trafo reference
EvalPolicy::JacobianMatrixType JacobianMatrixType
jacobian matrix type
Definition: evaluator.hpp:222
EvalPolicy::HessianInverseType HessianInverseType
hessian inverse tensor type
Definition: evaluator.hpp:230
Tiny::Vector< DataType, image_dim > _coeff
the coefficients of the trafo
Definition: evaluator.hpp:242
EvalPolicy::HessianTensorType HessianTensorType
hessian tensor type
Definition: evaluator.hpp:228
EvalPolicy::JacobianDeterminantType JacobianDeterminantType
jacobian determinant type
Definition: evaluator.hpp:226
EvalPolicy::DomainPointType DomainPointType
domain point type
Definition: evaluator.hpp:218
void prepare(Index cell_index)
Prepares the evaluator for a given cell.
Definition: evaluator.hpp:262
void map_point(ImagePointType &img_point, const DomainPointType &dom_point) const
Maps a point from the reference cell to the selected cell.
Definition: evaluator.hpp:294
EvalPolicy::ImagePointType ImagePointType
image point type
Definition: evaluator.hpp:220
EvaluatorBase< Trafo_, Evaluator, EvalPolicy_ > BaseClass
base-class typedef
Definition: evaluator.hpp:204
TrafoType::MeshType MeshType
type of the underlying mesh
Definition: evaluator.hpp:213
EvalPolicy::JacobianInverseType JacobianInverseType
jacobian inverse matrix type
Definition: evaluator.hpp:224
Standard trafo evaluator class template.
Definition: evaluator.hpp:29
EvalPolicy::JacobianMatrixType JacobianMatrixType
jacobian matrix type
Definition: evaluator.hpp:50
Evaluator(const TrafoType &trafo)
Constructor.
Definition: evaluator.hpp:89
void prepare(Index cell_index)
Prepares the evaluator for a given cell.
Definition: evaluator.hpp:100
void calc_hess_ten(HessianTensorType &hess_ten, const DomainPointType &dom_point) const
Computes the hessian tensor for a given domain point.
Definition: evaluator.hpp:156
void map_point(ImagePointType &img_point, const DomainPointType &dom_point) const
Maps a point from the reference cell to the selected cell.
Definition: evaluator.hpp:128
static constexpr int domain_dim
domain dimension
Definition: evaluator.hpp:61
EvalPolicy::DomainPointType DomainPointType
domain point type
Definition: evaluator.hpp:46
Tiny::Matrix< DataType, image_dim, num_verts > _coeff
the coefficients of the trafo
Definition: evaluator.hpp:80
EvalPolicy::HessianInverseType HessianInverseType
hessian inverse tensor type
Definition: evaluator.hpp:58
EvalPolicy::JacobianInverseType JacobianInverseType
jacobian inverse matrix type
Definition: evaluator.hpp:52
static constexpr int num_verts
number of verts
Definition: evaluator.hpp:65
EvalHelper< DataType, DomainPointType, ImagePointType, JacobianMatrixType, JacobianInverseType, JacobianDeterminantType, HessianTensorType, HessianInverseType,ShapeType, image_dim > EvalHp
evaluation helper, see details.hpp
Definition: evaluator.hpp:69
EvaluatorBase< Trafo_, Evaluator, EvalPolicy_ > BaseClass
base-class typedef
Definition: evaluator.hpp:32
Trafo_ TrafoType
trafo type using this evaluator
Definition: evaluator.hpp:36
EvalPolicy_ EvalPolicy
trafo evaluation traits
Definition: evaluator.hpp:38
EvalPolicy::DataType DataType
evaluation data type
Definition: evaluator.hpp:44
EvalPolicy::JacobianDeterminantType JacobianDeterminantType
jacobian determinant type
Definition: evaluator.hpp:54
EvalPolicy::ImagePointType ImagePointType
image point type
Definition: evaluator.hpp:48
EvalPolicy::HessianTensorType HessianTensorType
hessian tensor type
Definition: evaluator.hpp:56
void calc_jac_mat(JacobianMatrixType &jac_mat, const DomainPointType &dom_point) const
Calculates the jacobian matrix for a given point.
Definition: evaluator.hpp:142
TrafoType::MeshType MeshType
type of the underlying mesh
Definition: evaluator.hpp:41
DataType width_directed(const ImagePointType &ray) const
Computes and returns the directed mesh width.
Definition: evaluator.hpp:183
DataType volume() const
Computes and returns the volume of the current cell.
Definition: evaluator.hpp:167
static constexpr int image_dim
image dimension
Definition: evaluator.hpp:63
static constexpr TrafoTags eval_caps
Definition: evaluator.hpp:73
FEAT namespace.
Definition: adjactor.hpp:12
std::uint64_t Index
Index data type.
TrafoTags
Trafo configuration tags enum.
Definition: eval_tags.hpp:22
@ img_point
specifies whether the trafo should supply image point coordinates
@ hess_inv
specifies whether the trafo should supply inverse hessian tensors
@ dom_point
specifies whether the trafo should supply domain point coordinates
@ hess_ten
specifies whether the trafo should supply hessian tensors
@ jac_inv
specifies whether the trafo should supply inverse jacobian matrices
@ jac_mat
specifies whether the trafo should supply jacobian matrices
@ jac_det
specifies whether the trafo should supply jacobian determinants
Face traits tag struct template.
Definition: shape.hpp:106
Vertex shape tag struct.
Definition: shape.hpp:26
Evalautator helper class for standard trafo.
Definition: details.hpp:48