HArD::Core2D
Hybrid Arbitrary Degree::Core 2D - Library to implement 2D schemes with edge and cell polynomials as unknowns
localdofspace.hpp
Go to the documentation of this file.
1 #ifndef LOCALDOFSPACE_HPP
2 #define LOCALDOFSPACE_HPP
3 
4 #include <mesh.hpp>
5 //#include <vertex.hpp>
6 //#include <edge.hpp>
7 //#include <cell.hpp>
8 
9 namespace HArDCore2D {
10 
17 
18  class LocalDOFSpace {
19  public:
22  const Mesh & mesh,
23  size_t n_local_vertex_dofs,
24  size_t n_local_edge_dofs,
25  size_t n_local_cell_dofs
26  );
27 
28  //------------------------------------------------------------------------------
29  // Accessors
30  //------------------------------------------------------------------------------
31 
33  const Mesh & mesh() const
34  {
35  return m_mesh;
36  }
37 
39  inline size_t numLocalDofsVertex() const
40  {
41  return m_n_local_vertex_dofs;
42  }
43 
45  inline size_t numLocalDofsEdge() const
46  {
47  return m_n_local_edge_dofs;
48  }
49 
51  inline size_t numLocalDofsCell() const
52  {
53  return m_n_local_cell_dofs;
54  }
55 
56  //------------------------------------------------------------------------------
57  // Dimensions
58  //------------------------------------------------------------------------------
59 
61  inline size_t dimension() const
62  {
66  }
67 
69  inline size_t numTotalDofsVertices() const
70  {
72  }
73 
75  inline size_t numTotalDofsEdges() const
76  {
78  }
79 
81  inline size_t numTotalDofsCells() const
82  {
84  }
85 
87  inline size_t dimensionVertex(const Vertex & V) const
88  {
89  return m_n_local_vertex_dofs;
90  }
91 
93  inline size_t dimensionVertex(size_t iV) const
94  {
95  return dimensionVertex(*m_mesh.vertex(iV));
96  }
97 
99  inline size_t dimensionEdge(const Edge & E) const
100  {
101  return 2 * m_n_local_vertex_dofs
103  }
104 
106  inline size_t dimensionEdge(size_t iE) const
107  {
108  return dimensionEdge(*m_mesh.edge(iE));
109  }
110 
112  inline size_t dimensionCell(const Cell & T) const
113  {
114  return T.n_vertices() * m_n_local_vertex_dofs
115  + T.n_edges() * m_n_local_edge_dofs
117  }
118 
120  inline size_t dimensionCellBoundary(const Cell & T) const
121  {
122  return T.n_vertices() * m_n_local_vertex_dofs
123  + T.n_edges() * m_n_local_edge_dofs;
124  }
125 
127  inline size_t dimensionCell(size_t iT) const
128  {
129  return dimensionCell(*m_mesh.cell(iT));
130  }
131 
133  inline size_t dimensionCellBoundary(size_t iT) const
134  {
135  return dimensionCellBoundary(*m_mesh.cell(iT));
136  }
137 
138  //------------------------------------------------------------------------------
139  // Local offsets
140  //------------------------------------------------------------------------------
141 
143  inline size_t localOffset(const Edge & E, const Vertex & V) const
144  {
145  return E.index_vertex(&V) * m_n_local_vertex_dofs;
146  }
147 
149  inline size_t localOffset(const Edge & E) const
150  {
151  return 2 * m_n_local_vertex_dofs;
152  }
153 
155  inline size_t localOffset(const Cell & T, const Vertex & V) const
156  {
157  return T.index_vertex(&V) * m_n_local_vertex_dofs;
158  }
159 
161  inline size_t localOffset(const Cell & T, const Edge & E) const
162  {
163  return T.n_vertices() * m_n_local_vertex_dofs
164  + T.index_edge(&E) * m_n_local_edge_dofs;
165  }
166 
168  inline size_t localOffset(const Cell & T) const
169  {
170  return T.n_vertices() * m_n_local_vertex_dofs
171  + T.n_edges() * m_n_local_edge_dofs;
172  }
173 
174  protected:
175  const Mesh & m_mesh;
179  };
180 
182 
183 } // namespace HArDCore2D
184 #endif
Base class for local DOF spaces: functions to access local DOFs (organised from the smallest dimensio...
Definition: localdofspace.hpp:18
Definition: Mesh2D.hpp:26
const Mesh & mesh() const
Returns the mesh.
Definition: localdofspace.hpp:33
size_t dimensionCell(size_t iT) const
Returns the dimension of the local space on the cell of index iT (including faces,...
Definition: localdofspace.hpp:127
size_t localOffset(const Cell &T, const Vertex &V) const
Returns the local offset of the vertex V with respect to the cell T.
Definition: localdofspace.hpp:155
LocalDOFSpace(const Mesh &mesh, size_t n_local_vertex_dofs, size_t n_local_edge_dofs, size_t n_local_cell_dofs)
Constructor.
Definition: localdofspace.cpp:5
size_t numTotalDofsCells() const
Returns the total number of vertex DOFs.
Definition: localdofspace.hpp:81
size_t m_n_local_cell_dofs
Definition: localdofspace.hpp:178
size_t dimensionCellBoundary(size_t iT) const
Returns the dimension of the local space on the boundary of T.
Definition: localdofspace.hpp:133
size_t dimensionVertex(const Vertex &V) const
Returns the dimension of the local space on the vertex V.
Definition: localdofspace.hpp:87
size_t localOffset(const Edge &E, const Vertex &V) const
Returns the local offset of the vertex V with respect to the edge E.
Definition: localdofspace.hpp:143
const Mesh & m_mesh
Definition: localdofspace.hpp:175
size_t m_n_local_edge_dofs
Definition: localdofspace.hpp:177
size_t numLocalDofsCell() const
Returns the number of local cell DOFs.
Definition: localdofspace.hpp:51
size_t dimensionEdge(size_t iE) const
Returns the dimension of the local space on the edge of index iE (including vertices)
Definition: localdofspace.hpp:106
size_t localOffset(const Cell &T, const Edge &E) const
Returns the local offset of the edge E with respect to the cell T.
Definition: localdofspace.hpp:161
size_t numTotalDofsEdges() const
Returns the total number of vertex DOFs.
Definition: localdofspace.hpp:75
size_t dimensionEdge(const Edge &E) const
Returns the dimension of the local space on the edge E (including vertices)
Definition: localdofspace.hpp:99
size_t localOffset(const Cell &T) const
Returns the local offset of the unknowns attached to the element T.
Definition: localdofspace.hpp:168
size_t dimensionVertex(size_t iV) const
Returns the dimension of the local space on the vertex of index iV.
Definition: localdofspace.hpp:93
size_t numLocalDofsVertex() const
Returns the number of local vertex DOFs.
Definition: localdofspace.hpp:39
size_t numTotalDofsVertices() const
Returns the total number of vertex DOFs.
Definition: localdofspace.hpp:69
size_t m_n_local_vertex_dofs
Definition: localdofspace.hpp:176
size_t dimensionCell(const Cell &T) const
Returns the dimension of the local space on the cell T (including faces, edges and vertices)
Definition: localdofspace.hpp:112
size_t localOffset(const Edge &E) const
Returns the local offset of the unknowns attached to the edge E.
Definition: localdofspace.hpp:149
size_t dimension() const
Returns the dimension of the global space (all DOFs for all geometric entities)
Definition: localdofspace.hpp:61
size_t numLocalDofsEdge() const
Returns the number of local edge DOFs.
Definition: localdofspace.hpp:45
size_t dimensionCellBoundary(const Cell &T) const
Returns the dimension of the local space on the boundary of T.
Definition: localdofspace.hpp:120
Polytope< DIMENSION > Cell
Definition: Polytope2D.hpp:151
std::size_t n_vertices() const
number of vertices in the mesh.
Definition: Mesh2D.hpp:60
Cell * cell(std::size_t index) const
get a constant pointer to a cell using its global index
Definition: Mesh2D.hpp:178
Polytope< 1 > Edge
A Face is a Polytope with object_dim = DIMENSION - 1.
Definition: Polytope2D.hpp:147
std::size_t n_cells() const
number of cells in the mesh.
Definition: Mesh2D.hpp:63
Polytope< 0 > Vertex
An Edge is a Polytope with object_dim = 1.
Definition: Polytope2D.hpp:144
Vertex * vertex(std::size_t index) const
get a constant pointer to a vertex using its global index
Definition: Mesh2D.hpp:163
std::size_t n_edges() const
number of edges in the mesh.
Definition: Mesh2D.hpp:61
Edge * edge(std::size_t index) const
get a constant pointer to a edge using its global index
Definition: Mesh2D.hpp:168
if(strcmp(field, 'real')) % real valued entries T
Definition: mmread.m:93
Definition: ddr-klplate.hpp:27