frmE_inverse.hh

Go to the documentation of this file.
1 
8 #ifndef inverseelementformula_hh
9 #define inverseelementformula_hh
10 
11 #include "basics/debug.hh"
12 //#include "elementFormulaContainer.hh"
13 #include "exceptions.hh"
14 
15 #define InvElemFormConstr_D 0
16 #define InvElemFormDestr_D 0
17 #define InvElemFormClone_D 0
18 
19 namespace concepts {
20 
21  // forward declaration
22  template<class F, class G>
23  class ElementFormulaContainer;
24 
25 
26  // *********************************************************** FrmE_Inverse **
27 
35  template<typename F, typename G = typename Realtype<F>::type>
36  class FrmE_Inverse : public ElementFormula<F,G> {
37  public:
39  : frm_(frm)
40  {
41  if (frm.empty()) throw(PointerToEmptyElementFormula());
42  }
45  : frm_(frm.frm_) {}
46 
47  virtual ~FrmE_Inverse() {
48  DEBUGL(InvElemFormDestr_D, "Delete " << *this)
49  }
50 
51  virtual F operator() (const ElementWithCell<G>& elm,
52  const Real p, const Real t = 0.0) const {
53  F v = frm_(elm, p,t);
54 
55  return 1.0 / v;
56  }
57  virtual F operator() (const ElementWithCell<G>& elm,
58  const Real2d& p, const Real t = 0.0) const {
59  F v = frm_(elm, p,t);
60 
61  return 1.0 / v;
62  }
63  virtual F operator() (const ElementWithCell<G>& elm,
64  const Real3d& p, const Real t = 0.0) const {
65  F v = frm_(elm, p,t);
66 
67  return 1.0 / v;
68  }
69  virtual FrmE_Inverse<F,G>* clone() const {
70  return new FrmE_Inverse<F,G>(frm_);
71  }
72  protected:
73  virtual std::ostream& info(std::ostream& os) const {
74  return os << concepts::typeOf(*this) << "(1 / " << frm_ << ')';
75  }
76  private:
79  };
80 
81 } // namespace concepts
82 
83 
84 #endif // inverseelementformula_hh
#define InvElemFormDestr_D
Definition: frmE_inverse.hh:16
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Definition: frmE_inverse.hh:73
ElementFormulaContainer< F, G > frm_
Original ElementFormula.
Definition: frmE_inverse.hh:78
Element with cell.
#define DEBUGL(doit, msg)
bool empty() const
Returns true if no formula is stored.
Interface for a formula defined element by element.
virtual F operator()(const ElementWithCell< G > &elm, const Real p, const Real t=0.0) const
Definition: frmE_inverse.hh:51
virtual FrmE_Inverse< F, G > * clone() const
Virtual constructor.
Definition: frmE_inverse.hh:69
FrmE_Inverse(const ElementFormulaContainer< F, G > frm)
Definition: frmE_inverse.hh:38
std::string typeOf(const T &t)
Return the typeid name of a class object.
Definition: output.hh:43
Inverse of an element formula.
Definition: frmE_inverse.hh:36
FrmE_Inverse(const FrmE_Inverse< F, G > &frm)
Copy constructor.
Definition: frmE_inverse.hh:44
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
Exception class to express that the RCP pointer points to 0.
Definition: exceptions.hh:55
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