Class documentation of Concepts

Loading...
Searching...
No Matches
frm_sum.hh
Go to the documentation of this file.
1
8#ifndef sumformula_hh
9#define sumformula_hh
10
11#include "basics/typedefs.hh"
12#include "basics/output.hh"
14#include "formulaContainer.hh"
15#include "exceptions.hh"
16
17namespace concepts {
18
19
20 // ************************************************************ Frm_Sum **
21
30 template<class F, class H = F, class J = F>
31 class Frm_Sum : public Formula<F> {
32 public:
35 : frm1_(frm1), frm2_(frm2)
36 {
37 if (frm1.empty()) throw(PointerToEmptyElementFormula());
38 if (frm2.empty()) throw(PointerToEmptyElementFormula());
39 }
40 virtual F operator() (const Real p, const Real t = 0.0) const {
41 return frm1_(p,t) + frm2_(p,t);
42 }
43 virtual F operator() (const Real2d& p, const Real t = 0.0) const {
44 return frm1_(p,t) + frm2_(p,t);
45 }
46 virtual F operator() (const Real3d& p, const Real t = 0.0) const {
47 return frm1_(p,t) + frm2_(p,t);
48 }
49 virtual Frm_Sum<F,H,J>* clone() const {
50 return new Frm_Sum<F,H,J>(frm1_, frm2_);
51 }
52 protected:
53 virtual std::ostream& info(std::ostream& os) const {
54 return os << concepts::typeOf(*this) <<"(" << frm1_ << " + " << frm2_ << ")";
55 }
56 private:
58 const FormulaContainer<H> frm1_;
60 const FormulaContainer<J> frm2_;
61 };
62
63
64 // ************************************************************ operator+ **
65
77
79
81
82 Frm_Sum<Cmplx> operator+(const Formula<Cmplx>& frm, const Cmplx a);
83
84 // ************
85
87
89
91
93
94
95} // namespace concepts
96
97
98#endif // sumformula_hh
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Definition frm_sum.hh:53
virtual F operator()(const Real p, const Real t=0.0) const
Definition frm_sum.hh:40
virtual Frm_Sum< F, H, J > * clone() const
Virtual copy constructor.
Definition frm_sum.hh:49
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