Class documentation of Concepts

Loading...
Searching...
No Matches
spacePreBuilder.hh
1/* space pre builder classes for 2D spaces
2*/
3
4#ifndef hpSpacePreBuilder2D_hh
5#define hpSpacePreBuilder2D_hh
6
7#include <set>
8#include <queue>
10#include "geometry/cell2D.hh"
12#include "space/space.hh"
13#include "space/hpMethod.hh" // for AdaptiveControlP
14#include "toolbox/stiffArray.hh"
15#include "toolbox/multiArray.hh"
16#include "toolbox/hashMap.hh"
17#include "toolbox/sequence.hh"
18#include "toolbox/set.hh"
19#include "hp2D/edgeMinMax.hh"
20
21// If flag is set to 1, edgelist_ and vertexlist_ collect keys, not
22// local indices. That is easier to debug, but lightly slower.
23#define KeyLists 1
24
25namespace hp2D {
26
27 // *********************************************************** NotValidDof **
28
33 // class NotValidDof : public concepts::ExceptionBase {};
34
35 // ******************************************************* SpacePreBuilder **
36
38 public:
42 virtual ~SpacePreBuilder() {}
43
45 virtual concepts::Mesh2& mesh() const { return msh_; }
48 virtual bool vtxDof(const concepts::Connector2& cntr, uint i) const = 0;
53 virtual ushort edgeDof(const concepts::Connector2& cntr, uint i) const = 0;
58 virtual const ushort* innerDof(const concepts::Connector2& cntr) const = 0;
66 virtual const ushort* pMax(const concepts::Connector2& cntr,
67 ushort* p = 0) const = 0;
72 virtual ushort edgeP(const concepts::Connector2& cntr, uint i) const = 0;
73
74 //not necessary declaration, but usefull for pyplusplus
76 setIndex(uint& firstIdx, uint noIdx, uint dim,
77 const concepts::Connector& cntr, uint i = 0,
78 uint spcNo = 0) = 0;
79
80 //not necessary declaration, but usefull for pyplusplus
82 (uint dim, const concepts::Connector& cntr, uint spcNo = 0) const = 0;
83
84 protected:
87 };
88
91
92 // *********************************************************** DegreeDim **
93
102 template<typename F>
103 struct DegreeDim {};
104
105 template<>
106 struct DegreeDim<concepts::Quad> { static const ushort dim = 2; };
107
108 template<>
109 struct DegreeDim<concepts::InfiniteQuad> { static const ushort dim = 2; };
110
111 template<>
112 struct DegreeDim<concepts::Triangle> { static const ushort dim = 1; };
113
114
115 // **************************************************************** hpFull **
116
167 class hpFull : public SpacePreBuilder, public Adaptivity {
168 public:
170 hpFull(concepts::Mesh2& msh, uint l = 0, uint p = 1, bool build = false);
175 hpFull(const hpFull& preBuild);
177 virtual ~hpFull() {}
178
179 void setPolyEdgeRule(const PolyEdgeRule& rule);
180
184 virtual void adjust(const concepts::Connector& cell,
190 void adjust(const uint nrCell, const concepts::AdaptiveAdjustP<2>& a);
196
203 uint available() const { return rebuild_ ? 0 : build_; }
207 virtual void rebuildMesh();
211 virtual void rebuildDof();
214 virtual bool vtxDof(const concepts::Connector2& cntr, uint i) const;
219 virtual ushort edgeDof(const concepts::Connector2& cntr, uint i) const;
225 virtual const ushort* innerDof(const concepts::Connector2& cntr) const;
235 virtual const ushort* pMax(const concepts::Connector2& cntr,
236 ushort* p = 0) const;
241 virtual ushort edgeP(const concepts::Connector2& cntr, uint i) const;
251 const concepts::Connector2& cntr,
252 uint i = 0, uint spcNo = 0) const;
265 virtual concepts::IndexRange&
266 setIndex(uint& firstIdx, uint noIdx, uint dim,
267 const concepts::Connector& cntr, uint i = 0,
268 uint spcNo = 0);
269
277 (uint dim, const concepts::Connector& cntr, uint spcNo = 0) const;
278
293 virtual void setP(uint p, const concepts::Set<uint>& donts);
294
298 void clearAllIndices(uint spcNo = 0);
299
301 uint ncells() { return cells_.size(); }
302
304 bool isHangEdge(const concepts::Connector1& cntr) const;
308 void storeMatlab(const std::string name);
309
311 concepts::Set<concepts::Cell2*> cells() const { return cells_; }
313 std::set<concepts::Cell2*> allCells() const { return allCells_; }
314 protected:
315 virtual std::ostream& info(std::ostream& os) const;
316 private:
320 bool rebuild_;
322 uint build_;
324 std::unique_ptr<const PolyEdgeRule> polyEdgeRule_;
325
328
329 // mapping from space number to an index range
330 typedef std::map<uint, concepts::IndexRange> IndexType;
331 // index range per space number for all 'member of space' vertices dof
333 // index range per space number for all 'member of space' edge dof
335 // index range per space number for all inner dof
337
344
358
362 std::set<concepts::Cell2*> allCells_;
372 concepts::Set<uint> hangEdges_;
373
375 bool isMember_(const concepts::Connector2& cntr) const;
377 bool isMember_(const concepts::Connector1& cntr) const;
378
382 const ushort* pMinInner_(const concepts::Quad& quad);
383
387 void refine_(concepts::Quad2d& cell, concepts::Level<2> L, short* P,
389 void refine_(concepts::InfiniteQuad2d& cell, concepts::Level<2> L,
394 void refine_(concepts::Cell2& cell, ushort* P,
396
401 void memberEdges_(const concepts::Connector2& cntr,
402 std::set<const concepts::Connector1*>& edges);
403
408 ushort takeOutchildrenEdges_
409 (const concepts::Connector1& edge, const concepts::Connector1& cntr1,
410 std::set<const concepts::Connector1*>& edges,
411 std::set<const concepts::Connector0*>& vertices);
412
414 template<class F>
415 bool getEdgeSupport_(F cntr);
416
417 class Cause : public std::pair<const concepts::Connector2*,
418 const concepts::Connector1*>,
420 {
421 public:
422 Cause(const concepts::Connector2* cell,
423 const concepts::Connector1* edge) :
424 std::pair<const concepts::Connector2*,
425 const concepts::Connector1*>(cell, edge) {}
426 protected:
427 virtual std::ostream& info(std::ostream& os) const {
428 return os << concepts::typeOf(*this)<<"(causing cell = " << *this->first
429 << ", appropiate edge = " << *this->second << ")";
430 }
431 };
432
436 template<class F>
437 bool getPretendedVertexSupport_
438 (F cntr,
439 concepts::HashMap<std::queue<Cause> >& nonLocal);
440
442 void getRootCells_
443 (const concepts::Connector2& cntr, const std::set<uint>& vertices,
444 std::map<uint, concepts::Sequence<const concepts::Connector2*> >& rootCells);
445
450 void getNonLocalVertexSupport_
451 (concepts::HashMap<std::queue<Cause> >& nonLocal,
453 rootCells);
454
468 void getEdgeMappings_
469 (uint key, uint cKey,
472 std::map<uint,
474 std::map<uint, const concepts::Connector1*>& fatherEdges,
475 std::map<uint, uint>& mosEdges) const;
476
483 bool eliminateNonCauses_(std::queue<Cause>& causes);
484
485 void dependentEdges_(const concepts::Quad& quad);
486 void polyDependentEdges_(const concepts::Quad& quad,
487 const concepts::Edge& edge,
488 const concepts::Edge& oppEdge, const uint p);
489
490 ushort* pMax_(const concepts::Quad& cntr) const;
491 ushort* pMax_(const concepts::InfiniteQuad& cntr) const;
492
493 void setPmax_(const concepts::Connector2& cntr, ushort* Pmax);
494
498 void polyHangingEdges_(const concepts::Connector1& edge, const uint& p);
499
505 template<class F>
506 void findControl_(F*& ctrl, const concepts::Connector2& cntr, uint i);
507
515 IndexType& findIndex_(uint dim, const concepts::Connector2& cntr,
516 uint i);
517 const IndexType& findIndex_(uint dim, const concepts::Connector2& cntr,
518 uint i) const;
519 };
520
521} // namespace hp2D
522
523#endif // hpSpacePreBuilder2D_hh
Two dimensional cell.
Definition cell.hh:89
virtual ushort edgeP(const concepts::Connector2 &cntr, uint i) const =0
virtual const ushort * pMax(const concepts::Connector2 &cntr, ushort *p=0) const =0
virtual ~SpacePreBuilder()
Destructor.
virtual concepts::Mesh2 & mesh() const
Returns mesh.
virtual const ushort * innerDof(const concepts::Connector2 &cntr) const =0
concepts::Mesh2 & msh_
Mesh.
virtual concepts::Set< concepts::IndexRange > indices(uint dim, const concepts::Connector &cntr, uint spcNo=0) const =0
SpacePreBuilder(concepts::Mesh2 &msh)
Constructor.
virtual ushort edgeDof(const concepts::Connector2 &cntr, uint i) const =0
virtual concepts::IndexRange & setIndex(uint &firstIdx, uint noIdx, uint dim, const concepts::Connector &cntr, uint i=0, uint spcNo=0)=0
virtual bool vtxDof(const concepts::Connector2 &cntr, uint i) const =0
uint ncells()
Number of cells on the finest level.
virtual void setP(uint p, const concepts::Set< uint > &donts)
void adjust(const uint nrCell, const concepts::AdaptiveAdjustP< 2 > &a)
concepts::Set< concepts::Cell2 * > cells() const
Returns set of 'member of space' cells.
virtual const ushort * innerDof(const concepts::Connector2 &cntr) const
virtual ~hpFull()
Destructor.
hpFull(const hpFull &preBuild)
hpFull(concepts::Mesh2 &msh, uint l=0, uint p=1, bool build=false)
Constructor.
virtual const ushort * pMax(const concepts::Connector2 &cntr, ushort *p=0) const
virtual void rebuildMesh()
void adjust(const concepts::AdaptiveAdjustP< 2 > &a)
virtual ushort edgeDof(const concepts::Connector2 &cntr, uint i) const
void storeMatlab(const std::string name)
bool isHangEdge(const concepts::Connector1 &cntr) const
Returns true, if edge is hanging.
virtual bool vtxDof(const concepts::Connector2 &cntr, uint i) const
std::set< concepts::Cell2 * > allCells() const
Returns set of all cells.
virtual ushort edgeP(const concepts::Connector2 &cntr, uint i) const
virtual concepts::IndexRange & setIndex(uint &firstIdx, uint noIdx, uint dim, const concepts::Connector &cntr, uint i=0, uint spcNo=0)
const concepts::IndexRange & index(uint dim, const concepts::Connector2 &cntr, uint i=0, uint spcNo=0) const
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
uint available() const
void clearAllIndices(uint spcNo=0)
virtual concepts::Set< concepts::IndexRange > indices(uint dim, const concepts::Connector &cntr, uint spcNo=0) const
virtual void adjust(const concepts::Connector &cell, const concepts::AdaptiveAdjustP< 2 > &a)
virtual void rebuildDof()
std::string typeOf(const T &t)
Definition output.hh:43
unsigned short ushort
Abbreviation for unsigned short.
Definition typedefs.hh:51