Class documentation of Concepts

Loading...
Searching...
No Matches
hpAdaptiveSpace.hh
Go to the documentation of this file.
1
9#ifndef hpAdaptSpace2D_hh
10#define hpAdaptSpace2D_hh
11
12#include "basics/exceptions.hh"
13#include "geometry/cell2D.hh"
14#include "geometry/mesh.hh"
16#include "geometry/cellConditions.hh"
17#include "space/hpMethod.hh"
18#include "space/space.hh"
19#include "hp2D/element.hh"
20#include "hp2D/spacePreBuilder.hh"
22
23namespace hp2D {
24
25 // ******************************************************* hpAdaptiveSpace **
26
32 template<class F>
35 public concepts::AdaptiveSpace<F, concepts::AdaptiveAdjustP<2> >,
36 public concepts::Subspace {
37 public:
39 typedef F t_type;
40
52 hpAdaptiveSpace(concepts::Mesh2& msh, uint l, uint p,
55
77 concepts::CellConditions* cc = 0, uint spcNo = 0,
78 uint* offset = 0, uint* idx = 0);
79
84 virtual ~hpAdaptiveSpace();
85
86 hpFull& prebuild() { return *prebuild_; }
87 hpFull& prebuild() const { return *prebuild_; }
88
89 const concepts::SubspaceHelper<F, SpacePreBuilder>& helper() const { return spc_; }
90
92 virtual uint& lastIdx() { return spc_.idx(); }
93 virtual const uint& lastIdx() const { return spc_.idx(); }
94 virtual uint offset() const { return offset_; }
95
96 inline virtual uint dim() const;
97 inline virtual uint nelm() const;
98 inline virtual Scan* scan() const;
99
100 inline uint dim();
101 inline uint nelm();
102 inline Scan* scan();
103
104 virtual void adjust(const concepts::Element<F>& elm,
106
113 void rebuild(bool sameIndices = false);
114
119 std::pair<bool, uint> available() const;
120
123 spc_.set_bc(bc);
124 }
125
126 const std::set<concepts::Cell2* > allCells() const{
127 return prebuild_->allCells();
128 }
129
133 virtual void recomputeShapefunctions() = 0;
134 protected:
135 virtual std::ostream& info(std::ostream& os) const;
138
143
145 uint nelm_;
146
151
156
158 uint idxVtx_, idxEdge_, idxInner_;
159
163 virtual Element<F>* newElement_(concepts::Cell2& cell, ushort* pMax,
165 concepts::TColumn<F>* T1) const = 0;
166
171 virtual concepts::TColumn<F>*
173 const concepts::TColumn<F>* T0,
174 const concepts::TColumn<F>* T1) = 0;
175
187
196
206 private:
208 bool ownPrebuild_;
210 uint dofBuild_;
212 uint build_;
218 std::unique_ptr<const BuildTColumnsBase<F> > buildVertexDofs_;
222 std::unique_ptr<const BuildTColumnsBase<F> > buildEdgeDofs_;
226 std::unique_ptr<const BuildTColumnsBase<F> > buildInnerDofs_;
228 bool notAvailable_;
229
230 void buildElements_(concepts::Cell2& cell, ushort* Pmax,
231 concepts::TColumn<F>* T0 = 0);
232
241 template<class G>
242 void setVtxPassive_(G& cntr, bool forChildren = false, bool always= false);
243
245 void setEdgePassive_(const concepts::Connector1& cntr);
246 };
247
248 template<class F>
250 if (!available().first)
252 return lastIdx() - offset();
253 }
254
255 template<class F>
257 if (!available().first)
259 return nelm_;
260 }
261
262 template<class F>
264 if (!available().first)
266 return new concepts::PListScan<Element<F> >(*elm_);
267 }
268
269 template<class F>
271 if (!available().first) rebuild();
272 return lastIdx() - offset();
273 }
274
275 template<class F>
277 if (!available().first) rebuild();
278 return nelm_;
279 }
280
281 template<class F>
282 typename hpAdaptiveSpace<F>::Scan* hpAdaptiveSpace<F>::scan() {
283 if (!available().first) rebuild();
284 return new concepts::PListScan<Element<F> >(*elm_);
285 }
286
287} // namespace hp2D
288
289#endif // hpAdaptSpace2D_hh
#define conceptsException(exc)
Two dimensional cell.
Definition cell.hh:89
Scanner of hp2D::Element.
Definition element.hh:69
void setBuildVertexDofs_(const BuildTColumnsBase< F > *b)
virtual void recomputeShapefunctions()=0
void set_bc(const concepts::BoundaryConditions *bc)
Reset boundary conditions to bc
void setBuildInnerDofs_(const BuildTColumnsBase< F > *b)
void rebuild(bool sameIndices=false)
hpFull *const prebuild_
Mesh and degrees of freedoms.
uint idxVtx_
Number of indices on entities, just for statistics.
virtual Element< F > * newElement_(concepts::Cell2 &cell, ushort *pMax, concepts::TColumn< F > *T0, concepts::TColumn< F > *T1) const =0
hpAdaptiveSpace(hpFull &prebuild, concepts::BoundaryConditions *bc=0, concepts::CellConditions *cc=0, uint spcNo=0, uint *offset=0, uint *idx=0)
virtual Scan * scan() const
Returns a scanner to iterate over the elements of the space.
std::pair< bool, uint > available() const
hpAdaptiveSpace(const hpAdaptiveSpace &spc)
virtual uint offset() const
Returns the offset.
virtual uint dim() const
Returns the dimension of the space.
virtual uint & lastIdx()
Returns last global index of the space.
hpAdaptiveSpace(concepts::Mesh2 &msh, uint l, uint p, concepts::BoundaryConditions *bc=0, concepts::CellConditions *cc=0)
concepts::SubspaceHelper< F, SpacePreBuilder > spc_
virtual uint nelm() const
Returns the number of elements in the space.
virtual void adjust(const concepts::Element< F > &elm, const concepts::AdaptiveAdjustP< 2 > &a)
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
uint nelm_
Number of elements currently active in the mesh.
virtual concepts::TColumn< F > * applySmatrices_(const concepts::Element< F > &elm, uint i, const concepts::TColumn< F > *T0, const concepts::TColumn< F > *T1)=0
void setBuildEdgeDofs_(const BuildTColumnsBase< F > *b)
std::set< concepts::Cell2 * > allCells() const
Returns set of all cells.