9#include <kernel/space/node_functional_base.hpp>
39 static constexpr int max_assigned_dofs = 6;
41 template<
typename Function_>
48 typedef typename Space_::TrafoType TrafoType;
49 typedef typename Space_::ShapeType ShapeType;
51 typedef typename TrafoEvalType::EvalTraits TrafoEvalTraits;
52 typedef typename TrafoEvalTraits::DomainPointType DomainPointType;
55 typedef typename TrafoEvalType::template ConfigTraits<TrafoTags::img_point>::EvalDataType TrafoEvalData;
57 TrafoEvalType _trafo_eval;
62 _trafo_eval(space.get_trafo())
69 _trafo_eval.prepare(cell_index);
80 return max_assigned_dofs;
83 template<
typename NodeData_,
typename Function_>
84 void operator()(NodeData_& node_data,
const Function_& function)
const
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 static_assert(Function_::can_grad,
"function cannot compute gradients");
89 static_assert(Function_::can_hess,
"function cannot compute hessians");
92 typedef Analytic::EvalTraits<DataType_, Function_> FuncEvalTraits;
95 typename Function_::template Evaluator<FuncEvalTraits> func_eval(function);
99 TrafoEvalData trafo_data;
103 const auto func_value = func_eval.value(trafo_data.img_point);
104 const auto func_grad = func_eval.gradient(trafo_data.img_point);
105 const auto func_hess = func_eval.hessian(trafo_data.img_point);
108 node_data[0] = func_value;
109 node_data[1] = func_grad[0];
110 node_data[2] = func_grad[1];
111 node_data[3] = func_hess[0][0];
112 node_data[4] = func_hess[1][1];
113 node_data[5] = func_hess[0][1];
125 static constexpr int max_assigned_dofs = 1;
127 template<
typename Function_>
134 typedef typename Space_::TrafoType TrafoType;
135 typedef typename Space_::ShapeType ShapeType;
137 typedef typename TrafoEvalType::EvalTraits TrafoEvalTraits;
138 typedef typename TrafoEvalTraits::DataType
DataType;
139 typedef typename TrafoEvalTraits::DomainPointType DomainPointType;
143#if defined(FEAT_COMPILER_PGI) || (defined(FEAT_COMPILER_INTEL) && FEAT_COMPILER_INTEL >= 1800 && FEAT_COMPILER_INTEL < 1900)
145 typedef typename TrafoEvalType::template ConfigTraits<trafo_tags>::EvalDataType
TrafoEvalData;
147 typedef typename TrafoEvalType::template ConfigTraits<TrafoTags::img_point|TrafoTags::jac_mat>::EvalDataType
TrafoEvalData;
150 TrafoEvalType _trafo_eval;
155 _trafo_eval(space.get_trafo())
162 _trafo_eval.prepare(cell_index);
167 _trafo_eval.finish();
173 return max_assigned_dofs;
176 template<
typename NodeData_,
typename Function_>
177 void operator()(NodeData_& node_data,
const Function_& function)
const
179 static_assert(std::is_base_of<Analytic::Function, Function_>::value,
"invalid function object");
180 static_assert(Function_::can_grad,
"function cannot compute gradients");
183 typedef Analytic::EvalTraits<DataType_, Function_> FuncEvalTraits;
186 typename Function_::template Evaluator<FuncEvalTraits> func_eval(function);
188 DomainPointType
dom_point(DataType_(0.5));
189 TrafoEvalData trafo_data;
194 DataType_ dnx = +trafo_data.jac_mat(1,0);
195 DataType_ dny = -trafo_data.jac_mat(0,0);
196 DataType_ dnl = DataType_(1) /
Math::sqrt(dnx*dnx + dny*dny);
201 const auto func_grad = func_eval.gradient(trafo_data.img_point);
204 node_data[0] = dnx * func_grad[0] + dny * func_grad[1];
Argyris Element Evaluator class template declaration.
TrafoEvalType::template ConfigTraits< TrafoTags::img_point|TrafoTags::jac_mat >::EvalDataType TrafoEvalData
Node-functional base class template.
void finish()
Releases the node-functional from the current cell.
DataType_ DataType
data type
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.
T_ sqrt(T_ x)
Returns the square-root of a value.
std::uint64_t Index
Index data type.
TrafoTags
Trafo configuration tags enum.
@ img_point
specifies whether the trafo should supply image point coordinates
@ dom_point
specifies whether the trafo should supply domain point coordinates
@ jac_mat
specifies whether the trafo should supply jacobian matrices