9#include <kernel/space/evaluator_base.hpp>
10#include <kernel/geometry/intern/sub_index_mapping.hpp>
25 typename TrafoEvaluator_,
26 typename SpaceEvalTraits_,
27 typename Shape_ =
typename Space_::ShapeType>
37 typename TrafoEvaluator_,
38 typename SpaceEvalTraits_>
39 class Evaluator<Space_, TrafoEvaluator_, SpaceEvalTraits_, Shape::Simplex<2> > :
75 typedef typename SpaceEvalTraits::DataType
DataType;
79 template<SpaceTags cfg_>
86 static constexpr TrafoTags trafo_config = TrafoTags::img_point;
133 typedef Geometry::Intern::SubIndexMapping<Shape::Simplex<2>, 1, 0> SimType;
137 trafo_eval.get_trafo().get_mesh().template get_index_set<2,0>()[trafo_eval.get_cell_index()],
138 trafo_eval.get_trafo().get_mesh().template get_index_set<2,1>()[trafo_eval.get_cell_index()],
139 trafo_eval.get_trafo().get_mesh().template get_index_set<1,0>());
149 edge_vec[0].format();
150 edge_vec[1].format();
151 edge_vec[2].format();
155 trafo_eval.map_point(_barycentre,
dom_point);
162 for(
int vi(0); vi < 3; ++vi)
177 for(
int l(0); l < 5; ++l)
185 for(
int i(0); i < 6; ++i)
187 for(
int j(0); i+j < 6; ++j, ++k)
190 node_mat(k, 6*vi+0) = vx(i) * vy(j);
193 node_mat(k, 6*vi+1) =
DataType(i) * vx(i-1) * vy(j);
196 node_mat(k, 6*vi+2) =
DataType(j) * vy(j-1) * vx(i);
210 for(
int ei(0); ei < 3; ++ei)
219 DataType dnorm = edge_vec[ei].norm_euclid();
220 DataType dnx = +(edge_vec[ei](1) * edge_ori[ei]) / dnorm;
221 DataType dny = -(edge_vec[ei](0) * edge_ori[ei]) / dnorm;
226 for(
int l(0); l < 5; ++l)
234 for(
int i(0); i < 6; ++i)
236 for(
int j(0); i+j < 6; ++j, ++k)
240 node_mat(k, 18+ei) +=
DataType(i) * dnx * vx(i-1) * vy(j);
242 node_mat(k, 18+ei) +=
DataType(j) * dny * vy(j-1) * vx(i);
251 template<SpaceTags space_cfg_, TrafoTags trafo_cfg_>
258 vx(0) = vy(0) = DataType(1);
259 for(
int l(0); l < 5; ++l)
261 vx(l+1) = vx(l) * (tau.
img_point[0] - _barycentre[0]);
262 vy(l+1) = vy(l) * (tau.
img_point[1] - _barycentre[1]);
266 for(
int l(0); l < 21; ++l)
269 DataType v(DataType(0));
270 for(
int i(0); i < 6; ++i)
271 for(
int j(0); i+j < 6; ++j, ++k)
272 v += _coeff(l,k) * vx(i) * vy(j);
277 template<SpaceTags space_cfg_, TrafoTags trafo_cfg_>
279 EvalData<SpaceEvalTraits, space_cfg_>& phi,
280 const Trafo::EvalData<TrafoEvalTraits, trafo_cfg_>& tau)
const
283 Tiny::Vector<DataType, 6> vx, vy;
284 vx(0) = vy(0) = DataType(1);
285 for(
int l(0); l < 5; ++l)
287 vx(l+1) = vx(l) * (tau.img_point[0] - _barycentre[0]);
288 vy(l+1) = vy(l) * (tau.img_point[1] - _barycentre[1]);
292 for(
int l(0); l < 21; ++l)
295 DataType dx(DataType(0)), dy(DataType(0));
296 for(
int i(0); i < 6; ++i)
298 for(
int j(0); i+j < 6; ++j, ++k)
301 dx += _coeff(l,k) * DataType(i) * vx(i-1) * vy(j);
303 dy += _coeff(l,k) * DataType(j) * vy(j-1) * vx(i);
306 phi.phi[l].grad[0] = dx;
307 phi.phi[l].grad[1] = dy;
311 template<SpaceTags space_cfg_, TrafoTags trafo_cfg_>
313 EvalData<SpaceEvalTraits, space_cfg_>& phi,
314 const Trafo::EvalData<TrafoEvalTraits, trafo_cfg_>& tau)
const
317 Tiny::Vector<DataType, 6> vx, vy;
318 vx(0) = vy(0) = DataType(1);
319 for(
int l(0); l < 5; ++l)
321 vx(l+1) = vx(l) * (tau.img_point[0] - _barycentre[0]);
322 vy(l+1) = vy(l) * (tau.img_point[1] - _barycentre[1]);
326 for(
int l(0); l < 21; ++l)
329 DataType dxx(DataType(0)), dyy(DataType(0)), dxy(DataType(0));
330 for(
int i(0); i < 6; ++i)
332 for(
int j(0); i+j < 6; ++j, ++k)
335 dxx += _coeff(l,k) * DataType(i) * DataType(i-1) * vx(i-2) * vy(j);
337 dyy += _coeff(l,k) * DataType(j) * DataType(j-1) * vy(j-2) * vx(i);
339 dxy += _coeff(l,k) * DataType(i) * vx(i-1) * DataType(j) * vy(j-1);
342 phi.phi[l].hess(0,0) = dxx;
343 phi.phi[l].hess(1,1) = dyy;
344 phi.phi[l].hess(0,1) = phi.phi[l].hess(1,0) = dxy;
int get_num_local_dofs() const
Returns the number of local DOFs.
Space_ SpaceType
space type
SpaceEvalTraits::EvalPolicy EvalPolicy
evaluation policy
EvaluatorBase< Evaluator, TrafoEvaluator_, SpaceEvalTraits_ > BaseClass
base-class typedef
TrafoEvaluator_ TrafoEvaluator
trafo evaluator type
Evaluator(const SpaceType &space)
Constructor.
EvalPolicy::DomainPointType DomainPointType
domain point type
SpaceEvalTraits::DataType DataType
data type
EvalPolicy::ImagePointType ImagePointType
image point type
TrafoEvaluator::EvalTraits TrafoEvalTraits
trafo evaluator traits
SpaceEvalTraits_ SpaceEvalTraits
space evaluation traits
void prepare(const TrafoEvaluator &trafo_eval)
Prepares the evaluator for a given cell.
Argyris Element Evaluator class template declaration.
EvalTraits_::BasisValueType value
basis function value object
Space evaluation data structure.
BasisDataType phi[max_local_dofs]
the basis function data vector
Basic Space Evaluator CRTP base-class template.
Tiny Matrix class template.
CUDA_HOST_DEVICE Matrix & set_inverse(const Matrix< T_, m_, n_, sma_, sna_ > &a)
Sets this matrix to the inverse of another matrix.
CUDA_HOST_DEVICE void format(DataType alpha=DataType(0))
Formats the matrix.
Tiny Vector class template.
Trafo evaluation data structure.
EvalTraits::ImagePointType img_point
image point
SpaceTags
Space configuration tags enum.
@ value
specifies whether the space should supply basis function values
@ hess
specifies whether the space should supply basis function hessians
@ grad
specifies whether the space should supply basis function gradients
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
Space::EvalData< SpaceEvalTraits, config > EvalDataType
evaluation data typedef