space.hh

Go to the documentation of this file.
1 
6 #ifndef hpSpace3D_hh
7 #define hpSpace3D_hh
8 
9 #include <memory>
10 #include <map>
11 #include <cstring>
12 #include "basics/exceptions.hh"
13 #include "basics/typedefs.hh"
14 #include "basics/level.hh"
15 #include "toolbox/hashMap.hh"
16 #include "space/space.hh"
17 #include "space/hpMethod.hh"
18 #include "space/smatrix.hh"
20 #include "geometry/cell3D.hh"
21 #include "geometry/mesh.hh"
25 #include "element.hh"
26 
27 namespace concepts {
28 
29  // forward declaration
30  class InOutParameters;
31 
32  // ****************************************************************** Scan **
33 
34  template<>
35  class Scan<hp3D::Element<Real> > :
36  public concepts::Scan<concepts::ElementWithCell<Real> > {
37  public:
39  };
40 
41 } // namespace concepts
42 
43 namespace hp3D {
44  using concepts::Real;
45 
46  // forward declarations
47  class Hexahedron;
48  class BuildDofsBase;
49  class TraceSpace;
50 
51  // ***************************************************************** Space **
52 
82  class Space :
83  public concepts::SpaceOnCells<Real>,
84  public concepts::AdaptiveSpace<Real, concepts::AdaptiveAdjustP<3> > {
85  friend class BuildDofsBase;
86  public:
89 
101  Space(concepts::Mesh3& msh, uint l, uint p,
104  Space(const Space& spc);
105  virtual ~Space();
106 
107  inline virtual uint dim() const;
108  inline virtual uint nelm() const;
109  inline virtual Scan* scan() const;
110  inline virtual const concepts::BoundaryConditions* bc() const;
111 
112  inline uint dim();
113  inline uint nelm();
114  inline Scan* scan();
115  inline const concepts::BoundaryConditions* bc();
116 
117 
118  inline void getPmax(const concepts::Hexahedron& cntr,
119  ushort Pmax[3]) const{
120  getPmax_(cntr,Pmax);
121  }
122 
123 
124  void setDim(uint dim);
125 
126  virtual void adjust(const concepts::Element<Real>& elm,
128 
167 
169  const std::unique_ptr<concepts::SMatrixBase<Real> >*
171 
178  void recomputeSmatrices(const Hexahedron* elm) const;
179 
184 
220  static bool timings();
222 
241  void buildEdgeDofs(const BuildDofsBase& b);
249  void buildFaceDofs(const BuildDofsBase& b);
259  protected:
260  virtual std::ostream& info(std::ostream& os) const;
261  private:
271  bool rebuild_;
272 
274  uint dim_;
276  uint nelm_;
281  std::unordered_map<uint, concepts::AdaptiveControl<> > ctrl0_;
283  std::unique_ptr<std::unordered_map<uint,
286  std::unique_ptr<std::unordered_map<uint,
289  std::unordered_map<uint, concepts::AdaptiveControlP<3> > ctrl3_;
291  std::unordered_map<uint, concepts::AdaptiveControlP<3> > pMax_;
292 
294  std::map<uint, concepts::CellData> cellList_;
296  std::map<uint, concepts::FaceData> faceList_;
298  std::map<uint, concepts::EdgeData> edgeList_;
300  std::map<uint, concepts::VertexData> vertexList_;
301 
303  std::unordered_map<uint, concepts::AdaptiveAdjustP<3> > adj_;
304 
306  mutable std::unique_ptr<concepts::SMatrix1D> S1left_, S1right_;
310  mutable std::unique_ptr<concepts::SMatrixBase<Real> > Smatrices8_[8];
314  mutable std::unique_ptr<concepts::SMatrixBase<Real> > Smatrices4x_[4],
319  mutable std::unique_ptr<concepts::SMatrixBase<Real> > Smatrices2x_[2],
321 
325  static uint timeCntr_;
326 
330  std::unique_ptr<BuildDofsBase> buildVertexDofs_;
334  std::unique_ptr<BuildDofsBase> buildEdgeDofs_;
338  std::unique_ptr<BuildDofsBase> buildFaceDofs_;
342  std::unique_ptr<BuildDofsBase> buildInnerDofs_;
343 
365  concepts::Level<3>& L, int* P);
366 
372 
380 
389  const concepts::CellData* father);
404 
420  void enrichElm_(const concepts::Hexahedron3d& cell, int* p);
421 
436  ushort* Pmax,
437  concepts::TColumn<Real>* T0 = 0);
438 
442  void getPmax_(const concepts::Hexahedron& cntr,
443  ushort Pmax[3]) const;
444 
450  ushort Pmax[3]) const;
451 
469  concepts::Level<3>& L) const;
470  };
471 
472  uint Space::dim() const {
474  return dim_;
475  }
476 
477  uint Space::nelm() const {
479  return nelm_;
480  }
481 
484  return new concepts::PListScan<Element<Real> >(*elm_);
485  }
486 
489  return bc_;
490  }
491 
492  uint Space::dim() {
493  if (rebuild_) rebuild();
494  return dim_;
495  }
496 
497  uint Space::nelm() {
498  if (rebuild_) rebuild();
499  return nelm_;
500  }
501 
503  if (rebuild_) rebuild();
504  return new concepts::PListScan<Element<Real> >(*elm_);
505  }
506 
508  if (rebuild_) rebuild();
509  return bc_;
510  }
511 
512 } // namespace hp3d
513 
514 #include "buildDofsBase.hh"
515 
516 #endif // hpElement3d_h
A column of a T matrix.
Definition: analytical.hh:18
void createEdgFaceList_(const concepts::Cell3 &cell)
Initially fills faceList_ and edgeList_.
virtual uint dim() const
Definition: space.hh:472
An abstract class for an element of a space.
Definition: exceptions.hh:15
static uint timeCntr_
Counter for timing table.
Definition: space.hh:325
std::unique_ptr< std::unordered_map< uint, concepts::AdaptiveControlP< 2 > > > ctrl2_
Hash table of the control information for the faces.
Definition: space.hh:287
std::map< uint, concepts::EdgeData > edgeList_
List of edges.
Definition: space.hh:298
A 3D FEM element: a hexahedron.
Definition: hexahedron.hh:37
Builds the trace space of a FE space consisting of hexahedral elements.
Definition: traces.hh:35
static void setTimings(concepts::InOutParameters *timings)
Sets the class to store the timing values in.
void createVtxEdgList_(const concepts::Cell3 &cell)
Initially fills vertexList_.
Space(concepts::Mesh3 &msh, uint l, uint p, concepts::BoundaryConditions *bc=0, concepts::CellConditions *cc=0)
Constructor.
std::unordered_map< uint, concepts::AdaptiveControlP< 3 > > ctrl3_
Hash table of the control information for the 3D elements.
Definition: space.hh:289
std::unique_ptr< BuildDofsBase > buildFaceDofs_
Strategy to build the face degrees of freedom.
Definition: space.hh:338
void enforceBC_(concepts::Hexahedron3d &cell)
Enforce Dirichlet boundary conditions.
concepts::Joiner< Element< Real > *, 1 > * endElm_
Mesh.
Definition: space.hh:279
static bool timings()
Returns true if the class is able to do timings.
#define conceptsException(exc)
Prepares an exception for throwing.
Definition: exceptions.hh:344
std::unique_ptr< concepts::SMatrixBase< Real > > Smatrices4y_[4]
Mesh.
Definition: space.hh:315
An abstract class for 3D meshes.
Definition: mesh.hh:112
Stores additional information on a cell, namely its father.
A 3D cell: hexahedron.
Definition: cell3D.hh:317
Joiner class with multiple successors, i.e.
concepts::Joiner< Element< Real > *, 1 > * elm_
Linked list of the elements.
Definition: space.hh:278
void deactivate_(const concepts::Connector1 &edg)
Deactivates the children of the edge edg (including the middle vertex).
Three dimensional cell.
Definition: cell.hh:112
void getPmax(const concepts::Hexahedron &cntr, ushort Pmax[3]) const
Definition: space.hh:118
void buildFaceDofs(const BuildDofsBase &b)
Change the strategy how the degrees of freedom for the face are built.
Holds parameters in hashes.
Definition: inputOutput.hh:75
std::unique_ptr< BuildDofsBase > buildEdgeDofs_
Strategy to build the edge degrees of freedom.
Definition: space.hh:334
std::unordered_map< uint, concepts::AdaptiveAdjustP< 3 > > adj_
Hash table of the adjustment information of the elements.
Definition: space.hh:303
void doCorrectRefinement_(concepts::Hexahedron3d &cell, concepts::Level< 3 > &L) const
Does apply the correct refinement based on the requested level change.
std::unique_ptr< concepts::SMatrixBase< Real > > Smatrices4x_[4]
The S matrices in 3D for the subdivision into 4 children.
Definition: space.hh:314
std::unique_ptr< std::unordered_map< uint, concepts::AdaptiveControlP< 1 > > > ctrl1_
Hash table of the control information for the edges.
Definition: space.hh:284
A 3D hp FEM space with continuous, picewise polynomial basis functions.
Definition: space.hh:84
virtual uint nelm() const
Definition: space.hh:477
std::unordered_map< uint, concepts::AdaptiveControlP< 3 > > pMax_
Hash table of the dimension of the shape function space for the 3D elements.
Definition: space.hh:291
hp3D::TraceSpace TraceSpaceT
Definition: space.hh:88
std::unique_ptr< concepts::SMatrixBase< Real > > Smatrices2y_[2]
Mesh.
Definition: space.hh:320
std::unique_ptr< BuildDofsBase > buildVertexDofs_
Strategy to build the vertex degrees of freedom.
Definition: space.hh:330
Space rebuild()
Rebuilds the space after an adjustment with adjust.
void deactivate_(const concepts::Connector0 &vtx)
Deactivates the children of the vertex vtx.
concepts::Scan< hp3D::Element< Real > > Scan
Definition: space.hh:87
void recomputeSmatrices(const Hexahedron *elm) const
Checks if the S matrices need to be recomputed and does so if necessary.
std::unique_ptr< BuildDofsBase > buildInnerDofs_
Strategy to build the inner degrees of freedom.
Definition: space.hh:342
hp3D::Element< Real > & operator++(int)=0
Returns the next element in the scanned set.
std::unique_ptr< concepts::SMatrixBase< Real > > Smatrices4z_[4]
Mesh.
Definition: space.hh:315
concepts::CellConditions * cc_
Cell conditions.
Definition: space.hh:267
virtual ~Space()
const std::unique_ptr< concepts::SMatrixBase< Real > > * getSmatrices(const concepts::Hex3dSubdivision *subdiv) const
Returns the list of matrices matching the subdivision type subdiv.
std::unique_ptr< concepts::SMatrix1D > S1right_
Mesh.
Definition: space.hh:306
A hexahedron in the topology.
Definition: topology3D.hh:134
void buildInnerDofs(const BuildDofsBase &b)
Change the strategy how the degrees of freedom for the interior are built.
std::map< uint, concepts::FaceData > faceList_
List of faces.
Definition: space.hh:296
uint dim_
Dimension of the FE space.
Definition: space.hh:274
A 2D element of the topology.
Definition: connector.hh:226
std::map< uint, concepts::VertexData > vertexList_
List of vertices.
Definition: space.hh:300
std::unique_ptr< concepts::SMatrix1D > S1left_
The S matrices in 1D.
Definition: space.hh:306
std::unordered_map< uint, concepts::AdaptiveControl<> > ctrl0_
Hash table of the control information for the vertices.
Definition: space.hh:281
std::unique_ptr< concepts::SMatrixBase< Real > > Smatrices8_[8]
The S matrices in 3D for the subdivision into 8 children.
Definition: space.hh:310
An abstract class for scanning a mesh (a set of cells) or a space (a set of elements).
void meshAndPoly_(concepts::Hexahedron3d &cell, concepts::Level< 3 > &L, int *P)
Adjusts the mesh and the polynomial degree.
void deactivate_(const concepts::Connector2 &face)
Deactivates the children of face (including the new edges and vertices).
uint nelm_
Number of elements currently active in the mesh.
Definition: space.hh:276
Responsible to build the degrees of freedom in a space.
void recomputeShapefunctions()
Recompute shape functions, e.g.
virtual std::ostream & info(std::ostream &os) const
Mesh.
void buildVertexDofs(const BuildDofsBase &b)
Change the strategy how the degrees of freedom for the vertices are built.
Indicates that the space on which a function was called was not yet correctly built.
Definition: space.hh:36
void createCellList_(const concepts::Connector &cntr, const concepts::CellData *father)
Initially fills cellList_ (recusively).
Space(const Space &spc)
Copy constructor.
Abstract class for a space.
Definition: space.hh:81
virtual const concepts::BoundaryConditions * bc() const
Definition: space.hh:487
Class to describe adjustments to elements in an adaptive space.
Definition: hpMethod.hh:59
A 1D element of the topology.
Definition: connector.hh:182
unsigned short ushort
Abbreviation for unsigned short.
Definition: typedefs.hh:48
bool rebuild_
If true: the elements have to be rebuilt.
Definition: space.hh:271
std::unique_ptr< concepts::SMatrixBase< Real > > Smatrices2z_[2]
Mesh.
Definition: space.hh:320
concepts::Mesh3 & msh_
Mesh.
Definition: space.hh:263
concepts::BoundaryConditions * bc_
Boundary conditions.
Definition: space.hh:265
Abstract base class for an adaptive space.
Definition: space.hh:350
virtual Scan * scan() const
Definition: space.hh:482
void computePmax_(const concepts::Hexahedron &cntr, ushort Pmax[3]) const
Computes the maximal polynomial degree of cell in each direction.
void enforceCC_(concepts::Hexahedron3d &cell)
Enforce cell condition INACTIVEPLUS.
static concepts::InOutParameters * timings_
Place to store timing values.
Definition: space.hh:323
3D hp-FEM for H1-conforming elements.
Definition: meshDX.hh:23
void buildElements_(concepts::Hexahedron3d &cell, ushort *Pmax, concepts::TColumn< Real > *T0=0)
Creates the elements and their T matrices.
virtual void adjust(const concepts::Element< Real > &elm, const concepts::AdaptiveAdjustP< 3 > &a)
void buildEdgeDofs(const BuildDofsBase &b)
Change the strategy how the degrees of freedom for the edge are built.
std::unique_ptr< concepts::SMatrixBase< Real > > Smatrices2x_[2]
The S matrices in 3D for the subdivision into 2 children.
Definition: space.hh:319
void enrichElm_(const concepts::Hexahedron3d &cell, int *p)
Enriches the polynomial degrees.
void getPmax_(const concepts::Hexahedron &cntr, ushort Pmax[3]) const
Returns the polynomial degrees of the shape function space on connector.
An abstract class for elements of the topology.
Definition: connector.hh:85
Interface for geometrical subdivision strategies for hexahedrons.
Definition: cell3D.hh:159
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
A 0D element of the topology.
Definition: connector.hh:147
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
Scanner for a list of pointers.
void setDim(uint dim)
std::map< uint, concepts::CellData > cellList_
List of cells.
Definition: space.hh:294
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich