formulaLiCo.hh

Go to the documentation of this file.
1 
8 #ifndef formulaLiCo_hh
9 #define formulaLiCo_hh
10 
11 #include "formula.hh"
12 
13 namespace concepts {
14 
19  class FormulaLiCo : public Formula<Real> {
20  public:
27  FormulaLiCo(const Formula<Real>& frmA, const Formula<Real>& frmB, Real cA, Real cB)
28  : frmA_(frmA), frmB_(frmB), cA_(cA), cB_(cB) { }
30  virtual Formula<Real> * clone () const {
31  return new FormulaLiCo(frmA_, frmB_, cA_, cB_);
32  }
33 
35  virtual Real operator() (const Real p, const Real t=0.0) const {
36  return cA_*frmA_(p, t) + cB_*frmB_(p, t);
37  }
39  virtual Real operator() (const Real2d &p, const Real t=0.0) const {
40  return cA_*frmA_(p, t) + cB_*frmB_(p, t);
41  }
43  virtual Real operator() (const Real3d &p, const Real t=0.0) const {
44  return cA_*frmA_(p, t) + cB_*frmB_(p, t);
45  }
46  private:
49  const Real cA_;
50  const Real cB_;
51  };
52 
53 } // namespace concepts
54 
55 #endif //formulaLiCo_hh
Linear combination of two formulae.
Definition: formulaLiCo.hh:19
FormulaLiCo(const Formula< Real > &frmA, const Formula< Real > &frmB, Real cA, Real cB)
Constructor.
Definition: formulaLiCo.hh:27
Interface for a formula.
Definition: lform.hh:18
virtual Formula< Real > * clone() const
Return a clone of this linear combination.
Definition: formulaLiCo.hh:30
virtual Real operator()(const Real p, const Real t=0.0) const
Application operator for one dimension.
Definition: formulaLiCo.hh:35
const Formula< Real > & frmB_
Definition: formulaLiCo.hh:48
const Formula< Real > & frmA_
Definition: formulaLiCo.hh:47
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich