Class documentation of Concepts

Loading...
Searching...
No Matches
matrixBasis.hh
Go to the documentation of this file.
1
6#ifndef matrix_base_hh
7#define matrix_base_hh
8
9#include "basics.hh"
10#include "toolbox.hh"
11#include "geometry.hh"
12#include "function.hh"
13#include "operator.hh"
14#include "space.hh"
15#include "basis.hh"
16
17namespace graphics {
18
19 using concepts::Real;
20
21 //forward declaration
22 template<class G>
23 class DenseMatrixCollection;
24
25 // ****************************************************** MatrixCounterCell **
26
34 public:
42 MatrixCounterCell(const concepts::ElementGraphicsBase::graphicsType type =
43 concepts::ElementGraphicsBase::DENSEMATRIX, const uint points = 5);
44
47
49 inline int getDimensionsOfMatrices(uint i) {
50 return this->dimensionsOfMatrices[i];
51 }
52
53 inline int getDim() {
54 return dim_;
55 }
56 ;
57 inline void setDim(int dim) {
58 dim_ = dim;
59 }
60 ;
61
63 virtual void operator()(const concepts::Element<Real>& elm);
64
66 virtual void operator()(const concepts::Cell& cell);
67
76
78 std::map<std::string, uint> noRows;
79
80 protected:
81 virtual std::ostream& info(std::ostream& os) const;
82 private:
83
84 int dim_;
85
90 const enum concepts::ElementGraphicsBase::graphicsType type_;
91
94
95 };
96
97 // ************************************************* MatrixBasisOutputCell **
98
103 template<class G = Real>
105 public:
106
111 const enum concepts::ElementGraphicsBase::graphicsType type =
112 concepts::ElementGraphicsBase::DENSEMATRIX, uint dim = 2) :
113 dim_(dim), type_(type) {
114 resetCounter();
115 }
116
119 }
120
122 virtual void operator()(const concepts::Element<G>& elm) = 0;
123
125 virtual void operator()(const concepts::Cell& cell) = 0;
126
128 inline uint dim() const {
129 return dim_;
130 }
131
133 inline virtual void resetCounter() {
134 indexOfPoints = 0;
135 }
136
139
140 protected:
141
143 uint dim_;
144
149 const enum concepts::ElementGraphicsBase::graphicsType type_;
150 };
151
152 // ************************************************* MatrixSpaceOutputCell **
153
159 template<class G = Real>
161
162 public:
163
170 const enum concepts::ElementGraphicsBase::graphicsType type =
171 concepts::ElementGraphicsBase::DENSEMATRIX) :
172 MatrixBasisOutputCell<G>(type, dim), dense_ptr_(dense_ptr) {
173 resetCounter();
174 }
175
178 }
179
183 virtual void operator()(const concepts::Element<G>& elm) {
184 elm.graphics()->operator()(elm, this->type_, *this);
185 }
186
190 virtual void operator()(const concepts::Cell& cell) {
191 throw conceptsException(concepts::MissingFeature("cell not supported"));
192 }
193
196
199
202
205
208
211
214
217
220
225
227 inline virtual void resetCounter() {
228 this->indexOfPoints = 0;
229 indexOfMesh = 0;
230 indexOfEdgeMesh = 0;
231 indexOfEdgAttr = 0;
234 indexOfVtxAttr = 0;
236 indexOfFaceMesh = 0;
237 counter = 0;
238 indexOfFaceAttr = 0;
239 }
240
243 return dense_ptr_;
244 }
245
246 protected:
249 };
250
251 // ****************************************** MatrixBaseElementFormulaCell **
252
258 template<class F, class G = typename concepts::Realtype<F>::type>
260 public:
261 typedef typename concepts::Datatype<F>::type dataType;
262
270 const uint dim, const concepts::ElementFormula<F, G>& fun) :
271 MatrixBasisOutputCell<G>(concepts::ElementGraphicsBase::DENSEMATRIX,
272 dim), funValue_(funValue), fun_(fun) {
273 }
274
278
282 virtual void operator()(const concepts::Element<G>& elm) {
283 elm.graphics()->operator()(elm, this->type_, *this);
284 }
285
287 virtual void operator()(const concepts::Cell& cell)
288 {
289 throw conceptsException(concepts::MissingFeature("cell not supported"));
290 }
291
296
298 virtual uint n() const {
299 return Size<F>::n();
300 }
301
304 return funValue_;
305 }
306 protected:
307 virtual std::ostream& info(std::ostream& os) const {
308 os << concepts::typeOf(*this)<<"(funValue = ";
309 if (funValue_)
310 os << *funValue_;
311 else
312 os << "0";
313 return os << ", frm = " << fun_ << ")";
314 }
315
318
321 };
322
323 // ****************************************** MatrixSolutionEvaluationCell **
324
330 template<class F, class G = typename concepts::Realtype<F>::type>
332 public:
333
344 const concepts::Vector<F>& solution,
345 const concepts::ElementFunction<F, G>* fun = 0, uint dim = 2) :
346 MatrixBasisOutputCell<G>(concepts::ElementGraphicsBase::DENSEMATRIX,
347 dim), fun_(fun), funValue_(funValue), sol_(solution) {
348 }
349
353
358 inline virtual void operator()(const concepts::Element<G>& elm) {
359 elm.T().extract(sol_, coeff_);
360 elm.graphics()->operator()(elm, this->type_, *this);
361 }
362
364 virtual void operator()(const concepts::Cell& cell) {
365 throw conceptsException(concepts::MissingFeature("cell not supported"));
366 }
367
370 if (fun_)
371 return fun_;
372 else
373 return 0;
374 }
375
377 inline uint n() {
378 if (!fun_)
379 return 1;
380 return fun_->n();
381 }
382
385 return funValue_;
386 }
387
391 inline const concepts::Array<F>& coeff() const {
392 return coeff_;
393 }
394 protected:
395 virtual std::ostream& info(std::ostream& os) const {
396 os << concepts::typeOf(*this)<<"(funValue = ";
397 if (funValue_)
398 os << *funValue_;
399 else
400 os << "0";
401 os << ", fun = ";
402 if (fun_)
403 os << *fun_;
404 else
405 os << "0";
406 return os << ")";
407 }
408 private:
411
415 concepts::Array<F> coeff_;
416
419
421 const concepts::Vector<F>& sol_;
422
423 };
424
425 // **************************************************** MatrixBaseMeshCell **
426
434 public:
435
443 2, const uint points = 5,
444 const enum concepts::ElementGraphicsBase::graphicsType type =
445 concepts::ElementGraphicsBase::MESH_DENSEMATRIX) :
446 MatrixSpaceOutputCell<Real>(dense_ptr, dim, type), points_(dim, points) {
447 }
448
451
453 virtual void operator()(const concepts::Element<Real>& elm);
454
456 virtual void operator()(const concepts::Cell& cell);
457
458 private:
460 const concepts::Array<uint> points_;
461 };
462
463} //namespace graphics
464
465#endif // matrix_base_hh
#define conceptsException(exc)
virtual const TMatrixBase< F > & T() const =0
Returns the T matrix of the element.
concepts::ElementMatrix< dataType > *& funValue_
Function Value in evaluate points.
virtual concepts::ElementMatrix< dataType > * funValue() const
Getter for the dense matrix with the function values.
virtual uint n() const
Getter for the dimension of the solution output (number of components)
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
MatrixBaseElementFormulaCell(concepts::ElementMatrix< dataType > *&funValue, const uint dim, const concepts::ElementFormula< F, G > &fun)
const concepts::ElementFormula< F, G > & fun_
Element Formula.
virtual ~MatrixBaseElementFormulaCell()
Destructor.
virtual void operator()(const concepts::Element< G > &elm)
const concepts::ElementFormula< F, G > & elementFormula()
Returns the element formula.
virtual void operator()(const concepts::Cell &cell)
Not operational.
virtual void operator()(const concepts::Cell &cell)
Output of the mesh of of the cell cell.
virtual ~MatrixBaseMeshCell()
Destructor.
virtual void operator()(const concepts::Element< Real > &elm)
Output of the mesh of the element elm.
MatrixBaseMeshCell(DenseMatrixCollection< Real > &dense_ptr, const uint dim=2, const uint points=5, const enum concepts::ElementGraphicsBase::graphicsType type=concepts::ElementGraphicsBase::MESH_DENSEMATRIX)
uint dim() const
returns the space dimension of the mesh (two by default)
virtual void resetCounter()
resets all counters to zero
uint dim_
The space dimension of the mesh (1, 2, or 3)
uint indexOfPoints
Index of the (next) graphics point.
virtual ~MatrixBasisOutputCell()
Destructor.
virtual void operator()(const concepts::Element< G > &elm)=0
Writes data of the given element in the matrices.
virtual void operator()(const concepts::Cell &cell)=0
Writes Data of the given cell in the matrices.
enum concepts::ElementGraphicsBase::graphicsType type_
MatrixBasisOutputCell(const enum concepts::ElementGraphicsBase::graphicsType type=concepts::ElementGraphicsBase::DENSEMATRIX, uint dim=2)
virtual void operator()(const concepts::Element< Real > &elm)
Writes data of the given element in the matrices.
std::map< std::string, uint > noRows
Number of rows for the matrices.
MatrixCounterCell(const concepts::ElementGraphicsBase::graphicsType type=concepts::ElementGraphicsBase::DENSEMATRIX, const uint points=5)
virtual ~MatrixCounterCell()
Destructor.
int getDimensionsOfMatrices(uint i)
returns the dimension og
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
virtual void operator()(const concepts::Cell &cell)
Writes Data of the given cell in the matrices.
const concepts::Array< F > & coeff() const
virtual ~MatrixSolutionEvaluationCell()
Destructor.
uint n()
Getter for the dimension of the solution output (number of components)
const concepts::ElementFunction< F, G > * elementFunction()
Getter for the element function.
virtual void operator()(const concepts::Cell &cell)
Application operator on a single cell (not implemented)
MatrixSolutionEvaluationCell(concepts::ElementMatrix< F > *funValue, const concepts::Vector< F > &solution, const concepts::ElementFunction< F, G > *fun=0, uint dim=2)
virtual concepts::ElementMatrix< F > * funValue() const
Getter for the dense matrix with the function values.
virtual void operator()(const concepts::Element< G > &elm)
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
uint indexOfPolynomialDegree
Index of the (next) quad (used for the polynomial degree)
uint indexOfMesh
Index of the (next) graphics quad (the small one).
uint indexOfVertexMesh
Index of the (next) quad (used for the vertex mesh).
virtual void resetCounter()
Resets all counter.
uint indexOfAttributes
Index of the (next) quad (used for the attributes).
DenseMatrixCollection< G > & getMapping()
Returns a mapping with all dense matrices, where data should be stored.
uint indexOfEdgeMesh
Index of the (next) graphics edge in the edge mesh.
uint indexOfFaceAttr
Index of the (next) graphics edge (used for edge attribute)
virtual void operator()(const concepts::Cell &cell)
uint indexOfEdgAttr
Index of the (next) graphics edge (used for edge attribute)
virtual ~MatrixSpaceOutputCell()
Destructor.
DenseMatrixCollection< G > & dense_ptr_
The mapping that holds the matrices.
virtual void operator()(const concepts::Element< G > &elm)
uint indexOfFaceMesh
Index of the (next) graphics quad.
MatrixSpaceOutputCell(DenseMatrixCollection< G > &dense_ptr, uint dim=2, const enum concepts::ElementGraphicsBase::graphicsType type=concepts::ElementGraphicsBase::DENSEMATRIX)
uint indexOfVtxAttr
Index of the (next) quad (used for the vertex attribute)
std::string typeOf(const T &t)
Definition output.hh:43
double Real
Definition typedefs.hh:39