Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)

formula/frm_sum.hh
Go to the documentation of this file.
00001 
00004 #ifndef sumformula_hh
00005 #define sumformula_hh
00006 
00007 #include "elementFormulaRCP.hh"
00008 
00009 namespace concepts {
00010 
00011  
00012  // ************************************************************ Frm_Sum **
00013 
00022   template<class F, class H = F, class J = F>
00023   class Frm_Sum : public Formula<F> {
00024   public:
00025     Frm_Sum(const RCP<const Formula<H> > frm1,
00026             const RCP<const Formula<J> > frm2) 
00027       : frm1_(frm1), frm2_(frm2) 
00028     {
00029       conceptsAssert(frm1.get(), Assertion());
00030       conceptsAssert(frm2.get(), Assertion());
00031     }
00032     virtual F operator() (const Real p,    const Real t = 0.0) const {
00033       return (*frm1_)(p,t) + (*frm2_)(p,t);
00034     }
00035     virtual F operator() (const Real2d& p, const Real t = 0.0) const {
00036       return (*frm1_)(p,t) + (*frm2_)(p,t);
00037     }
00038     virtual F operator() (const Real3d& p, const Real t = 0.0) const {
00039       return (*frm1_)(p,t) + (*frm2_)(p,t);
00040     }
00041     virtual Frm_Sum<F,H,J>* clone() const {
00042       return new Frm_Sum<F,H,J>(frm1_, frm2_);
00043     }
00044   protected:
00045     virtual std::ostream& info(std::ostream& os) const {
00046       return os << "Frm_Sum(" << *frm1_ << " + " << *frm2_ << ")";
00047     }
00048   private:
00050     RCP<const Formula<H> > frm1_;
00052     RCP<const Formula<J> > frm2_;
00053   };
00054 
00055 
00056   // ************************************************************ operator+ **
00057 
00067 //   Frm_Sum<Real> 
00068 //   operator+(const RCP<const Formula<Real> >  frm1, const RCP<const Formula<Real> > frm2);
00069 
00070 //   Frm_Sum<Cmplx,Cmplx,Real> 
00071 //   operator+(const RCP<const Formula<Cmplx> > frm1, const RCP<const Formula<Real> > frm2);
00072 
00073 //   Frm_Sum<Cmplx,Real,Cmplx> 
00074 //   operator+(const RCP<const Formula<Real> >  frm1, const RCP<const Formula<Cmplx> > frm2);
00075 
00076 //   Frm_Sum<Cmplx,Cmplx,Cmplx> 
00077 //   operator+(const RCP<const Formula<Cmplx> > frm1, const RCP<const Formula<Cmplx> > frm2);
00078 
00079 
00080 } // namespace concepts
00081 
00082 
00083 #endif // sumformula_hh

Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)