FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
node_functional.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/space/node_functional_base.hpp>
10
11namespace FEAT
12{
13 namespace Space
14 {
15 namespace Lagrange1
16 {
17 template<
18 typename Space_,
19 int shape_dim_,
20 typename DataType_>
22 public NodeFunctionalNull<Space_, DataType_>
23 {
24 public:
25 explicit NodeFunctional(const Space_& space) :
27 {
28 }
29 };
30
31 template<
32 typename Space_,
33 typename DataType_>
34 class NodeFunctional<Space_, 0, DataType_> :
35 public NodeFunctionalBase<Space_, DataType_>
36 {
37 public:
39 static constexpr int max_assigned_dofs = 1;
40
41 template<typename Function_>
42 struct Value
43 {
45 };
46
47 protected:
48 typedef typename Space_::TrafoType TrafoType;
49 typedef typename TrafoType::template Evaluator<Shape::Vertex, DataType_>::Type TrafoEvalType;
50 typedef typename TrafoEvalType::EvalTraits TrafoEvalTraits;
51 typedef typename TrafoEvalTraits::DataType DataType;
52 typedef typename TrafoEvalTraits::DomainPointType DomainPointType;
53
54 // declare trafo evaluation data
55 typedef typename TrafoEvalType::template ConfigTraits<TrafoTags::img_point>::EvalDataType TrafoEvalData;
56
57 TrafoEvalType _trafo_eval;
58
59 public:
60 explicit NodeFunctional(const Space_& space) :
61 BaseClass(space),
62 _trafo_eval(space.get_trafo())
63 {
64 }
65
66 void prepare(Index cell_index)
67 {
68 BaseClass::prepare(cell_index);
69 _trafo_eval.prepare(cell_index);
70 }
71
72 void finish()
73 {
74 _trafo_eval.finish();
76 }
77
78 int get_num_assigned_dofs() const
79 {
80 return max_assigned_dofs;
81 }
82
83 template<typename NodeData_, typename Function_>
84 void operator()(NodeData_& node_data, const Function_& function) const
85 {
86 static_assert(std::is_base_of<Analytic::Function, Function_>::value, "invalid function object");
87 static_assert(Function_::can_value, "function cannot compute values");
88
89 // declare our evaluation traits
90 typedef Analytic::EvalTraits<DataType_, Function_> FuncEvalTraits;
91
92 // declare function evaluator
93 typename Function_::template Evaluator<FuncEvalTraits> func_eval(function);
94
95 // compute trafo data
96 DomainPointType dom_point(DataType_(0));
97 TrafoEvalData trafo_data;
98 _trafo_eval(trafo_data, dom_point);
99
100 // evaluate function
101 node_data[0] = func_eval.value(trafo_data.img_point);
102 }
103 };
104 } // namespace Lagrange1
105 } // namespace Space
106} // namespace FEAT
Lagrange-1 Element Evaluator class template declaration.
Definition: evaluator.hpp:35
Node-functional base class template.
void finish()
Releases the node-functional from the current cell.
void prepare(Index cell_index)
Prepares the node-functional for a given cell.
Null-Node-Functional class template.
int get_num_assigned_dofs() const
Returns the number of assigned dofs on the current cell.
NodeFunctionalBase< Space_, DataType_ > BaseClass
base-class typedef
void operator()(NodeData_ &node_data, const Function_ &function) const
Evaluation operator.
FEAT namespace.
Definition: adjactor.hpp:12
std::uint64_t Index
Index data type.
@ dom_point
specifies whether the trafo should supply domain point coordinates