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 
17 namespace graphics {
18 
19  using concepts::Real;
20 
21  //forward declaration
22  template<class G>
23  class DenseMatrixCollection;
24 
25  // ****************************************************** MatrixCounterCell **
26 
34  public:
43  concepts::ElementGraphicsBase::DENSEMATRIX, const uint points = 5);
44 
46  virtual ~MatrixCounterCell();
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 
91 
94 
95  };
96 
97  // ************************************************* MatrixBasisOutputCell **
98 
103  template<class G = Real>
105  public:
106 
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 
150  };
151 
152  // ************************************************* MatrixSpaceOutputCell **
153 
159  template<class G = Real>
161 
162  public:
163 
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 
224  uint counter;
225 
227  inline virtual void resetCounter() {
228  this->indexOfPoints = 0;
229  indexOfMesh = 0;
230  indexOfEdgeMesh = 0;
231  indexOfEdgAttr = 0;
232  indexOfVertexMesh = 0;
233  indexOfAttributes = 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:
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 
277  }
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  throw (concepts::MissingFeature) {
289  throw conceptsException(concepts::MissingFeature("cell not supported"));
290  }
291 
294  return fun_;
295  }
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 
352  }
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 
395  private:
398 
403 
406 
409 
410  };
411 
412  // **************************************************** MatrixBaseMeshCell **
413 
421  public:
422 
430  2, const uint points = 5,
433  MatrixSpaceOutputCell<Real>(dense_ptr, dim, type), points_(dim, points) {
434  }
435 
438 
440  virtual void operator()(const concepts::Element<Real>& elm);
441 
443  virtual void operator()(const concepts::Cell& cell);
444 
445  private:
448  };
449 
450 } //namespace graphics
451 
452 #endif // matrix_base_hh
virtual concepts::ElementMatrix< F > * funValue() const
Getter for the dense matrix with the function values.
Definition: matrixBasis.hh:384
uint indexOfFaceMesh
Index of the (next) graphics quad.
Definition: matrixBasis.hh:198
Class for writing the values of the solution of a PDE on the quadrature points of the space in a Dens...
Definition: matrixBasis.hh:331
Basis class for graphical output using dense matrices.
Definition: matrixBasis.hh:104
virtual void operator()(const concepts::Cell &cell)
Application operator on a single cell (not implemented)
Definition: matrixBasis.hh:364
An abstract class for a function in a FE space.
MatrixSpaceOutputCell(DenseMatrixCollection< G > &dense_ptr, uint dim=2, const enum concepts::ElementGraphicsBase::graphicsType type=concepts::ElementGraphicsBase::DENSEMATRIX)
Constructor (for collecting space data)
Definition: matrixBasis.hh:169
virtual void resetCounter()
Resets all counter.
Definition: matrixBasis.hh:227
std::map< std::string, uint > noRows
Number of rows for the matrices.
Definition: matrixBasis.hh:78
virtual ~MatrixBasisOutputCell()
Destructor.
Definition: matrixBasis.hh:118
#define conceptsException(exc)
Prepares an exception for throwing.
Definition: exceptions.hh:344
virtual void operator()(const concepts::Element< G > &elm)=0
Writes data of the given element in the matrices.
MatrixBaseMeshCell(DenseMatrixCollection< Real > &dense_ptr, const uint dim=2, const uint points=5, const enum concepts::ElementGraphicsBase::graphicsType type=concepts::ElementGraphicsBase::MESH_DENSEMATRIX)
Constructor (for single and repeated output)
Definition: matrixBasis.hh:429
virtual concepts::ElementMatrix< dataType > * funValue() const
Getter for the dense matrix with the function values.
Definition: matrixBasis.hh:303
const concepts::Array< uint > points_
Number of points in one direction.
Definition: matrixBasis.hh:447
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Definition: matrixBasis.hh:307
const concepts::ElementFormula< F, G > & fun_
Element Formula.
Definition: matrixBasis.hh:320
A cell in a mesh consist of topological information (neighbours, connectivity, orientation) and geome...
Definition: cell.hh:39
const concepts::Array< F > & coeff() const
Local coefficient vector (w.r.t.
Definition: matrixBasis.hh:391
concepts::Datatype< F >::type dataType
Definition: matrixBasis.hh:261
const concepts::ElementFormula< F, G > & elementFormula()
Returns the element formula.
Definition: matrixBasis.hh:293
virtual void resetCounter()
resets all counters to zero
Definition: matrixBasis.hh:133
virtual void operator()(const concepts::Element< G > &elm)
Writes data of the given element in the matrices.
Definition: matrixBasis.hh:183
virtual const TMatrixBase< F > & T() const =0
Returns the T matrix of the element.
virtual void operator()(const concepts::Cell &cell)
Writes data of the given cell in the matrices.
Definition: matrixBasis.hh:190
virtual void operator()(const concepts::Element< G > &elm)
Application operator on a single element fill matrices.
Definition: matrixBasis.hh:358
Class that collects information about the mesh/space it iterates over, that are used for MatrixBasisO...
Definition: matrixBasis.hh:33
concepts::ElementMatrix< dataType > *& funValue_
Function Value in evaluate points.
Definition: matrixBasis.hh:317
virtual void operator()(const concepts::Cell &cell)
Writes Data of the given cell in the matrices.
virtual const ElementGraphics< F > * graphics() const
Definition: element.hh:63
MatrixBasisOutputCell(const enum concepts::ElementGraphicsBase::graphicsType type=concepts::ElementGraphicsBase::DENSEMATRIX, uint dim=2)
Constructor for the pure virtual class.
Definition: matrixBasis.hh:110
uint dim_
The space dimension of the mesh (1, 2, or 3)
Definition: matrixBasis.hh:143
uint n()
Getter for the dimension of the solution output (number of components)
Definition: matrixBasis.hh:377
virtual uint n() const
Getter for the dimension of the solution output (number of components)
Definition: matrixBasis.hh:298
virtual void operator()(const concepts::Cell &cell)
Output of the mesh of of the cell cell.
const concepts::Vector< F > & sol_
The solution vector.
Definition: matrixBasis.hh:408
Class that iterates over a mesh and collects graphical informations in a set of ElementMatrices.
Definition: matrixBasis.hh:420
uint indexOfEdgAttr
Index of the (next) graphics edge (used for edge attribute)
Definition: matrixBasis.hh:210
const concepts::ElementFunction< F, G > * fun_
ElementFunction.
Definition: matrixBasis.hh:397
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
uint indexOfEdgeMesh
Index of the (next) graphics edge in the edge mesh.
Definition: matrixBasis.hh:201
DenseMatrixCollection< G > & dense_ptr_
The mapping that holds the matrices.
Definition: matrixBasis.hh:248
uint indexOfVtxAttr
Index of the (next) quad (used for the vertex attribute)
Definition: matrixBasis.hh:216
Graphics.
Definition: basis.hh:33
Class that collects graphical informations about a given space in a set of ElementMatrices.
Definition: matrixBasis.hh:160
MatrixCounterCell(const concepts::ElementGraphicsBase::graphicsType type=concepts::ElementGraphicsBase::DENSEMATRIX, const uint points=5)
Constructor.
Interface for a formula defined element by element.
uint indexOfVertexMesh
Index of the (next) quad (used for the vertex mesh).
Definition: matrixBasis.hh:204
virtual ~MatrixBaseMeshCell()
Destructor.
concepts::Array< uint > points_
Number of points in one direction.
Definition: matrixBasis.hh:93
uint dim() const
returns the space dimension of the mesh (two by default)
Definition: matrixBasis.hh:128
virtual void operator()(const concepts::Element< Real > &elm)
Writes data of the given element in the matrices.
virtual void operator()(const concepts::Element< Real > &elm)
Output of the mesh of the element elm.
uint indexOfPolynomialDegree
Index of the (next) quad (used for the polynomial degree)
Definition: matrixBasis.hh:219
uint indexOfMesh
Index of the (next) graphics quad (the small one).
Definition: matrixBasis.hh:195
MatrixSolutionEvaluationCell(concepts::ElementMatrix< F > *funValue, const concepts::Vector< F > &solution, const concepts::ElementFunction< F, G > *fun=0, uint dim=2)
Constructor which expects the dense matrices dense_ptr and funValue, the solution vector solution and...
Definition: matrixBasis.hh:343
uint dimensionsOfMatrices[5]
Four counters that stores space-dependent values (for ex.
Definition: matrixBasis.hh:75
concepts::ElementMatrix< F > * funValue_
Function Value in evaluate points.
Definition: matrixBasis.hh:405
MatrixBaseElementFormulaCell(concepts::ElementMatrix< dataType > *&funValue, const uint dim, const concepts::ElementFormula< F, G > &fun)
Constructor (for single and repeated output)
Definition: matrixBasis.hh:269
uint counter
Number of stored points.
Definition: matrixBasis.hh:224
uint indexOfFaceAttr
Index of the (next) graphics edge (used for edge attribute)
Definition: matrixBasis.hh:213
Class for writing the graphical output of an element formula to ElementMatrices.
Definition: matrixBasis.hh:259
Exception class to express a missing feature.
Definition: exceptions.hh:206
virtual void operator()(const concepts::Cell &cell)=0
Writes Data of the given cell in the matrices.
virtual void operator()(const concepts::Element< G > &elm)
Output of the mesh and vector data of the element.
Definition: matrixBasis.hh:282
virtual void operator()(const concepts::Cell &cell)
Not operational.
Definition: matrixBasis.hh:287
const uint n()=0
int getDimensionsOfMatrices(uint i)
returns the dimension og
Definition: matrixBasis.hh:49
DenseMatrixCollection< G > & getMapping()
Returns a mapping with all dense matrices, where data should be stored.
Definition: matrixBasis.hh:242
virtual ~MatrixSolutionEvaluationCell()
Destructor.
Definition: matrixBasis.hh:351
concepts::Array< F > coeff_
Local coefficient vector in one element (size is number of local shape functions)
Definition: matrixBasis.hh:402
std::string typeOf(const T &t)
Return the typeid name of a class object.
Definition: output.hh:43
const concepts::ElementFunction< F, G > * elementFunction()
Getter for the element function.
Definition: matrixBasis.hh:369
enum concepts::ElementGraphicsBase::graphicsType type_
The graphicsType (either concepts::ElementGraphicsBase::DENSEMATRIX or concepts::ElementGraphicsBase:...
Definition: matrixBasis.hh:149
uint indexOfAttributes
Index of the (next) quad (used for the attributes).
Definition: matrixBasis.hh:207
Abstract class for per cell postprocessing.
Definition: postProcess.hh:38
enum concepts::ElementGraphicsBase::graphicsType type_
The graphicsType (either concepts::ElementGraphicsBase::DENSEMATRIX or concepts::ElementGraphicsBase:...
Definition: matrixBasis.hh:90
Class that hold and manage a std::map with concepts::ElementMatrices for graphical output,...
virtual ~MatrixCounterCell()
Destructor.
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
virtual ~MatrixSpaceOutputCell()
Destructor.
Definition: matrixBasis.hh:177
uint indexOfPoints
Index of the (next) graphics point.
Definition: matrixBasis.hh:138
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
virtual ~MatrixBaseElementFormulaCell()
Destructor.
Definition: matrixBasis.hh:276
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich