frmE_component.hh

Go to the documentation of this file.
1 
8 #ifndef FRME_COMPONENT_HH
9 #define FRME_COMPONENT_HH
10 
11 #include "elementFormula.hh"
13 
14 namespace concepts {
15 
16  // ********************************************************* FrmE_Component **
17 
26  template<class F, class G = typename Realtype<F>::type,
27  class H = typename Datatype<F>::type>
28  class FrmE_Component : public ElementFormula<H,G> {
29 
30  public:
36  FrmE_Component(const ElementFormulaContainer<F,G> &frm, const uint comp)
37  : frm_(frm), comp_(comp)
38  {
39  }
40 
41  virtual ~FrmE_Component() {}
42 
43  virtual H operator ()(const ElementWithCell<G> &elm,
44  const Real p, const Real t = 0.0) const
45  {
46  F value = frm_(elm, p, t);
47  return value[comp_];
48  }
49 
50  virtual H operator ()(const ElementWithCell<G> &elm,
51  const Real2d &p, const Real t = 0.0) const
52  {
53  F value = frm_(elm, p, t);
54  return value[comp_];
55  }
56 
57  virtual H operator ()(const ElementWithCell<G> &elm,
58  const Real3d &p, const Real t = 0.0) const
59  {
60  F value = frm_(elm, p, t);
61  return value[comp_];
62  }
63 
64  virtual FrmE_Component<F,G,H>* clone() const {
65  return new FrmE_Component<F, G, H>(frm_, comp_);
66  }
67 
68  protected:
69  virtual std::ostream& info(std::ostream &os) const {
70  return os << concepts::typeOf(*this) <<"(component " << comp_
71  << " of " << frm_ << ")";
72  }
73 
74  private:
76  uint comp_;
77  };
78 
79  // ************************************************** FrmE_Component_Matrix **
80 
89  template<class F, class G = typename Realtype<F>::type,
90  class H = typename Datatype<F>::type>
91  class FrmE_Component_Matrix : public ElementFormula<H,G> {
92 
93  public:
101  const uint compRow, const uint compCol)
102  : frm_(frm), compRow_(compRow), compCol_(compCol)
103  {
104  }
105 
107 
108  virtual H operator ()(const ElementWithCell<G> &elm,
109  const Real p, const Real t = 0.0) const
110  {
111  F value = frm_(elm, p, t);
112  return value(compRow_, compCol_);
113  }
114 
115  virtual H operator ()(const ElementWithCell<G> &elm,
116  const Real2d &p, const Real t = 0.0) const
117  {
118  F value = frm_(elm, p, t);
119  return value(compRow_, compCol_);
120  }
121 
122  virtual H operator ()(const ElementWithCell<G> &elm,
123  const Real3d &p, const Real t = 0.0) const
124  {
125  F value = frm_(elm, p, t);
126  return value(compRow_, compCol_);
127  }
128 
131  }
132 
133  protected:
134  virtual std::ostream& info(std::ostream &os) const {
135  return os << concepts::typeOf(*this) << "(component (" << compRow_
136  << ", " << compCol_ << ") of " << frm_ << ")";
137  }
138  private:
140 
142  };
143 
144 } // namespace concepts
145 
146 #endif // FRME_COMPONENT_HH
147 
Class representing a component of an element formula.
Class representing a component of an element formula.
Element with cell.
FrmE_Component_Matrix(const ElementFormulaContainer< F, G > &frm, const uint compRow, const uint compCol)
Constructor.
virtual FrmE_Component_Matrix< F, G, H > * clone() const
Virtual constructor.
Interface for a formula defined element by element.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
ElementFormulaContainer< F, G > frm_
virtual H operator()(const ElementWithCell< G > &elm, const Real p, const Real t=0.0) const
virtual FrmE_Component< F, G, H > * clone() const
Virtual constructor.
virtual H operator()(const ElementWithCell< G > &elm, const Real p, const Real t=0.0) const
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
FrmE_Component(const ElementFormulaContainer< F, G > &frm, const uint comp)
Constructor.
ElementFormulaContainer< F, G > frm_
std::string typeOf(const T &t)
Return the typeid name of a class object.
Definition: output.hh:43
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