space2D.hh

Go to the documentation of this file.
1 
6 #ifndef linSpace2D_hh
7 #define linSpace2D_hh
8 #include "toolbox/hashMap.hh"
9 #include "element2D.hh"
10 #include "basics/typedefs.hh"
11 #include "space/space.hh"
12 #include "space/element.hh"
14 
15 namespace concepts {
16 
17  // forward declarations
18  class Mesh2;
19  class BoundaryConditions;
20 
21  // ************************************************************** Scanners **
22 
23  template<>
24  class Scan<linearFEM::Triangle> : public Scan<linearFEM::Element> {
25  public:
26  virtual linearFEM::Triangle& operator++(int) = 0;
27  };
28 
29  template<>
30  class Scan<linearFEM::Quad> : public Scan<linearFEM::Element> {
31  public:
32  virtual linearFEM::Quad& operator++(int) = 0;
33  };
34 
35 } // namespace concepts
36 
37 namespace linearFEM {
38 
39  // ************************************************************** Linear2d **
40 
44  class Linear2d : public concepts::Space<Real> {
45  public:
47  typedef void (*SMap)(const concepts::TColumn<Real>&,
49 
55  Linear2d(concepts::Mesh2& msh, uint level,
57  virtual ~Linear2d();
58  virtual uint dim() const { return dim_; }
59  virtual uint nelm() const { return nelm_; }
60  virtual Scan* scan() const;
62  void rebuild();
68  void adjust(const Quad& elm, const short level);
69 
76  const SMap& S(uint i) const;
77 
78  static void S0(const concepts::TColumn<Real>& src,
79  concepts::TColumn<Real>& dst); // bottom left
80  static void S1(const concepts::TColumn<Real>& src,
81  concepts::TColumn<Real>& dst); // bottom right
82  static void S2(const concepts::TColumn<Real>& src,
83  concepts::TColumn<Real>& dst); // top right
84  static void S3(const concepts::TColumn<Real>& src,
85  concepts::TColumn<Real>& dst); // top left
86 
87  protected:
88  virtual std::ostream& info(std::ostream& os) const;
89  private:
91  uint dim_;
93  uint nelm_;
95  bool rebuild_;
103  std::unordered_map<uint, short> adj_;
105  std::unordered_map<uint, short> ctrl0_;
107  std::unordered_map<uint, short> ctrl0L_;
109  std::unordered_map<uint, short> ctrl1_;
111  std::unordered_map<uint, short> ctrl1L_;
113  std::unordered_map<uint, short> ctrl2_;
115  std::unordered_map<uint, uint> dof_;
116 
117  static SMap S_[4];
118 
125  void rebuild0_(concepts::Connector2& cntr, const int l, int& L);
126 
134 
144  concepts::TColumn<Real>* T0 = 0);
147  };
148 
149 } // namespace linearFEM
150 
151 #endif // linSpace2D_hh
virtual uint dim() const
Definition: space2D.hh:58
A column of a T matrix.
Definition: analytical.hh:18
A 2D cell: quadrilateral.
Definition: cell2D.hh:378
concepts::BoundaryConditions * bc_
Boundary conditions.
Definition: space2D.hh:99
uint nelm_
Number of elements.
Definition: space2D.hh:93
void rebuild()
Rebuilds the space.
virtual linearFEM::Triangle & operator++(int)=0
Returns the next element in the scanned set.
virtual Scan * scan() const
std::unordered_map< uint, short > adj_
Adjustements (ie. level changes) for the elements.
Definition: space2D.hh:103
Abstract class for a space.
A quadrilateral in the topology.
Definition: topology.hh:272
std::unordered_map< uint, short > ctrl2_
Control information for elements.
Definition: space2D.hh:113
Joiner class with multiple successors, i.e.
void(* SMap)(const concepts::TColumn< Real > &, concepts::TColumn< Real > &)
Definition: space2D.hh:47
void adjust(const Quad &elm, const short level)
Adjusts an element in the space.
A 2D cell: triangle.
Definition: cell2D.hh:31
virtual linearFEM::Quad & operator++(int)=0
Returns the next element in the scanned set.
void rebuild1_(concepts::Triangle2d &cell, concepts::TColumn< Real > *T0=0)
Builds the elements for triangles.
std::unordered_map< uint, short > ctrl1_
Control information for edges: active, member of space.
Definition: space2D.hh:109
concepts::Mesh2 & msh_
Mesh which this space is based on.
Definition: space2D.hh:97
std::unordered_map< uint, uint > dof_
Degree of freedom map.
Definition: space2D.hh:115
std::unordered_map< uint, short > ctrl0L_
Level information for vertices.
Definition: space2D.hh:107
virtual uint nelm() const
Definition: space2D.hh:59
concepts::Scan< Element > Scan
Definition: space2D.hh:46
bool rebuild_
Flag for rebuilding the space.
Definition: space2D.hh:95
Linear FEM in 1D, 2D and 3D.
Definition: spaceTraits.hh:19
virtual std::ostream & info(std::ostream &os) const
std::unordered_map< uint, short > ctrl1L_
Level information for edges.
Definition: space2D.hh:111
A 2D element of the topology.
Definition: connector.hh:226
An abstract class for scanning a mesh (a set of cells) or a space (a set of elements).
An abstract class for 2D meshes.
Definition: mesh.hh:103
static void S1(const concepts::TColumn< Real > &src, concepts::TColumn< Real > &dst)
Quadrilateral element with bilinear shape functions in 2D.
Definition: element2D.hh:79
const SMap & S(uint i) const
Returns the ith S matrix.
static void S0(const concepts::TColumn< Real > &src, concepts::TColumn< Real > &dst)
Linear2d(concepts::Mesh2 &msh, uint level, concepts::BoundaryConditions *bc=0)
Constructor.
void rebuild0_(concepts::Connector2 &cntr, const int l, int &L)
Determines maximal level and sets control information.
static SMap S_[4]
Definition: space2D.hh:117
static void S2(const concepts::TColumn< Real > &src, concepts::TColumn< Real > &dst)
concepts::Joiner< Element *, 1 > * elm_
List of elements.
Definition: space2D.hh:101
A 1D element of the topology.
Definition: connector.hh:182
static void S3(const concepts::TColumn< Real > &src, concepts::TColumn< Real > &dst)
std::unordered_map< uint, short > ctrl0_
Control information for vertices: active, member of space, valid index.
Definition: space2D.hh:105
void deactivate_(concepts::Connector1 &edg)
Deactives children of this edge and the new vertex.
void rebuild1_(concepts::Quad2d &cell, concepts::TColumn< Real > *T0=0)
Builds the elements for quads.
uint dim_
Number of degrees of freedom.
Definition: space2D.hh:91
Space for linear triangular and bilinear quadrilateral FEM in 2D.
Definition: space2D.hh:44
Triangular element with linear shape functions in 2D.
Definition: element2D.hh:29
A triangle in the topology.
Definition: topology.hh:193
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich