HArD::Core3D
Hybrid Arbitrary Degree::Core 3D - Library to implement 3D schemes with vertex, edge, face 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 HArDCore3D
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_face_dofs,
24  size_t n_local_cell_dofs
25  );
26 
27  //------------------------------------------------------------------------------
28  // Global offsets
29  //------------------------------------------------------------------------------
30 
32  inline size_t globalOffset(const Vertex & V) const
33  {
34  return V.global_index() * m_n_local_vertex_dofs;
35 
36  }
37 
39  inline size_t globalOffset(const Edge & E) const
40  {
42  + E.global_index() * m_n_local_edge_dofs;
43  }
44 
46  inline size_t globalOffset(const Face & F) const
47  {
50  + F.global_index() * m_n_local_face_dofs;
51  }
52 
54  inline size_t globalOffset(const Cell & T) const
55  {
59  + T.global_index() * m_n_local_cell_dofs;
60  }
61 
63  inline size_t globalOffset(size_t d,size_t i) const
64  {
65  size_t rv = i*numLocalDofs(d);
66  switch(d) {
67  case(3):
69  case(2):
71  case(1):
73  default:
74  ;
75  }
76  return rv;
77  }
78 
79  //------------------------------------------------------------------------------
80  // Restrictions
81  //------------------------------------------------------------------------------
82 
84  Eigen::VectorXd restrictEdge(size_t iE, const Eigen::VectorXd & vh) const;
85 
87  Eigen::VectorXd restrictFace(size_t iF, const Eigen::VectorXd & vh) const;
88 
90  Eigen::VectorXd restrictCell(size_t iT, const Eigen::VectorXd & vh) const;
91 
93  inline Eigen::VectorXd restrict(const Edge & E, const Eigen::VectorXd vh) const
94  {
95  return restrictEdge(E.global_index(), vh);
96  }
97 
99  inline Eigen::VectorXd restrict(const Face & F, const Eigen::VectorXd vh) const
100  {
101  return restrictFace(F.global_index(), vh);
102  }
103 
105  inline Eigen::VectorXd restrict(const Cell & T, const Eigen::VectorXd vh) const
106  {
107  return restrictCell(T.global_index(), vh);
108  }
109 
110  //------------------------------------------------------------------------------
111  // Extensions
112  //------------------------------------------------------------------------------
113 
116  Eigen::MatrixXd extendOperator(const Cell & T, const Face & F, const Eigen::MatrixXd & opF) const;
117 
119  Eigen::MatrixXd extendOperator(const Cell & T, const Edge & E, const Eigen::MatrixXd & opE) const;
120 
122  Eigen::MatrixXd extendOperator(const Face & F, const Edge & E, const Eigen::MatrixXd & opE) const;
123 
125  Eigen::MatrixXd extendOperator(size_t d1, size_t i1, size_t d2, size_t i2, const Eigen::MatrixXd & op) const;
126 
128  void addInnerProductContribution(const Cell & T, const Face & F, Eigen::MatrixXd & prodT, const Eigen::MatrixXd & prodF) const;
129 
130  //------------------------------------------------------------------------------
131  // Global DOF indices for an element T
132  //------------------------------------------------------------------------------
133 
135  std::vector<size_t> globalDOFIndices(const Cell & T) const;
136 
138  std::vector<size_t> globalDOFIndices(const Face & F) const;
139  };
140 
141 } // namespace HArDCore3D
142 
143 #endif
Base class for global DOF spaces. Provides functions to manipulate global DOFs (the local version bei...
Definition: globaldofspace.hpp:16
Base class for DOF spaces: functions to access local DOFs (organised from the smallest dimension to t...
Definition: localdofspace.hpp:15
Class to describe a mesh.
Definition: MeshND.hpp:17
size_t globalOffset(const Cell &T) const
Return the global offset for the unknowns on the cell T.
Definition: globaldofspace.hpp:54
Eigen::VectorXd restrictCell(size_t iT, const Eigen::VectorXd &vh) const
Restrict to the cell (including vertices, edges and faces) of index iT.
Definition: globaldofspace.cpp:77
std::vector< size_t > globalDOFIndices(const Cell &T) const
Returns a vector listing the global DOFs attached to the element T: vertex DOFs, edge DOFs,...
Definition: globaldofspace.cpp:298
void addInnerProductContribution(const Cell &T, const Face &F, Eigen::MatrixXd &prodT, const Eigen::MatrixXd &prodF) const
Takes an inner product prodF on a face F, and adds its contributions to the inner product prodT on th...
Definition: globaldofspace.cpp:229
const Mesh & mesh() const
Returns the mesh.
Definition: localdofspace.hpp:31
size_t globalOffset(const Vertex &V) const
Return the global offset for the unknowns on the vertex V.
Definition: globaldofspace.hpp:32
size_t globalOffset(size_t d, size_t i) const
Return the global offset for the unknows on the i-th element of dimension d.
Definition: globaldofspace.hpp:63
size_t globalOffset(const Face &F) const
Return the global offset for the unknowns on the face F.
Definition: globaldofspace.hpp:46
size_t m_n_local_edge_dofs
Definition: localdofspace.hpp:225
size_t m_n_local_vertex_dofs
Definition: localdofspace.hpp:224
Eigen::VectorXd restrict(const Edge &E, const Eigen::VectorXd vh) const
Restrict to an edge.
Definition: globaldofspace.hpp:93
Eigen::VectorXd restrict(const Cell &T, const Eigen::VectorXd vh) const
Restrict to a cell.
Definition: globaldofspace.hpp:105
Eigen::MatrixXd extendOperator(const Cell &T, const Face &F, const Eigen::MatrixXd &opF) const
Definition: globaldofspace.cpp:114
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
size_t numLocalDofs(size_t d) const
Returns the number of local d-cell DOFs.
Definition: localdofspace.hpp:61
size_t m_n_local_face_dofs
Definition: localdofspace.hpp:226
GlobalDOFSpace(const Mesh &mesh, size_t n_local_vertex_dofs, size_t n_local_edge_dofs, size_t n_local_face_dofs, size_t n_local_cell_dofs)
Constructor.
Definition: globaldofspace.cpp:9
size_t m_n_local_cell_dofs
Definition: localdofspace.hpp:227
Eigen::VectorXd restrictFace(size_t iF, const Eigen::VectorXd &vh) const
Restrict to the face (including vertices and edges) of index iF.
Definition: globaldofspace.cpp:46
size_t globalOffset(const Edge &E) const
Return the global offset for the unknowns on the edge E.
Definition: globaldofspace.hpp:39
Eigen::VectorXd restrict(const Face &F, const Eigen::VectorXd vh) const
Restrict to a face.
Definition: globaldofspace.hpp:99
const Mesh & m_mesh
Definition: localdofspace.hpp:223
std::size_t n_vertices() const
number of vertices in the mesh.
Definition: MeshND.hpp:57
std::size_t n_edges() const
number of edges in the mesh.
Definition: MeshND.hpp:58
std::size_t n_faces() const
number of faces in the mesh.
Definition: MeshND.hpp:59
Definition: ddr-magnetostatics.hpp:40
MeshND::Edge< 2 > Edge
Definition: Mesh2D.hpp:11
MeshND::Face< 2 > Face
Definition: Mesh2D.hpp:12
MeshND::Cell< 2 > Cell
Definition: Mesh2D.hpp:13
MeshND::Vertex< 2 > Vertex
Definition: Mesh2D.hpp:10