Class documentation of Concepts

Loading...
Searching...
No Matches
frmE_sum.hh
Go to the documentation of this file.
1
8#ifndef sumelementformula_hh
9#define sumelementformula_hh
10
11#include "basics/typedefs.hh"
12#include "basics/output.hh"
15#include "exceptions.hh"
16
17#define SumElemFormConstr_D 0
18#define SumElemFormDestr_D 0
19#define SumElemFormClone_D 0
20
21namespace concepts {
22
23
24 // **************************************************************** FrmE_Sum **
25
34 template<class F, class H = F, class J = F,
35 class G = typename Realtype<F>::type>
36 class FrmE_Sum : public ElementFormula<F,G> {
37 public:
40 : frm1_(frm1), frm2_(frm2), a_(0.0)
41 {
42 if (frm1.empty()) throw(PointerToEmptyElementFormula());
43 if (frm2.empty()) throw(PointerToEmptyElementFormula());
44 }
46 const F a)
47 : frm1_(frm1), frm2_(), a_(a)
48 {
49 DEBUGL(SumElemFormConstr_D, "frm1 = " << frm1);
50 if (frm1.empty()) throw(PointerToEmptyElementFormula());
51 }
52 virtual ~FrmE_Sum() {
53 DEBUGL(SumElemFormDestr_D, "Delete " << *this)
54 }
55
56
57 virtual F operator() (const ElementWithCell<G>& elm, const Real p,
58 const Real t = 0.0) const
59 {
60 F v = frm1_(elm, p,t);
61 if (!frm2_.empty())
62 v += frm2_(elm, p,t);
63
64 return v + a_;
65 }
66 virtual F operator() (const ElementWithCell<G>& elm, const Real2d& p,
67 const Real t = 0.0) const
68 {
69 F v = frm1_(elm, p,t);
70 if (!frm2_.empty())
71 v += frm2_(elm, p,t);
72
73 return v + a_;
74 }
75 virtual F operator() (const ElementWithCell<G>& elm, const Real3d& p,
76 const Real t = 0.0) const
77 {
78 F v = frm1_(elm, p,t);
79 if (!frm2_.empty())
80 v += frm2_(elm, p,t);
81
82 return v + a_;
83 }
84
85 virtual FrmE_Sum<F,H,J,G>* clone() const {
86 DEBUGL(SumElemFormClone_D, *this << " = *" << this);
87 return new FrmE_Sum<F,H,J,G>(frm1_, frm2_, a_);
88 }
89 protected:
90 virtual std::ostream& info(std::ostream& os) const {
91 os << typeOf(*this) << "(" << frm1_;
92 if (!frm2_.empty())
93 os << " + " << frm2_;
94 if (!(a_ == F(0.0)))
95 os << " + " << a_;
96 return os << ")";
97 }
98 private:
104 F a_;
105
109 const F a)
110 : frm1_(frm1), frm2_(frm2), a_(a)
111 {
112 DEBUGL(SumElemFormConstr_D,
113 "frm1 = " << frm1 << ", frm2 = " << frm2 << ", a = " << a);
114 if (frm1.empty()) throw(PointerToEmptyElementFormula());
115 }
116 };
117
118
119 // ************************************************************ operator+ **
120
122
123 ElementFormulaContainer<Real>
125
128
131
134
135 // ************
136
139
142
145
148
149
155
159
163
167
168 // ************
169
173
177
181
185
187
190
193
196
199
200 // ************
201
204
207
210
213
219
223
227
231
232 // ************
233
237
241
245
249
250} // namespace concepts
251
252
253#endif // sumelementformula_hh
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Definition frmE_sum.hh:90
virtual F operator()(const ElementWithCell< G > &elm, const Real p, const Real t=0.0) const
Definition frmE_sum.hh:57
virtual FrmE_Sum< F, H, J, G > * clone() const
Virtual copy constructor.
Definition frmE_sum.hh:85
#define DEBUGL(doit, msg)
Definition debug.hh:40
ElementFormulaContainer< Real > operator-(const ElementFormulaContainer< Real > frm, const Real a)
Simple subtracting of a element formulas and a constant via –operator.
std::string typeOf(const T &t)
Definition output.hh:43
Frm_Sum< Real > operator+(const Formula< Real > &frm, const Real a)
double Real
Definition typedefs.hh:39
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320
std::complex< Real > Cmplx
Type for a complex number. It also depends on the setting of Real.
Definition typedefs.hh:42