space.hh

Go to the documentation of this file.
1 
6 #ifndef hpSpace2Dedge_hh
7 #define hpSpace2Dedge_hh
8 
9 #include <memory>
10 #include <cstring>
11 #include <set>
12 #include "basics/exceptions.hh"
13 #include "basics/typedefs.hh"
14 #include "space/space.hh"
15 #include "space/hpMethod.hh"
17 #include "geometry/cell2D.hh"
18 #include "geometry/mesh.hh"
20 #include "toolbox/dynArray.hh"
22 #include "hp2D/element.hh"
23 #include "hp2D/space.hh"
24 
25 namespace concepts {
26 
27  // forward declarations
28  template<class F>
29  class SMatrixBase;
30 
31  class SMatrix1D;
32 
33  template<class F, int dim>
35 
36 } // namespace concepts
37 
38 namespace hp2Dedge {
39  using concepts::Real;
40 
41  // ***************************************************************** Space **
42 
50  class Space :
51  public concepts::SpaceOnCells<Real>,
52  public concepts::AdaptiveSpace<Real, concepts::AdaptiveAdjustP<2> > {
53  public:
55 
69  Space(concepts::Mesh2& msh, uint l, uint p,
70  concepts::BoundaryConditions* bc = 0, bool trunk = false);
71  virtual ~Space();
72 
73  // Override concepts::Space::getOutputDimension
74  virtual uint getOutputDimension() const{
75  return 2u;
76  }
77 
78  inline uint dim() const;
79  inline uint nelm() const;
81  inline Scan* scan() const;
84 
85  inline uint dim();
86  inline uint nelm();
88  inline Scan* scan();
91 
92  virtual void adjust(const concepts::Element<Real>& elm,
94 
96 
113  void rebuild();
118  protected:
119  virtual std::ostream& info(std::ostream& os) const;
120  private:
126  bool trunk_;
127 
132  bool rebuild_;
133 
135  uint dim_;
136 
138  uint nelm_;
139 
142 
148  std::unordered_map<uint, concepts::AdaptiveControlP<2> > ctrl2_;
149 
151  std::map<uint, concepts::CellData> cellList_;
153  std::map<uint, concepts::EdgeData> edgeList_;
154 
157  /* Linked list of cells, created for handling subdivision
158  in 4 quadrilaterials, which lie between the four children
159  and the father
160  */
162  /* list of edges, created for handling subdivision
163  in 4 quadrilaterials, which lie between the four children
164  and the father
165  */
166  std::set<uint> interEdges_;
167 
170 
172  std::unique_ptr<concepts::SMatrix1D>
174  // --> allgemein (mit hp2D) schreiben als C-Array oder Liste
175  // QuadEdgeFunctions kann hineinschreiben
176 
179  std::unique_ptr<concepts::SMatrixBase<Real> > Smatrices2H_X_[2];
180  std::unique_ptr<concepts::SMatrixBase<Real> > Smatrices2H_Y_[2];
181  std::unique_ptr<concepts::SMatrixBase<Real> > Smatrices2V_X_[2];
182  std::unique_ptr<concepts::SMatrixBase<Real> > Smatrices2V_Y_[2];
183 
187  std::unique_ptr<concepts::SMatrixBase<Real> > Smatrices2H_[2];
191  std::unique_ptr<concepts::SMatrixBase<Real> > Smatrices2V_[2];
195  std::unique_ptr<concepts::SMatrixBase<Real> > Smatrices4_[4];
196 
218 
224 
227  const concepts::CellData* father);
229  void createEdgList_(const concepts::Cell2& cell);
230 
245  void enrichElm_(const concepts::Quad2d& cell, int* p);
246 
257  const concepts::Connector1& edge);
258 
273  void buildTColumns_(const concepts::Quad& cntr, ushort* Pmax,
274  concepts::TColumn<Real>* T0 = 0);
275 
278  const concepts::Quad& cntr,
279  const uint* nn);
280 
283  const concepts::Quad& cntr,
284  const uint* nn);
285 
294 
299  void computePmax_(const concepts::Connector2& cntr, ushort Pmax[2]) const;
300 
307  void edgeOrientation_(const concepts::Connector2& cntr, const uint i,
308  uint& pIndex) const;
309 
319  void recomputeSmatrices_(const ushort* p, const uint* nn);
320 
323 
335 
338 
342  void status_();
344  };
345 
346  uint Space::dim() const {
348  return dim_;
349  }
350 
351  uint Space::nelm() const {
353  return nelm_;
354  }
355 
358  return new concepts::PListScan<hp2D::Element<Real> >(*elm_);
359  }
360 
364  }
365 
366  uint Space::dim() {
367  if (rebuild_) rebuild();
368  return dim_;
369  }
370 
371  uint Space::nelm() {
372  if (rebuild_) rebuild();
373  return nelm_;
374  }
375 
377  if (rebuild_) rebuild();
378  return new concepts::PListScan<hp2D::Element<Real> >(*elm_);
379  }
380 
382  if (rebuild_) rebuild();
384  }
385 
386 } // namespace hp2Dedge
387 
388 #endif // hpSpace2Dedge_hh
concepts::TColumn< Real > * buildEdge_(concepts::TColumn< Real > *T1, const concepts::Quad &cntr, const uint *nn)
Builds the T columns for the edge degrees of freedom.
A column of a T matrix.
Definition: analytical.hh:18
std::unordered_map< uint, concepts::AdaptiveControlP< 2 > > ctrl2_
Hash table of the control information for the 2D elements.
Definition: space.hh:148
uint nelm() const
Definition: space.hh:351
void status_()
Gives the cells and edges with given polynomial degree (for debugging)
std::unique_ptr< concepts::SMatrix1D > S1right_t_
Definition: space.hh:173
S matrix for elements in dimensions 2 and 3 with tensorized shape functions.
Definition: space.hh:34
A 2D cell: quadrilateral.
Definition: cell2D.hh:378
void minimumRule_(const concepts::Connector2 &cntr, const concepts::Connector1 &edge)
Used to enforce the minimum rule.
std::map< uint, concepts::EdgeData > edgeList_
List of edges.
Definition: space.hh:153
concepts::Mesh2 & msh_
Mesh.
Definition: space.hh:122
concepts::DynArray< concepts::AdaptiveAdjustP< 2 > > adj_
Hash table of the adjustment information of the elements.
Definition: space.hh:169
void deactivate_(concepts::Edge &edg)
#define conceptsException(exc)
Prepares an exception for throwing.
Definition: exceptions.hh:344
concepts::Joiner< hp2D::Element< Real > *, 1 > * elm_
Linked list of the elements.
Definition: space.hh:141
std::map< uint, concepts::CellData > cellList_
List of cells.
Definition: space.hh:151
A quadrilateral in the topology.
Definition: topology.hh:272
Container class: a dynamic array.
Definition: mesh.hh:30
void deactivate_(concepts::Vertex &vtx)
Stores additional information on a cell, namely its father.
uint dim_
Dimension of the FE space.
Definition: space.hh:135
Joiner class with multiple successors, i.e.
void enforceBC_(concepts::Quad2d &cell)
Enforce Dirichlet boundary conditions.
A cell in a mesh consist of topological information (neighbours, connectivity, orientation) and geome...
Definition: cell.hh:39
std::unique_ptr< concepts::SMatrixBase< Real > > Smatrices4_[4]
S matrices for subdivision into 4 quads.
Definition: space.hh:195
Scan * scan() const
scanner over the cells of the coarsest mesh
Definition: space.hh:356
void createCellList_(const concepts::Connector &cntr, const concepts::CellData *father)
Initially fills cellList_ (recursively)
std::unique_ptr< concepts::SMatrixBase< Real > > Smatrices2H_X_[2]
S matrices for tangential and normal component for different subdivisions.
Definition: space.hh:179
Space(concepts::Mesh2 &msh, uint l, uint p, concepts::BoundaryConditions *bc=0, bool trunk=false)
Constructor.
void edgeOrientation_(const concepts::Connector2 &cntr, const uint i, uint &pIndex) const
Helps distributing the polynomial degree to the edges.
bool rebuild_
If true: the elements have to be rebuilt.
Definition: space.hh:132
virtual ~Space()
void buildElements_(concepts::Quad2d &cell)
Creates the elements and their T matrices.
std::unique_ptr< concepts::SMatrix1D > S1left_n_
Definition: space.hh:173
std::unique_ptr< concepts::SMatrixBase< Real > > Smatrices2H_[2]
S matrices for horizontal subdivision.
Definition: space.hh:187
concepts::Scan< hp2D::Element< Real > > Scan
Definition: space.hh:54
concepts::BoundaryConditions * boundary()
Definition: space.hh:95
bool activeCell_(concepts::Cell &cell)
Checks if a cell is in active region.
concepts::DynArray< concepts::AdaptiveControlP< 1 > > ctrl1_
Hash table of the control information for the edges.
Definition: space.hh:146
uint nelm_
Number of elements currently active in the mesh.
Definition: space.hh:138
void nonactiveRegion_()
Set that cells in nonactive region to passive.
void meshAndPoly_(concepts::Quad2d &cell, concepts::Level< 2 > &L, int *P)
Adjusts the mesh and the polynomial degree.
void buildTColumns_(const concepts::Quad &cntr, ushort *Pmax, concepts::TColumn< Real > *T0=0)
Builds the T columns, stores them together with the neccessary polynomial degrees in a list T_.
A vertex in the topology.
Definition: topology.hh:40
A 2D element of the topology.
Definition: connector.hh:226
std::unique_ptr< concepts::SMatrixBase< Real > > Smatrices2V_X_[2]
Definition: space.hh:181
std::set< uint > interEdges_
Definition: space.hh:166
An abstract class for scanning a mesh (a set of cells) or a space (a set of elements).
concepts::DynArray< concepts::AdaptiveControl<> > ctrl0_
Hash table of the control information for the vertices.
Definition: space.hh:144
An abstract class for 2D meshes.
Definition: mesh.hh:103
Two dimensional cell.
Definition: cell.hh:89
void recomputeSmatrices_(const ushort *p, const uint *nn)
Checks if the S matrices need to be recomputed and does so if necessary.
virtual void adjust(const concepts::Element< Real > &elm, const concepts::AdaptiveAdjustP< 2 > &a)
std::unique_ptr< concepts::SMatrix1D > S1left_t_
S matrices in 1D.
Definition: space.hh:173
concepts::BoundaryConditions * bc_
Boundary conditions.
Definition: space.hh:124
Indicates that the space on which a function was called was not yet correctly built.
Definition: space.hh:36
bool trunk_
Build trunk space.
Definition: space.hh:126
void recomputeShapefunctions()
Recompute shape functions, e.g.
virtual std::ostream & info(std::ostream &os) const
void matlabstatus_()
Abstract class for a space.
Definition: space.hh:81
std::unique_ptr< concepts::SMatrixBase< Real > > Smatrices2V_[2]
S matrices for vertical subdivision.
Definition: space.hh:191
void enrichElm_(const concepts::Quad2d &cell, int *p)
Enriches the polynomial degrees.
A 1D element of the topology.
Definition: connector.hh:182
unsigned short ushort
Abbreviation for unsigned short.
Definition: typedefs.hh:48
virtual uint getOutputDimension() const
Definition: space.hh:74
std::unique_ptr< concepts::SMatrix1D > S1right_n_
Definition: space.hh:173
concepts::Scan< const concepts::Quad > * interScan() const
scanner over the intermediate cells
Definition: space.hh:361
std::unique_ptr< concepts::SMatrixBase< Real > > Smatrices2H_Y_[2]
Definition: space.hh:180
Abstract base class for an adaptive space.
Definition: space.hh:350
void computePmax_(const concepts::Connector2 &cntr, ushort Pmax[2]) const
Computes the maximal polynomial degree of cell in each direction.
An edge in the topology.
Definition: topology.hh:73
uint dim() const
Definition: space.hh:346
void createEdgList_(const concepts::Cell2 &cell)
Initially fills edgeList_.
std::unique_ptr< concepts::SMatrixBase< Real > > Smatrices2V_Y_[2]
Definition: space.hh:182
void rebuild()
Rebuilds the space.
concepts::TColumnSet< Real, 2 > T_
List of TColumns (for the member of the space cells)
Definition: space.hh:156
concepts::Joiner< const concepts::Quad *, 1 > * interCells_
Definition: space.hh:161
A 2D hp FEM space of edge elements with piecewise polynomial basis functions with two components,...
Definition: space.hh:52
An abstract class for elements of the topology.
Definition: connector.hh:85
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
concepts::TColumn< Real > * buildInterior_(concepts::TColumn< Real > *T1, const concepts::Quad &cntr, const uint *nn)
Builds the T columns for the interior degrees of freedom.
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
Scanner for a list of pointers.
hp 2D edge elements for electromagnetics.
Definition: bf_advection.hh:37
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich