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"
17 #include "space/hpMethod.hh"
18 #include "space/space.hh"
19 #include "hp2D/element.hh"
20 #include "hp2D/spacePreBuilder.hh"
22 
23 namespace hp2D {
24 
25  // ******************************************************* hpAdaptiveSpace **
26 
32  template<class F>
33  class hpAdaptiveSpace :
34  public concepts::SpaceOnCoarseCells<2, 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,
54  concepts::CellConditions* cc = 0);
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 
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 
150  uint offset_;
151 
155  bool zeroDim_;
156 
159 
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:
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_;
229 
231  concepts::TColumn<F>* T0 = 0);
232 
241  template<class G>
242  void setVtxPassive_(G& cntr, bool forChildren = false, bool always= false);
243 
246  };
247 
248  template<class F>
249  uint hpAdaptiveSpace<F>::dim() const {
250  if (!available().first)
252  return lastIdx();
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();
273  }
274 
275  template<class F>
277  if (!available().first) rebuild();
278  return nelm_;
279  }
280 
281  template<class F>
283  if (!available().first) rebuild();
284  return new concepts::PListScan<Element<F> >(*elm_);
285  }
286 
287 } // namespace hp2D
288 
289 #endif // hpAdaptSpace2D_hh
A column of a T matrix.
Definition: analytical.hh:18
virtual std::ostream & info(std::ostream &os) const
An abstract class for an element of a space.
Definition: exceptions.hh:15
uint offset_
Initially given offset, holden for control, if in there are changes in the previous subspace.
concepts::SubspaceHelper< F, SpacePreBuilder > spc_
Helper class for building elements with space pre builder, boundary conditions and index.
virtual ~hpAdaptiveSpace()
hpAdaptiveSpace(const hpAdaptiveSpace &spc)
Copy constructor.
std::set< concepts::Cell2 * > allCells() const
Returns set of all cells.
#define conceptsException(exc)
Prepares an exception for throwing.
Definition: exceptions.hh:344
uint nelm_
Number of elements currently active in the mesh.
Joiner class with multiple successors, i.e.
std::unique_ptr< const BuildTColumnsBase< F > > buildVertexDofs_
Strategy to build the vertex degrees of freedom.
virtual uint & lastIdx()
Returns last global index of the space.
concepts::Joiner< Element< F > *, 1 > * elm_
Linked list of the elements.
bool ownPrebuild_
If prebuild object is created here and not given.
virtual Element< F > * newElement_(concepts::Cell2 &cell, ushort *pMax, concepts::TColumn< F > *T0, concepts::TColumn< F > *T1) const =0
Creates and returns an element for cell.
Helper class for building 2D hp-FEM spaces (space pre builder).
virtual uint offset() const
Returns the offset.
void setEdgePassive_(const concepts::Connector1 &cntr)
Set this edge and all children edges passive.
uint idxVtx_
Number of indices on entities, just for statistics.
hp-adaptive space with 2D elements.
uint build_
Number of the build.
2D hp-FEM for H1-conforming elements.
bool zeroDim_
Control, if dimension at last build is zero.
Class for holding an offset of global indices of space.
Definition: space.hh:386
const concepts::SubspaceHelper< F, SpacePreBuilder > & helper() const
void setBuildEdgeDofs_(const BuildTColumnsBase< F > *b)
Change the strategy how the degrees of freedom for the edge are built.
Base class for classes for building T columns for elements in a space with help of a 2D space pre bui...
hpAdaptiveSpace(hpFull &prebuild, concepts::BoundaryConditions *bc=0, concepts::CellConditions *cc=0, uint spcNo=0, uint *offset=0, uint *idx=0)
Constructor for using same mesh and distribution of degrees of freedom object as another space.
concepts::SubspaceHelper< F, SpacePreBuilder > & helper()
hpAdaptiveSpace(concepts::Mesh2 &msh, uint l, uint p, concepts::BoundaryConditions *bc=0, concepts::CellConditions *cc=0)
Constructor.
void rebuild(bool sameIndices=false)
Rebuilds the mesh and the elements due to adjustment orders.
Interface class for SpacesOnCells that also allow for allCells(), that i.e.
Definition: space.hh:127
virtual concepts::TColumn< F > * applySmatrices_(const concepts::Element< F > &elm, uint i, const concepts::TColumn< F > *T0, const concepts::TColumn< F > *T1)=0
Apply i -th S matrix to T-Columns T0 and T1 of cell, where i is the number of child of cell.
An abstract class for scanning a mesh (a set of cells) or a space (a set of elements).
Abstract class for a 2D FEM element.
Definition: element.hh:28
An abstract class for 2D meshes.
Definition: mesh.hh:103
Two dimensional cell.
Definition: cell.hh:89
std::pair< bool, uint > available() const
Returns 0 if the space has to be rebuilt with rebuild(), otherwise the number of the build.
std::unique_ptr< const BuildTColumnsBase< F > > buildEdgeDofs_
Strategy to build the edge degrees of freedom.
Scanner of hp2D::Element.
Definition: element.hh:69
uint dofBuild_
Number of the build of prebuild_ at last call of rebuild()
Indicates that the space on which a function was called was not yet correctly built.
Definition: space.hh:36
virtual Scan * scan() const
Returns a scanner to iterate over the elements of the space.
virtual void recomputeShapefunctions()=0
Recompute shape functions, e.g.
hpFull *const prebuild_
Mesh and degrees of freedoms.
const std::set< concepts::Cell2 * > allCells() const
void setBuildInnerDofs_(const BuildTColumnsBase< F > *b)
Change the strategy how the degrees of freedom for the interior are built.
A 1D element of the topology.
Definition: connector.hh:182
unsigned short ushort
Abbreviation for unsigned short.
Definition: typedefs.hh:48
virtual uint nelm() const
Returns the number of elements in the space.
concepts::Scan< hp2D::Element< F > > Scan
bool notAvailable_
Flag indicating some reasons the space is not available.
Abstract base class for an adaptive space.
Definition: space.hh:350
std::unique_ptr< const BuildTColumnsBase< F > > buildInnerDofs_
Strategy to build the inner degrees of freedom.
virtual const uint & lastIdx() const
virtual void adjust(const concepts::Element< F > &elm, const concepts::AdaptiveAdjustP< 2 > &a)
Adjusts the space in the next rebuild step for this element.
hpFull & prebuild() const
virtual uint dim() const
Returns the dimension of the space.
void setVtxPassive_(G &cntr, bool forChildren=false, bool always=false)
Set vertices passive.
void buildElements_(concepts::Cell2 &cell, ushort *Pmax, concepts::TColumn< F > *T0=0)
If prebuild object is created here and not given.
void setBuildVertexDofs_(const BuildTColumnsBase< F > *b)
Change the strategy how the degrees of freedom for the vertices are built.
void set_bc(const concepts::BoundaryConditions *bc)
Reset boundary conditions to bc
Scanner for a list of pointers.
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich