DUNE-ACFEM (unstable)

quadraturepoint.hh
1#ifndef __DUNE_ACFEM_COMMON_QUADRATUREPOINT_HH__
2#define __DUNE_ACFEM_COMMON_QUADRATUREPOINT_HH__
3
4#include <dune/fem/quadrature/quadrature.hh>
5
6#ifndef __DUNE_ACFEM_MAKE_CHECK__
7# define __DUNE_ACFEM_MAKE_CHECK__ 0
8#endif
9
10#include "types.hh"
11
12namespace Dune {
13
14 namespace ACFem {
15
22 template<class Quadrature>
23 using QuadraturePoint = Fem::QuadraturePointWrapper<Quadrature>;
24
26 template<class T, class SFINAE = void>
28 : FalseType
29 {};
30
32 template<class T>
33 struct IsQuadraturePoint<T, std::enable_if_t<!IsDecay<T>{}> >
34 : IsQuadraturePoint<std::decay_t<T> >
35 {};
36
38 template<class Quadrature>
39 struct IsQuadraturePoint<Fem::QuadraturePointWrapper<Quadrature> >
40 : TrueType
41 {};
42
51 template<class T>
53 : public T
54 {
55 typedef T DomainType;
56 typedef T BaseType;
57 public:
58 PointWrapperQuadrature(const DomainType& p) : BaseType(p) {}
59 typedef DomainType CoordinateType;
60 typedef DomainType LocalCoordinateType;
61 typedef real_t<CoordinateType> RealType;
62 const CoordinateType& point(unsigned int index) const { assert(index == 0); return *this; }
63 const RealType weight(unsigned int) const { return RealType(1.); }
64 const LocalCoordinateType& localPoint(unsigned int index) const { assert(index == 0); return *this; }
65 unsigned int nop() const { return 1; }
66 operator const T&() const { return *this; }
67 operator T&() { return *this; }
68 };
69
70 template<class T>
71 using PlaceholderQuadraturePoint = QuadraturePoint<PointWrapperQuadrature<T> >;
72
73 template<class T, int N>
74 auto quadraturePoint(const FieldVector<T, N>& t)
75 {
76 typedef PointWrapperQuadrature<FieldVector<T, N> > QuadratureType;
77 return QuadraturePoint<QuadratureType>(static_cast<const QuadratureType&>(t), 0);
78 }
79
80 template<class Quadrature>
81 decltype(auto) quadraturePoint(const QuadraturePoint<Quadrature>& qp)
82 {
83 return qp;
84 }
85
86 template<class T, int N>
87 auto operator*(const FieldVector<T, N>& t)
88 {
89 return quadraturePoint(t);
90 }
91
93 template<class Quadrature>
94 decltype(auto) operator*(const QuadraturePoint<Quadrature>& qp)
95 {
96 return qp;
97 }
98
99 template<class T>
100 std::ostream& operator<<(std::ostream& out, const QuadraturePoint<PointWrapperQuadrature<T> >& arg)
101 {
102 return out << (const T&)arg;
103 };
104
106
107 } // NS ACFem::
108
109} // NS Dune::
110
111#endif // __DUNE_ACFEM_COMMON_QUADRATUREPOINT_HH__
A wrapper class which allows to "simulate" a Dune::Fem::QuadraturePointWrapper.
Definition: quadraturepoint.hh:54
std::ostream & operator<<(std::ostream &out, TypeString< T > &&t)
Output operator for TypePrint tag-structure.
Definition: ostream.hh:39
BoolConstant< false > FalseType
Alias for std::false_type.
Definition: types.hh:110
BoolConstant< true > TrueType
Alias for std::true_type.
Definition: types.hh:107
Fem::QuadraturePointWrapper< Quadrature > QuadraturePoint
Shortcut.
Definition: quadraturepoint.hh:23
STL namespace.
Definition: quadraturepoint.hh:29
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)