Class documentation of Concepts

Loading...
Searching...
No Matches
space.hh
Go to the documentation of this file.
1
6#ifndef hpSpace2D_hh
7#define hpSpace2D_hh
8
9#include <memory>
10#include <cstring>
11#include <set>
12#include "basics/exceptions.hh"
13#include "basics/typedefs.hh"
15#include "toolbox/hashMap.hh"
17#include "geometry/cell2D.hh"
18#include "geometry/mesh.hh"
20#include "space/space.hh"
21#include "space/hpMethod.hh"
22#include "element.hh"
23
24namespace concepts {
25
26 // forward declarations
27 template<class F>
28 class SMatrixBase;
29
30 class SMatrix1D;
31
32// // ****************************************************************** Scan **
33
34// template<>
35// class Scan<hp2D::Element<Real> > :
36// public concepts::Scan<concepts::Element<Real> >
37// {
38// public:
39// hp2D::Element<Real>& operator++(int) = 0;
40// };
41
42} // namespace concepts
43
44namespace hp2D {
45 using concepts::Real;
46
47 // forward declarations
48 template<class F>
49 class Quad;
50
51 class BuildDofsBase;
52
53 // ****************************************************** IndexNotExisting **
54
60
61 // ***************************************************************** Space **
62
85 class Space :
86 public concepts::SpaceOnCells<Real>,
87 public concepts::AdaptiveSpace<Real, concepts::AdaptiveAdjustP<2> >
88 {
89 public:
90 friend class BuildDofsBase;
91
93
104 Space(concepts::Mesh2& msh, uint l, uint p,
109 Space(const Space& spc);
110 virtual ~Space();
111
112 inline virtual uint dim() const;
113 inline virtual uint nelm() const;
114 inline virtual Scan* scan() const;
119 inline Scan* constScan() const;
120
121 inline uint dim();
122 inline uint nelm();
123 inline Scan* scan();
124
125 virtual void adjust(const concepts::Element<Real>& elm,
127
146
158
167
177
179 uint connectedIdx(const concepts::Attribute& a) const;
180
185 protected:
186 virtual std::ostream& info(std::ostream& os) const;
187 private:
189 concepts::Mesh2& msh_;
192
197 bool rebuild_;
198
200 uint dim_;
201
203 uint nelm_;
204
207
209 std::unordered_map<uint, concepts::AdaptiveControl<> > ctrl0_;
211 std::unique_ptr<std::unordered_map< uint, concepts::AdaptiveControlP<1> > > ctrl1_;
213 std::unordered_map<uint, concepts::AdaptiveControlP<2> > ctrl2_;
214
216 std::unordered_map<uint, concepts::AdaptiveControl<> > ctrlc0_;
217
219 std::unordered_map<uint, const concepts::Attribute*> vtxConnect_;
220
222 std::map<uint, concepts::CellData> cellList_;
224 std::map<uint, concepts::EdgeData> edgeList_;
226 std::map<uint, concepts::VertexData> vertexList_;
227
228 /* Linked list of ghost cells, created for handling subdivision
229 in 4 quadrilaterials
230 */
231 // concepts::Joiner<concepts::Quad*, 1>* ghostCells_;
232
234 std::unordered_map<uint, concepts::AdaptiveAdjustP<2> > adj_;
235
237 std::unique_ptr<concepts::SMatrix1D> S1left_, S1right_;
241 std::unique_ptr<concepts::SMatrixBase<Real> > Smatrices2H_[2];
245 std::unique_ptr<concepts::SMatrixBase<Real> > Smatrices2V_[2];
249 std::unique_ptr<concepts::SMatrixBase<Real> > Smatrices4_[4];
250
254 std::unique_ptr<BuildDofsBase> buildVertexDofs_;
258 std::unique_ptr<BuildDofsBase> buildEdgeDofs_;
262 std::unique_ptr<BuildDofsBase> buildInnerDofs_;
263
264 private:
285 void meshAndPoly_(concepts::Quad2d& cell, concepts::Level<2>& L, int* P);
286
291 void enforceBC_(const concepts::Connector2& cell);
292
294 void createCellList_(const concepts::Connector& cntr,
295 const concepts::CellData* father);
297 void createVtxEdgList_(const concepts::Connector2& cell);
298
313 void enrichElm_(const concepts::Quad2d& cell, int* p);
314
324 void minimumRule_(const concepts::Connector2& cntr,
325 const concepts::Connector1& edge);
326
340 void buildElements_(concepts::Quad2d& cell, ushort* Pmax,
342
343 void buildEmptyElements_(concepts::Quad2d& cell);
344
349 void computePmax_(const concepts::Connector2& cntr,
350 ushort Pmax[2]) const;
351
358 void recomputeSmatrices_(const Quad<Real>& elm);
359
360 void deactivate_(const concepts::Edge& edg);
361 void deactivate_(const concepts::Vertex& vtx);
362
376 bool activeCell_(concepts::Cell& cell);
380 void status_();
381 void matlabstatus_();
382
383
390 Space(const Space& spc, uint i);
391 };
392
393 uint Space::dim() const {
394 if (rebuild_) throw conceptsException(concepts::SpaceNotBuilt());
395 return dim_;
396 }
397
398 uint Space::nelm() const {
399 if (rebuild_) throw conceptsException(concepts::SpaceNotBuilt());
400 return nelm_;
401 }
402
404 if (rebuild_) throw conceptsException(concepts::SpaceNotBuilt());
405 return new concepts::PListScan<Element<Real> >(*elm_);
406 }
407
409 return new concepts::PListScan<Element<Real> >(*elm_);
410 }
411
412 uint Space::dim() {
413 if (rebuild_) rebuild();
414 return dim_;
415 }
416
417 uint Space::nelm() {
418 if (rebuild_) rebuild();
419 return nelm_;
420 }
421
422 Space::Scan* Space::scan() {
423 if (rebuild_) rebuild();
424 return new concepts::PListScan<Element<Real> >(*elm_);
425 }
426
427} // namespace hp2D
428
429#include "buildDofsBase.hh"
430
431#endif // hpSpace2D_h
#define conceptsException(exc)
void recomputeShapefunctions()
virtual uint dim() const
Returns the dimension of the space.
Definition space.hh:393
Space(const Space &spc)
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
void buildEdgeDofs(const BuildDofsBase &b)
Space rebuild()
void buildVertexDofs(const BuildDofsBase &b)
void buildInnerDofs(const BuildDofsBase &b)
virtual uint nelm() const
Returns the number of elements in the space.
Definition space.hh:398
Scan * constScan() const
Definition space.hh:408
virtual Scan * scan() const
Returns a scanner to iterate over the elements of the space.
Definition space.hh:403
Space(concepts::Mesh2 &msh, uint l, uint p, concepts::BoundaryConditions *bc=0)
uint connectedIdx(const concepts::Attribute &a) const
Gives the number of connected dofs for one attribute.
double Real
Definition typedefs.hh:39