Class documentation of Concepts

Loading...
Searching...
No Matches
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
14namespace concepts {
15
16 // ********************************************************* FrmE_Component **
17
27 class H = typename Datatype<F>::type>
28 class FrmE_Component : public ElementFormula<H,G> {
29
30 public:
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
90 class H = typename Datatype<F>::type>
92
93 public:
101 const uint compRow, const uint compCol)
102 : frm_(frm), compRow_(compRow), compCol_(compCol)
103 {
104 }
105
106 virtual ~FrmE_Component_Matrix() {}
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
130 return new FrmE_Component_Matrix<F, G, H>(frm_, compRow_, compCol_);
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
141 uint compRow_, compCol_;
142 };
143
144} // namespace concepts
145
146#endif // FRME_COMPONENT_HH
147
virtual FrmE_Component_Matrix< F, G, H > * clone() const
Virtual copy constructor.
FrmE_Component_Matrix(const ElementFormulaContainer< F, G > &frm, const uint compRow, const uint compCol)
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
virtual H operator()(const ElementWithCell< G > &elm, const Real p, const Real t=0.0) const
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.
virtual FrmE_Component< F, G, H > * clone() const
Virtual copy constructor.
FrmE_Component(const ElementFormulaContainer< F, G > &frm, const uint comp)
std::string typeOf(const T &t)
Definition output.hh:43
double Real
Definition typedefs.hh:39
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320