Class documentation of Concepts

Loading...
Searching...
No Matches
dataDX.hh
Go to the documentation of this file.
1
6#ifndef dataDX_hh
7#define dataDX_hh
8#include <forward_list>
9#include <fstream>
10#include <memory>
11#include "space/postProcess.hh"
12#include "space/element.hh"
13#include "space/formula.hh"
14#include "function/basis.hh"
15#include "spaceTraits.hh"
16
17namespace concepts {
18 // forward declaration
19 template<class F>
20 class Vector;
21
22 template<class F>
23 class Formula;
24
25 template<class F, class G>
26 class ElementFormula;
27}
28
29namespace graphics {
30
31 using concepts::Real;
32
33 // forward declartions
34 class VertexList;
35
36 // ********************************************************** Space traits **
37
43 template<typename T, typename traits = spaceTraits<T> >
44 struct spcPosCon {
45 static inline uint positionConnection() {
46 return traits::positionConnection();
47 }
48 static inline uint boundary() {
49 return traits::boundaryElements();
50 }
51 };
52
66 template<typename T>
67 bool spacePosCon(const T& spc) { return spcPosCon<T>::positionConnection(); }
68
83 template<typename T>
84 bool spaceBoundary(const T& spc) { return spcPosCon<T>::boundary(); }
85
86 // **************************************************************** DataDX **
87
118 template<class F>
119 class DataDX {
120 public:
128 DataDX(concepts::Space<F>& spc, const std::string filename,
129 bool pc = false, bool boundary = false, const uint dim = 2);
131 DataDX(const DataDX<F>& dx);
132 ~DataDX();
133
136
141 void operator()(const concepts::Vector<Real>& solution,
142 const std::string& name);
147 void operator()(const concepts::Formula<Real>& frm, const std::string& name);
153 const std::string& name);
154 private:
156 concepts::Space<F>* spc_;
157
159 std::string filename_;
160
163
165 uint countp_;
166
168 uint countq_;
169
171 bool pc_;
172
174 std::forward_list<std::string> names_;
175
177 std::unique_ptr<VertexList> vtxList_;
178 };
179
186 template<typename T>
187 DataDX<Real> drawDataDX(T& spc, const std::string filename,
188 const uint dim = 2) {
189 return DataDX<Real>(spc, filename, spacePosCon(spc),
190 spaceBoundary(spc), dim);
191 }
192
193 // ********************************************************** DataDXCounts **
194
209
210 public:
220
222 void add(uint a) { counts_ += a; }
223
225 uint counts() const;
226
227 virtual void operator() (const concepts::Element<Real>& elm);
228 virtual void operator() (const concepts::Cell&) {}
229 private:
231 uint counts_;
232
234 VertexList* vtxList_;
235 };
236
237 // ***************************************************** DataDXCoordinates **
238
252
253 public:
264 DataDXCoordinates(std::ostream& os, const uint count,
265 VertexList* vtxList = 0, const uint dim = 2);
266 virtual ~DataDXCoordinates();
267
269 void add(uint a) { counts_ += a; }
270
272 void inc() { cntCoords_++; }
273
277 uint counts() const;
278
279 virtual void operator() (const concepts::Element<Real>& elm);
280 virtual void operator() (const concepts::Cell&) {}
281
283 void write(const float x) const;
284 private:
286 std::ostream& os_;
287
289 VertexList* vtxList_;
290
292 const uint dim_;
293
295 uint counts_;
296
298 uint cntCoords_;
299 };
300
301 // ***************************************************** DataDXConnections **
302
317
318 public:
326 DataDXConnections(std::ostream& os, const uint count,
327 VertexList* vtxList = 0, const uint dim = 2);
328 virtual ~DataDXConnections();
329 virtual void operator() (const concepts::Element<Real>& elm);
330 virtual void operator() (const concepts::Cell&) {}
331
333 void add(uint a) { counts_ += a; }
334
338 uint counts() const { return counts_; }
339
341 void write(const int x) const;
342 private:
344 std::ostream& os_;
345
347 uint counts_;
348
350 const uint dim_;
351 };
352
353 // ************************************************************ DataDXData **
354
368
369 public:
378 DataDXData(std::ostream& os, const concepts::Vector<Real>& solution,
379 const uint count, const std::string& name,
380 VertexList* vtxList = 0);
381
389 DataDXData(std::ostream& os, const concepts::Formula<Real>& frm,
390 const uint count, const std::string& name,
391 VertexList* vtxList = 0);
392
400 DataDXData(std::ostream& os, const concepts::ElementFormula<Real>& frm,
401 const uint count, const std::string& name,
402 VertexList* vtxList = 0);
403
404 virtual ~DataDXData();
405 virtual void operator() (const concepts::Element<Real>& elm);
406 virtual void operator() (const concepts::Cell&) {}
407
408 const concepts::Formula<Real>* formula() const { return frm_.get(); }
409 const concepts::Array<Real>& coeff() const { return coeff_; }
410 const concepts::ElementFormula<Real>* elementFormula() const
411 { return efrm_; }
412
414 void write(const float x) const;
415 private:
417 std::ostream& os_;
418
420 const concepts::Vector<Real>* solution_;
421
423 std::unique_ptr<const concepts::Formula<Real> > frm_;
424
427
430
432 concepts::Array<Real> shpfnc_;
433
435 concepts::Array<Real> vertexSol_;
436
438 std::string name_;
439
441 uint pc_;
442
444 VertexList* vtxList_;
445
447 concepts::Array<Real> vtxData_;
448 };
449
450} // namespace graphics
451
452#endif // dataDX_hh
DataDXConnections(std::ostream &os, const uint count, VertexList *vtxList=0, const uint dim=2)
void add(uint a)
Increments the counter for the quads or cubes by a.
Definition dataDX.hh:333
void write(const int x) const
Writes integer in binary format to the output stream.
void write(const float x) const
Writes a float in binary format to the output stream.
void inc()
Increments cntCoords_ by 1.
Definition dataDX.hh:272
DataDXCoordinates(std::ostream &os, const uint count, VertexList *vtxList=0, const uint dim=2)
void add(uint a)
Increments the counter for the quads or cubes by a.
Definition dataDX.hh:269
DataDXCounts(VertexList *vtxList=0)
uint counts() const
Returns the number of points.
void add(uint a)
Increments the counter for the points by a.
Definition dataDX.hh:222
DataDXData(std::ostream &os, const concepts::ElementFormula< Real > &frm, const uint count, const std::string &name, VertexList *vtxList=0)
DataDXData(std::ostream &os, const concepts::Vector< Real > &solution, const uint count, const std::string &name, VertexList *vtxList=0)
DataDXData(std::ostream &os, const concepts::Formula< Real > &frm, const uint count, const std::string &name, VertexList *vtxList=0)
void write(const float x) const
Writes a float in binary format to the output stream.
void operator()(const concepts::Formula< Real > &frm, const std::string &name)
DataDX(concepts::Space< F > &spc, const std::string filename, bool pc=false, bool boundary=false, const uint dim=2)
DataDX(const DataDX< F > &dx)
Copy constructor.
DataDX< F > & operator=(const DataDX< F > &dx)
Assignement operator.
void operator()(const concepts::ElementFormula< F > &frm, const std::string &name)
void operator()(const concepts::Vector< Real > &solution, const std::string &name)
double Real
Definition typedefs.hh:39
DataDX< Real > drawDataDX(T &spc, const std::string filename, const uint dim=2)
Definition dataDX.hh:187
bool spacePosCon(const T &spc)
Definition dataDX.hh:67
bool spaceBoundary(const T &spc)
Definition dataDX.hh:84