Class documentation of Concepts

Loading...
Searching...
No Matches
frmE_matrix.hh
Go to the documentation of this file.
1
8#ifndef frme_matrix_hh
9#define frme_matrix_hh
10
11#include "elementFormula.hh"
13
14namespace concepts {
15
16 // *************************************************** FrmE_PointToMapping **
17
34 class FrmE_PointToMapping : public ElementFormula<Mapping<F,dim>,G> {
35 public:
39 bool transpose = false)
40 : frm_(frm)
41 {}
42
43 virtual ~FrmE_PointToMapping() {}
44
46 const Real p, const Real t = 0.0) const
47 {
48 return compute_(elm, p, t);
49 }
50
52 const Real2d &p, const Real t = 0.0) const
53 {
54 return compute_(elm, p, t);
55 }
56
58 const Real3d &p, const Real t = 0.0) const
59 {
60 return compute_(elm, p, t);
61 }
62
64 return new FrmE_PointToMapping<dim, F, G>(frm_);
65 }
66
67 protected:
68 virtual std::ostream& info(std::ostream &os) const {
69 return os << concepts::typeOf(*this) << "(" << frm_ << ")";
70 }
71 private:
75 bool transpose_;
76
77 template<class H>
78 Mapping<F,dim> compute_(const ElementWithCell<G> &elm,
79 const H& p, const Real t = 0.0) const
80 {
81 Point<F, dim*dim> point = frm_(elm, p, t);
82 DEBUGL(0, "point = " << point);
84 if (transpose_) {
85 for(uint i = 0; i < dim; ++i)
86 for(uint j = 0; j < dim; ++j)
87 m(i,j) = point[i+j*dim];
88 } else {
89 for(uint i = 0; i < dim; ++i)
90 for(uint j = 0; j < dim; ++j)
91 m(i,j) = point[j+i*dim];
92 }
93 DEBUGL(0, "m = " << m);
94 return m;
95 }
96 };
97
98 // *************************************************** FrmE_PointsToMapping **
99
101 class FrmE_PointsToMapping : public ElementFormula<Mapping<F,dim>,G> {
102 };
103
104 template<class F, class G>
105 class FrmE_PointsToMapping<2, F, G> : public ElementFormula<Mapping<F,2>,G> {
106 public:
110 bool transpose = false) :
111 frm1_(frm1), frm2_(frm2), transpose_(transpose) {}
112
113 virtual ~FrmE_PointsToMapping() {}
114
116 const Real p, const Real t = 0.0) const
117 {
118 const Mapping<F,2> m(frm1_(elm, p, t), frm2_(elm, p, t));
119 return transpose_ ? m.transpose() : m;
120 }
121
123 const Real2d &p, const Real t = 0.0) const
124 {
125 const Mapping<F,2> m(frm1_(elm, p, t), frm2_(elm, p, t));
126 return transpose_ ? m.transpose() : m;
127 }
128
130 const Real3d &p, const Real t = 0.0) const
131 {
132 const Mapping<F,2> m(frm1_(elm, p, t), frm2_(elm, p, t));
133 return transpose_ ? m.transpose() : m;
134 }
135
137 return new FrmE_PointsToMapping<2, F, G>(frm1_, frm2_, transpose_);
138 }
139
140 protected:
141 virtual std::ostream& info(std::ostream &os) const {
142 return os << concepts::typeOf(*this) << "(" << frm1_ << ", " << frm2_
143 << ", transpose = " << transpose_ << ")";
144 }
145 private:
149 bool transpose_;
150 };
151
152 // ************************************************************* FrmE_Trace **
153
155 class FrmE_Trace : public ElementFormula<F,G> {
156 public:
159 frm_(frm) {}
160
161 virtual ~FrmE_Trace() {}
162
163 virtual F operator ()(const ElementWithCell<G> &elm,
164 const Real p, const Real t = 0.0) const
165 {
166 return frm_(elm, p, t).trace();
167 }
168
169 virtual F operator ()(const ElementWithCell<G> &elm,
170 const Real2d &p, const Real t = 0.0) const
171 {
172 return frm_(elm, p, t).trace();
173 }
174
175 virtual F operator ()(const ElementWithCell<G> &elm,
176 const Real3d &p, const Real t = 0.0) const
177 {
178 return frm_(elm, p, t).trace();
179 }
180
181 virtual FrmE_Trace<dim,F,G>* clone() const {
182 return new FrmE_Trace<dim, F, G>(frm_);
183 }
184
185 protected:
186 virtual std::ostream& info(std::ostream &os) const {
187 return os << concepts::typeOf(*this) << "(" << frm_ << ")";
188 }
189 private:
192 };
193
194} // namespace concepts
195
196#endif // frme_matrix_hh
virtual F operator()(const ElementWithCell< G > &elm, const Real p, const Real t=0.0) const =0
virtual Mapping< F, dim > operator()(const ElementWithCell< G > &elm, const Real p, const Real t=0.0) const
virtual FrmE_PointToMapping< dim, F, G > * clone() const
Virtual copy constructor.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
FrmE_PointToMapping(const ElementFormulaContainer< Point< F, dim *dim >, G > &frm, bool transpose=false)
Constructor.
virtual FrmE_PointsToMapping< 2, F, G > * clone() const
Virtual copy constructor.
FrmE_PointsToMapping(const ElementFormulaContainer< Point< F, 2 >, G > frm1, const ElementFormulaContainer< Point< F, 2 >, G > frm2, bool transpose=false)
Constructor with two vectors.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
virtual F operator()(const ElementWithCell< G > &elm, const Real p, const Real t=0.0) const
FrmE_Trace(const ElementFormulaContainer< Mapping< F, dim >, G > frm)
Constructor with an element formula giving back a mapping.
virtual FrmE_Trace< dim, F, G > * clone() const
Virtual copy constructor.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Mapping< F, DimX, DimY > transpose() const
Returns the transpose of the matrix.
#define DEBUGL(doit, msg)
Definition debug.hh:40
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