DUNE-ACFEM (unstable)

zero.hh
1#ifndef __DUNE_ACFEM_OPERATORS_FUNCTIONALS_MODULES_ZERO_HH__
2#define __DUNE_ACFEM_OPERATORS_FUNCTIONALS_MODULES_ZERO_HH__
3
4#include "../../../common/literals.hh"
5#include "../../../expressions/terminal.hh"
6
7#include "../linearfunctional.hh"
8#include "../functionaltraits.hh"
9
10namespace Dune {
11
12 namespace ACFem {
13
14 namespace LinearFunctional {
15
16 using namespace Literals;
17
19 template<class DiscreteFunctionSpace>
21 : public LinearFunctionalBase<DiscreteFunctionSpace>
22 , public Expressions::SelfExpression<ZeroFunctional<DiscreteFunctionSpace> >
23 , public ZeroExpression
24 {
25 using BaseType = LinearFunctionalBase<DiscreteFunctionSpace>;
26 public:
27 using typename BaseType::DiscreteFunctionSpaceType;
28 using typename BaseType::RangeFieldType;
29 using BaseType::space;
30
31 ZeroFunctional(const DiscreteFunctionSpace& space)
32 : BaseType(space)
33 {}
34
35 template<class FieldArg, class DiscreteFunction,
36 std::enable_if_t<std::is_constructible<RangeFieldType, FieldArg>::value, int> = 0>
37 void coefficients(FieldArg&& s, DiscreteFunction& values) const
38 {
39 // do nothing because functionals always add their coefficients to the given values
40 static_assert(std::is_same<DiscreteFunctionSpace, typename DiscreteFunction::DiscreteFunctionSpaceType>::value,
41 "DiscreteFunctionSpaceType of functional and discrete storage has to coincide");
42 }
43
44 template<class DiscreteFunction>
45 void coefficients(DiscreteFunction& df) const
46 {
47 coefficients(1_f, df);
48 }
49
50 template<class DiscreteFunction>
51 auto operator()(const DiscreteFunction& df) const
52 {
53 return 0_f;
54 }
55
56 std::string name() const
57 {
58 return "<0,.>";
59 }
60
61 };
62
63 template<class DiscreteFunctionSpaceType>
64 auto zeroFunctional(const DiscreteFunctionSpaceType& space)
65 {
67 }
68
69 } // LinearFunctional::
70
71 template<class Space>
72 using ZeroLinearFunctional = LinearFunctional::ZeroFunctional<Space>;
73
74 using LinearFunctional::zeroFunctional;
75
76 } // ACFem::
77
78} // Dune::
79
80#endif // __DUNE_ACFEM_OPERATORS_FUNCTIONALS_MODULES_ZERO_HH__
Light-weight base class for all linear functionals.
Definition: linearfunctional.hh:13
The zero functional.
Definition: zero.hh:24
Terminals may derive from this class to express that they are expressions.
Definition: terminal.hh:25
A tag structure which can be attached as base class to zero-expressions like the ZeroGridFunction,...
Definition: tags.hh:138
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 31, 23:31, 2024)