Go to the documentation of this file.00001
00008 #ifndef inverseelementformula_hh
00009 #define inverseelementformula_hh
00010
00011 #include "basics/debug.hh"
00012
00013 #include "exceptions.hh"
00014
00015 #define InvElemFormConstr_D 0
00016 #define InvElemFormDestr_D 0
00017 #define InvElemFormClone_D 0
00018
00019 namespace concepts {
00020
00021
00022 template<class F, class G>
00023 class ElementFormulaContainer;
00024
00025
00026
00027
00035 template<typename F, typename G = typename Realtype<F>::type>
00036 class FrmE_Inverse : public ElementFormula<F,G> {
00037 public:
00038 FrmE_Inverse(const ElementFormulaContainer<F,G> frm)
00039 : frm_(frm)
00040 {
00041 if (frm.empty()) throw(PointerToEmptyElementFormula());
00042 }
00044 FrmE_Inverse(const FrmE_Inverse<F,G>& frm)
00045 : frm_(frm.frm_) {}
00046
00047 virtual ~FrmE_Inverse() {
00048 DEBUGL(InvElemFormDestr_D, "Delete " << *this)
00049 }
00050
00051 virtual F operator() (const ElementWithCell<G>& elm,
00052 const Real p, const Real t = 0.0) const {
00053 F v = frm_(elm, p,t);
00054
00055 return 1.0 / v;
00056 }
00057 virtual F operator() (const ElementWithCell<G>& elm,
00058 const Real2d& p, const Real t = 0.0) const {
00059 F v = frm_(elm, p,t);
00060
00061 return 1.0 / v;
00062 }
00063 virtual F operator() (const ElementWithCell<G>& elm,
00064 const Real3d& p, const Real t = 0.0) const {
00065 F v = frm_(elm, p,t);
00066
00067 return 1.0 / v;
00068 }
00069 virtual FrmE_Inverse<F,G>* clone() const {
00070 return new FrmE_Inverse<F,G>(frm_);
00071 }
00072 protected:
00073 virtual std::ostream& info(std::ostream& os) const {
00074 return os << "FrmE_Inverse(1 / " << frm_ << ')';
00075 }
00076 private:
00078 ElementFormulaContainer<F,G> frm_;
00079 };
00080
00081 }
00082
00083
00084 #endif // inverseelementformula_hh