HArD::Core2D
Hybrid Arbitrary Degree::Core 2D - Library to implement 2D schemes with edge and cell polynomials as unknowns
globaldofspace.hpp
Go to the documentation of this file.
1 #ifndef GLOBALDOFSPACE_HPP
2 #define GLOBALDOFSPACE_HPP
3 
4 #include <localdofspace.hpp>
5 
6 namespace HArDCore2D
7 {
14 
16  class GlobalDOFSpace : public LocalDOFSpace {
17  public:
20  const Mesh & mesh,
21  size_t n_local_vertex_dofs,
22  size_t n_local_edge_dofs,
23  size_t n_local_cell_dofs
24  );
25 
26  //------------------------------------------------------------------------------
27  // Global offsets
28  //------------------------------------------------------------------------------
29 
31  inline size_t globalOffset(const Vertex & V) const
32  {
33  return V.global_index() * m_n_local_vertex_dofs;
34 
35  }
36 
38  inline size_t globalOffset(const Edge & E) const
39  {
41  + E.global_index() * m_n_local_edge_dofs;
42  }
43 
45  inline size_t globalOffset(const Cell & T) const
46  {
49  + T.global_index() * m_n_local_cell_dofs;
50  }
51 
52  //------------------------------------------------------------------------------
53  // Restrictions
54  //------------------------------------------------------------------------------
55 
57  Eigen::VectorXd restrictEdge(size_t iE, const Eigen::VectorXd & vh) const;
58 
60  Eigen::VectorXd restrictCell(size_t iT, const Eigen::VectorXd & vh) const;
61 
63  inline Eigen::VectorXd restrict(const Edge & E, const Eigen::VectorXd vh) const
64  {
65  return restrictEdge(E.global_index(), vh);
66  }
67 
69  inline Eigen::VectorXd restrict(const Cell & T, const Eigen::VectorXd vh) const
70  {
71  return restrictCell(T.global_index(), vh);
72  }
73 
74  //------------------------------------------------------------------------------
75  // Extensions
76  //------------------------------------------------------------------------------
77 
79  Eigen::MatrixXd extendOperator(const Cell & T, const Edge & E, const Eigen::MatrixXd & opE) const;
80 
81  //------------------------------------------------------------------------------
82  // Global DOF indices for an element T
83  //------------------------------------------------------------------------------
84 
85  std::vector<size_t> globalDOFIndices(const Cell & T) const;
86 
87  //------------------------------------------------------------------------------
88  // Functions to handle labels
89  //------------------------------------------------------------------------------
91  inline void setLabelDOF(const size_t i, const int label)
92  {
93  m_labelDOF[i] = label;
94  }
95 
97  inline int getLabelDOF(const size_t i)
98  {
99  return m_labelDOF[i];
100  }
101 
102  private:
103  std::vector<int> m_labelDOF;
104 
105  };
106 
107 } // namespace HArDCore2D
108 
109 #endif
Base class for global DOF spaces. Provides functions to manipulate global DOFs (the local version bei...
Definition: globaldofspace.hpp:16
Base class for local DOF spaces: functions to access local DOFs (organised from the smallest dimensio...
Definition: localdofspace.hpp:18
Definition: Mesh2D.hpp:26
Compute max and min eigenvalues of all matrices for i
Definition: compute_eigs.m:5
const Mesh & mesh() const
Returns the mesh.
Definition: localdofspace.hpp:33
void setLabelDOF(const size_t i, const int label)
Set a label to the DOF number i (default label is -1)
Definition: globaldofspace.hpp:91
GlobalDOFSpace(const Mesh &mesh, size_t n_local_vertex_dofs, size_t n_local_edge_dofs, size_t n_local_cell_dofs)
Constructor.
Definition: globaldofspace.cpp:9
Eigen::VectorXd restrictCell(size_t iT, const Eigen::VectorXd &vh) const
Restrict to the cell (including vertices and edges) of index iT.
Definition: globaldofspace.cpp:46
std::vector< size_t > globalDOFIndices(const Cell &T) const
Definition: globaldofspace.cpp:98
size_t m_n_local_cell_dofs
Definition: localdofspace.hpp:178
size_t globalOffset(const Cell &T) const
Return the global offset for the unknowns on the cell T.
Definition: globaldofspace.hpp:45
size_t globalOffset(const Vertex &V) const
Return the global offset for the unknowns on the vertex V.
Definition: globaldofspace.hpp:31
const Mesh & m_mesh
Definition: localdofspace.hpp:175
size_t m_n_local_edge_dofs
Definition: localdofspace.hpp:177
int getLabelDOF(const size_t i)
Get label of DOF number i.
Definition: globaldofspace.hpp:97
Eigen::VectorXd restrict(const Edge &E, const Eigen::VectorXd vh) const
Restrict to an edge.
Definition: globaldofspace.hpp:63
Eigen::VectorXd restrictEdge(size_t iE, const Eigen::VectorXd &vh) const
Restrict to the edge (including its vertices) of index iE.
Definition: globaldofspace.cpp:25
Eigen::VectorXd restrict(const Cell &T, const Eigen::VectorXd vh) const
Restrict to a cell.
Definition: globaldofspace.hpp:69
Eigen::MatrixXd extendOperator(const Cell &T, const Edge &E, const Eigen::MatrixXd &opE) const
Extend an edge operator to a cell.
Definition: globaldofspace.cpp:75
size_t m_n_local_vertex_dofs
Definition: localdofspace.hpp:176
size_t globalOffset(const Edge &E) const
Return the global offset for the unknowns on the edge E.
Definition: globaldofspace.hpp:38
Polytope< DIMENSION > Cell
Definition: Polytope2D.hpp:151
std::size_t n_vertices() const
number of vertices in the mesh.
Definition: Mesh2D.hpp:60
Polytope< 1 > Edge
A Face is a Polytope with object_dim = DIMENSION - 1.
Definition: Polytope2D.hpp:147
Polytope< 0 > Vertex
An Edge is a Polytope with object_dim = 1.
Definition: Polytope2D.hpp:144
std::size_t n_edges() const
number of edges in the mesh.
Definition: Mesh2D.hpp:61
if(strcmp(field, 'real')) % real valued entries T
Definition: mmread.m:93
Definition: ddr-klplate.hpp:27