DUNE-ACFEM (unstable)

elementmeasure.hh
1#ifndef __DUNE_ACFEM_FUNCTIONS_PLACEHOLDERS_ELEMENTMEASURE_HH__
2#define __DUNE_ACFEM_FUNCTIONS_PLACEHOLDERS_ELEMENTMEASURE_HH__
3
4#include "../../tensors/operations/placeholder.hh"
5#include "../../tensors/bindings/dune/fieldtensor.hh"
6
7namespace Dune {
8
9 namespace ACFem {
10
11 namespace GridFunction {
12
13 using namespace Literals;
14 using Tensor::PlaceholderTensor;
15 using Tensor::FieldVectorTensor;
16
27 template<class GridPart>
29 : public PlaceholderTensor<FieldVectorTensor<typename GridPart::ctype>, ElementMeasurePlaceholder<GridPart> >
30 {
31 public:
32 using TensorType = FieldVectorTensor<typename GridPart::ctype>;
33 using EntityType = typename GridPart::template Codim<0>::EntityType;
34 private:
36 using BaseType = PlaceholderTensor<TensorType, ThisType>;
37 public:
38 using GridPartType = GridPart;
39 using BaseType::operator();
40
45 : BaseType(TensorType(-1.0), Expressions::Functor<BaseType>{})
46 , gridPart_(gridPart)
47 {}
48
53 void bind(const EntityType& entity)
54 {
55 (*this)() = entity.geometry().volume();
56 }
57
59 const GridPartType& gridPart() const
60 {
61 return gridPart_;
62 }
63
64 static std::string name()
65 {
66 return "|E|";
67 }
68
69 private:
70 const GridPartType& gridPart_;
71 };
72
73 template<class GridPart>
74 auto elementMeasurePlaceholder(const GridPart& gridPart)
75 {
76 return expressionClosure(ElementMeasurePlaceholder<GridPart>(gridPart));
77 }
78
80
81 } // NS GridFunction
82
83 } // NS ACFem
84
88 template<class GridPart>
89 struct FieldTraits<ACFem::GridFunction::ElementMeasurePlaceholder<GridPart> >
90 : FieldTraits<ACFem::GridFunction::PlaceholderTensor<ACFem::GridFunction::FieldVectorTensor<typename GridPart::ctype>, ACFem::GridFunction::ElementMeasurePlaceholder<GridPart> > >
91 {};
92
93} // NS Dune
94
95#endif // __DUNE_ACFEM_FUNCTIONS_PLACEHOLDERS_ELEMENTMEASURE_HH__
A placeholder tensor which evaluates to the measure of the element after binding it.
Definition: elementmeasure.hh:30
void bind(const EntityType &entity)
Bind the wrapped LocalFunction to the given entity.
Definition: elementmeasure.hh:53
const GridPartType & gridPart() const
Return the gridPart.
Definition: elementmeasure.hh:59
ElementMeasurePlaceholder(const GridPart &gridPart)
Construct an element-measure placeholder from the given grid-part.
Definition: elementmeasure.hh:44
constexpr decltype(auto) expressionClosure(T &&t)
Do-nothing default implementation for pathologic cases.
Definition: interface.hh:93
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)