piecewiseFormula.hh

Go to the documentation of this file.
1 
8 #ifndef piecewiseformula_hh
9 #define piecewiseformula_hh
10 
11 #include "space/element.hh"
12 #include "elementFormula.hh"
13 #include "basics/output.hh"
14 
15 
16 namespace concepts {
17 
18  // ************************************************** PiecewiseFormulaBase **
19 
41  template<typename F>
43  public ElementFormula<F, typename concepts::Realtype<F>::type> {
44  public:
45  typedef typename concepts::Realtype<F>::type G;
46 
50  virtual PiecewiseFormulaBase<F>* clone() const = 0;
51 
52  virtual F operator()(const ElementWithCell<G>& elm, const Real p,
53  const Real t = 0.0) const
54  {
55  return operator()(elm.cell().connector(), elm.elemMap(p), t);
56  }
57  virtual F operator()(const ElementWithCell<G>& elm, const Real2d& p,
58  const Real t = 0.0) const
59  {
60  return operator()(elm.cell().connector(), elm.elemMap(p), t);
61  }
62 
63  virtual F operator()(const ElementWithCell<G>& elm, const Real3d& p,
64  const Real t = 0.0) const
65  {
66  return operator()(elm.cell().connector(), elm.elemMap(p), t);
67  }
68 
74  virtual F operator()(const Connector& cntr, const Real p,
75  const Real t = 0.0) const = 0;
76  virtual F operator()(const Connector& cntr, const Real2d& p,
77  const Real t = 0.0) const = 0;
78  virtual F operator()(const Connector& cntr, const Real3d& p,
79  const Real t = 0.0) const = 0;
81  inline virtual const F& dflt_value() const { return dflt_value_;}
83  inline virtual F& dflt_value() { return dflt_value_;}
84  protected:
85  virtual std::ostream& info(std::ostream& os) const;
86  private:
89  };
90 
91  template<typename F>
93  dflt_value_(dflt_value) {
94  }
95 
96  template<typename F>
98 
99  template<typename F>
100  std::ostream& PiecewiseFormulaBase<F>::info(std::ostream& os) const {
101  os << concepts::typeOf(*this) << "(default value = " << dflt_value() << ")";
102  return os;
103  }
104 
105 } // namespace concepts
106 
107 #endif // piecewiseformula_hh
virtual F & dflt_value()
Gives default value.
Piecewise defined function on a number of cells.
Real3d elemMap(const Real coord_local) const
Definition: element.hh:86
concepts::Realtype< F >::type G
Element with cell.
virtual const F & dflt_value() const
Gives default value.
virtual F operator()(const Connector &cntr, const Real3d &p, const Real t=0.0) const =0
Interface for a formula defined element by element.
virtual F operator()(const ElementWithCell< G > &elm, const Real3d &p, const Real t=0.0) const
virtual F operator()(const Connector &cntr, const Real2d &p, const Real t=0.0) const =0
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
virtual const Cell & cell() const =0
Returns the cell on which the element is built.
PiecewiseFormulaBase(const F dflt_value=(F) 0)
Constructor with default value.
std::string typeOf(const T &t)
Return the typeid name of a class object.
Definition: output.hh:43
virtual PiecewiseFormulaBase< F > * clone() const =0
Virtual constructor.
An abstract class for elements of the topology.
Definition: connector.hh:85
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
virtual F operator()(const ElementWithCell< G > &elm, const Real p, const Real t=0.0) const
virtual F operator()(const Connector &cntr, const Real p, const Real t=0.0) const =0
Gives the value in an particular cell on a particular point.
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
virtual F operator()(const ElementWithCell< G > &elm, const Real2d &p, const Real t=0.0) const
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich