Class documentation of Concepts

Loading...
Searching...
No Matches
denseMatrixGraphics.hh
Go to the documentation of this file.
1
6#ifndef densematrixgraphics_hh_
7#define densematrixgraphics_hh_
8
10#include "matrixBasis.hh"
11#include <map>
12
13using concepts::Real;
14
15namespace graphics {
16
17 // ************************************************* DenseMatrixCollection **
18
25 template<class G>
26 class DenseMatrixCollection: public std::map<std::string,
27 concepts::ElementMatrix<G>* const > {
28 public:
29
42 DenseMatrixCollection(MatrixCounterCell& counter, bool data = true);
43
46
47 protected:
48
50 int dim_;
51
53 bool data_;
54
56 void createMatrix_(const std::string name, uint nrows, uint ncols);
57
60 };
61
62 // ************************************************** DenseMatrixGraphics **
63
70 public:
71
74
77
78 static uint noPoints;
79
80 protected:
90 template<class F, class G>
93 const concepts::ElementFunction<F, G>* fun = 0);
94
102 template<class F, class G>
106
113 template<class G>
115 getSpace(const concepts::Space<G>& spc);
116
124 getMesh(concepts::Mesh& msh, const uint points = 5);
125 };
126
127 // Extract the solution (depends on function fun), corresponding to
128 // the space and the solution vector and returns it.
129 template<class F, class G>
131 const concepts::Space<G>& spc, const concepts::Vector<F>& sol,
133
134 // Post processor (global)
135 concepts::GlobalPostprocess<G> postProcess(spc);
136
137 // output dimension for ex. n = 1 if fun = Value or n = 2 if fun = Grad
138 int functionOutputDimension;
139 if (fun)
140 functionOutputDimension = fun->n();
141 else
142 {
143 // We retrieve the default space dimension
144 functionOutputDimension = spc.getOutputDimension();
145 // We multiply by the components of the vector solution
146 if(std::is_same<F, concepts::Real2d>::value || std::is_same<F, concepts::Cmplx2d>::value)
147 functionOutputDimension *=2u;
148 if(std::is_same<F, concepts::Real3d>::value || std::is_same<F, concepts::Cmplx3d>::value)
149 functionOutputDimension *=3u;
150 }
151
152
153 // Calculate dimensions of the matrix
154 MatrixCounterCell counter;
155 postProcess(counter);
156
157 // Build solution vector Matrix
159 functionOutputDimension, counter.getDimensionsOfMatrices(0));
160
161 //declare cell postprocessor that extract the graphical solution vector
162 MatrixSolutionEvaluationCell<F, G> sec(functionValue, sol, fun, counter.getDim());
163
164 //store data
165 postProcess(sec);
166
167 return concepts::RCP<concepts::ElementMatrix<F> >(functionValue);
168 }
169
170 template<class G>
172 const concepts::Space<G>& spc) {
173
174 // Post processor (global)
175 concepts::GlobalPostprocess<G> postProcess(spc);
176
177 // Calculate dimensions of the matrix
178 MatrixCounterCell counter;
179
180 postProcess(counter);
181
182 DenseMatrixCollection<G> dmc(counter, true);
183
184 // Write informations in the matrices
185 MatrixSpaceOutputCell<G> mbdc(dmc, counter.getDim());
186 postProcess(mbdc);
187
188 return dmc;
189 }
190
191 // Extract the solution (depends on function fun), corresponding to
192 // the space and the solution vector and returns it.
193 template<class F, class G>
195 const concepts::Space<G>& spc, const concepts::ElementFormula<F, G>& frm) {
196
197 // Post processor (global)
198 concepts::GlobalPostprocess<G> postProcess(spc);
199
200 //output dimension for ex. n = 1 if fun = Value or n = 2 if fun = Grad
201 int functionOutputDimension = Size<F>::n();
202
203 //Calculate dimensions of the matrix
204 MatrixCounterCell counter;
205 postProcess(counter);
206
207 //Build solution vector Matrix
208 typedef typename concepts::Datatype<F>::type dataType;
209 concepts::ElementMatrix<dataType>* functionValue =
210 new concepts::ElementMatrix<dataType>(functionOutputDimension,
211 counter.getDimensionsOfMatrices(0));
212
213 // Write informations in the matrices
214 MatrixBaseElementFormulaCell<F, G> bdc(functionValue, counter.getDim(), frm);
215
216 //calculate size of the matrices / size of data
217 postProcess(bdc);
218
219 return concepts::makeRCP(functionValue);
220 }
221
222} // namespace graphics
223
224#endif // densematrixgraphics_hh_
virtual uint n() const =0
Number of components.
virtual uint getOutputDimension() const
Returns the default output dimension, when we consider plotting a real-valued operator on this space.
Definition space.hh:50
void createMatrix_(const std::string name, uint nrows, uint ncols)
Creates one dense matrix.
virtual ~DenseMatrixCollection()
Destructor: deltes the pointers in the mapping.
int dim_
The physical space dimension.
DenseMatrixCollection(MatrixCounterCell &counter, bool data=true)
Constructor: Creates a DenseMatrixCollection holding matrices for graphical output with graphics::Den...
void createMatrices_(MatrixCounterCell &counter)
Creates the matrices.
bool data_
Information which values are stored in the mapping.
concepts::RCP< concepts::ElementMatrix< typename concepts::Datatype< F >::type > > getFunction(const concepts::Space< G > &spc, const concepts::ElementFormula< F, G > &frm)
DenseMatrixCollection< Real > getMesh(concepts::Mesh &msh, const uint points=5)
virtual ~DenseMatrixGraphics()
Destructor.
concepts::RCP< concepts::ElementMatrix< F > > getSolution(const concepts::Space< G > &spc, const concepts::Vector< F > &sol, const concepts::ElementFunction< F, G > *fun=0)
DenseMatrixCollection< G > getSpace(const concepts::Space< G > &spc)
int getDimensionsOfMatrices(uint i)
returns the dimension og
double Real
Definition typedefs.hh:39
RCP< T > makeRCP(T *x)
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320