1#ifndef VARIABLEDOFSPACE_HPP
2#define VARIABLEDOFSPACE_HPP
24 const Eigen::VectorXi n_local_face_dofs,
25 const Eigen::VectorXi n_local_cell_dofs
33 const Eigen::VectorXi n_local_face_dofs,
34 const Eigen::VectorXi n_local_cell_dofs
42 const Eigen::VectorXi n_local_face_dofs,
43 const Eigen::VectorXi n_local_cell_dofs
51 size_t n_local_face_dofs,
52 const Eigen::VectorXi n_local_cell_dofs
60 size_t n_local_face_dofs,
61 size_t n_local_cell_dofs
79 return m_n_local_vertex_dofs[
iV];
92 return m_n_local_edge_dofs[
iE];
105 return m_n_local_face_dofs[
iF];
118 return m_n_local_cell_dofs[
iT];
136 return m_n_local_vertex_dofs.sum();
142 return m_n_local_edge_dofs.sum();
148 return m_n_local_face_dofs.sum();
154 return m_n_local_cell_dofs.sum();
167 return m_n_local_vertex_dofs[V.global_index()];
181 return m_n_local_vertex_dofs[E.vertex(0)->global_index()] + m_n_local_vertex_dofs[E.vertex(1)->global_index()]
182 + m_n_local_edge_dofs[E.global_index()];
197 for (Vertex * V :
F.get_vertices()){
198 nb_dofs += m_n_local_vertex_dofs[V->global_index()];
200 for (Edge * E :
F.get_edges()){
201 nb_dofs += m_n_local_edge_dofs[E->global_index()];
203 return nb_dofs + m_n_local_face_dofs[
F.global_index()];
217 for (Vertex * V : T.get_vertices()){
218 nb_dofs += m_n_local_vertex_dofs[V->global_index()];
220 for (Edge * E : T.get_edges()){
221 nb_dofs += m_n_local_edge_dofs[E->global_index()];
223 for (Face *
F : T.get_faces()){
224 nb_dofs += m_n_local_face_dofs[
F->global_index()];
226 return nb_dofs + m_n_local_cell_dofs[T.global_index()];
243 for (
int iV=0;
iV<E.index_vertex(&V);
iV++){
244 nb_dofs += m_n_local_vertex_dofs[E.vertex(
iV)->global_index()];
252 return m_n_local_vertex_dofs[E.vertex(0)->global_index()] + m_n_local_vertex_dofs[E.vertex(1)->global_index()];
259 for (
int iV=0;
iV<
F.index_vertex(&V);
iV++){
260 nb_dofs += m_n_local_vertex_dofs[
F.vertex(
iV)->global_index()];
269 for (
size_t iV=0;
iV<
F.n_vertices();
iV++){
270 nb_dofs += m_n_local_vertex_dofs[
F.vertex(
iV)->global_index()];
272 for (
int iE=0;
iE<
F.index_edge(&E);
iE++){
273 nb_dofs += m_n_local_edge_dofs[
F.edge(
iE)->global_index()];
282 for (
size_t iV=0;
iV<
F.n_vertices();
iV++){
283 nb_dofs += m_n_local_vertex_dofs[
F.vertex(
iV)->global_index()];
285 for (
size_t iE=0;
iE<
F.n_edges();
iE++){
286 nb_dofs += m_n_local_edge_dofs[
F.edge(
iE)->global_index()];
295 for (
int iV=0;
iV<T.index_vertex(&V);
iV++){
296 nb_dofs += m_n_local_vertex_dofs[T.vertex(
iV)->global_index()];
305 for (
size_t iV=0;
iV<T.n_vertices();
iV++){
306 nb_dofs += m_n_local_vertex_dofs[T.vertex(
iV)->global_index()];
308 for (
int iE=0;
iE<T.index_edge(&E);
iE++){
309 nb_dofs += m_n_local_edge_dofs[T.edge(
iE)->global_index()];
318 for (
size_t iV=0;
iV<T.n_vertices();
iV++){
319 nb_dofs += m_n_local_vertex_dofs[T.vertex(
iV)->global_index()];
321 for (
size_t iE=0;
iE<T.n_edges();
iE++){
322 nb_dofs += m_n_local_edge_dofs[T.edge(
iE)->global_index()];
324 for (
int iF=0;
iF<T.index_face(&
F);
iF++){
325 nb_dofs += m_n_local_face_dofs[T.face(
iF)->global_index()];
334 for (
size_t iV=0;
iV<T.n_vertices();
iV++){
335 nb_dofs += m_n_local_vertex_dofs[T.vertex(
iV)->global_index()];
337 for (
size_t iE=0;
iE<T.n_edges();
iE++){
338 nb_dofs += m_n_local_edge_dofs[T.edge(
iE)->global_index()];
340 for (
size_t iF=0;
iF<T.n_faces();
iF++){
341 nb_dofs += m_n_local_face_dofs[T.face(
iF)->global_index()];
353 return ( m_n_local_vertex_dofs.head(V.global_index()) ).sum();
359 return m_n_local_vertex_dofs.sum()
360 + ( m_n_local_edge_dofs.head(E.global_index()) ).
sum();
366 return m_n_local_vertex_dofs.sum()
367 + m_n_local_edge_dofs.sum()
368 + ( m_n_local_face_dofs.head(
F.global_index()) ).
sum();
374 return m_n_local_vertex_dofs.sum()
375 + m_n_local_edge_dofs.sum()
376 + m_n_local_face_dofs.sum()
377 + ( m_n_local_cell_dofs.head(T.global_index()) ).
sum();
394 inline Eigen::VectorXd
restrict(
const Edge & E,
const Eigen::VectorXd
vh)
const
400 inline Eigen::VectorXd
restrict(
const Face &
F,
const Eigen::VectorXd
vh)
const
406 inline Eigen::VectorXd
restrict(
const Cell & T,
const Eigen::VectorXd
vh)
const
417 Eigen::MatrixXd
extendOperator(
const Cell & T,
const Face &
F,
const Eigen::MatrixXd &
opF)
const;
420 Eigen::MatrixXd
extendOperator(
const Cell & T,
const Edge & E,
const Eigen::MatrixXd &
opE)
const;
423 Eigen::MatrixXd
extendOperator(
const Face &
F,
const Edge & E,
const Eigen::MatrixXd &
opE)
const;
426 void extendOperator(
const Cell & T,
const Face &
F, Eigen::Ref<Eigen::MatrixXd>
opT,
const Eigen::MatrixXd &
opF)
const;
429 void extendOperator(
const Cell & T,
const Edge & E, Eigen::MatrixXd &
opT,
const Eigen::MatrixXd &
opE)
const;
432 void extendOperator(
const Face &
F,
const Edge & E, Eigen::MatrixXd &
opF,
const Eigen::MatrixXd &
opE)
const;
449 Eigen::VectorXi m_n_local_vertex_dofs;
450 Eigen::VectorXi m_n_local_edge_dofs;
451 Eigen::VectorXi m_n_local_face_dofs;
452 Eigen::VectorXi m_n_local_cell_dofs;
Base class for global DOF spaces.
Definition variabledofspace.hpp:17
Class to describe a mesh.
Definition MeshND.hpp:17
@ Matrix
Definition basis.hpp:67
size_t globalOffset(const Face &F) const
Return the global offset for the unknowns on the face F.
Definition variabledofspace.hpp:364
size_t dimensionCell(const Cell &T) const
Returns the dimension of the local space on the cell T (including faces, edges and vertices)
Definition variabledofspace.hpp:214
Eigen::VectorXd restrict(const Edge &E, const Eigen::VectorXd vh) const
Restrict to an edge.
Definition variabledofspace.hpp:394
size_t numLocalDofsEdge(const size_t iE) const
Returns the number of local DOFs on edge of index iE.
Definition variabledofspace.hpp:89
size_t globalOffset(const Edge &E) const
Return the global offset for the unknowns on the edge E.
Definition variabledofspace.hpp:357
Eigen::VectorXd restrict(const Face &F, const Eigen::VectorXd vh) const
Restrict to a face.
Definition variabledofspace.hpp:400
size_t dimensionFace(const Face &F) const
Returns the dimension of the local space on the face F (including edges and vertices)
Definition variabledofspace.hpp:194
size_t dimensionFace(size_t iF) const
Returns the dimension of the local space on the face of index iF (including edges and vertices)
Definition variabledofspace.hpp:207
size_t nDOFs_cells() const
Total number of cells DOFs.
Definition variabledofspace.hpp:152
size_t localOffset(const Face &F, const Vertex &V) const
Returns the local offset of the vertex V with respect to the face F.
Definition variabledofspace.hpp:256
size_t nDOFs_vertices() const
Total number of vertices DOFs.
Definition variabledofspace.hpp:134
size_t dimensionEdge(size_t iE) const
Returns the dimension of the local space on the edge of index iE (including vertices)
Definition variabledofspace.hpp:186
size_t dimensionVertex(size_t iV) const
Returns the dimension of the local space on the vertex of index iV.
Definition variabledofspace.hpp:171
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 variabledofspace.hpp:302
size_t numLocalDofsVertex(const size_t iV) const
Returns the number of local DOFs on vertex of index iV.
Definition variabledofspace.hpp:76
Eigen::MatrixXd extendOperator(const Cell &T, const Face &F, const Eigen::MatrixXd &opF) const
Definition variabledofspace.cpp:172
size_t numLocalDofsCell(const Cell &T) const
Returns the number of local DOFs on cell T.
Definition variabledofspace.hpp:122
size_t dimensionEdge(const Edge &E) const
Returns the dimension of the local space on the edge E (including vertices)
Definition variabledofspace.hpp:179
size_t dimensionCell(size_t iT) const
Returns the dimension of the local space on the cell of index iT (including faces,...
Definition variabledofspace.hpp:230
size_t numLocalDofsEdge(const Edge &E) const
Returns the number of local DOFs on edge E.
Definition variabledofspace.hpp:96
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 variabledofspace.cpp:260
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 variabledofspace.cpp:367
size_t numLocalDofsFace(const Face &F) const
Returns the number of local DOFs on face F.
Definition variabledofspace.hpp:109
size_t localOffset(const Face &F) const
Returns the local offset of the unknowns attached to the face F.
Definition variabledofspace.hpp:279
Eigen::VectorXd restrictEdge(size_t iE, const Eigen::VectorXd &vh) const
Restrict to the edge (including its vertices) of index iE.
Definition variabledofspace.cpp:97
size_t dimension() const
Returns the dimension of the global space (all DOFs for all geometric entities)
Definition variabledofspace.hpp:158
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 variabledofspace.hpp:292
size_t localOffset(const Edge &E) const
Returns the local offset of the unknowns attached to the edge E.
Definition variabledofspace.hpp:250
size_t nDOFs_faces() const
Total number of faces DOFs.
Definition variabledofspace.hpp:146
size_t numLocalDofsVertex(const Vertex &V) const
Returns the number of local DOFs on vertex V.
Definition variabledofspace.hpp:83
size_t numLocalDofsCell(const size_t iT) const
Returns the number of local DOFs on cell of index iT.
Definition variabledofspace.hpp:115
size_t nDOFs_edges() const
Total number of edges DOFs.
Definition variabledofspace.hpp:140
Eigen::VectorXd restrictCell(size_t iT, const Eigen::VectorXd &vh) const
Restrict to the cell (including vertices, edges and faces) of index iT.
Definition variabledofspace.cpp:140
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 variabledofspace.hpp:240
size_t localOffset(const Cell &T) const
Returns the local offset of the unknowns attached to the element T.
Definition variabledofspace.hpp:331
size_t globalOffset(const Cell &T) const
Return the global offset for the unknowns on the cell T.
Definition variabledofspace.hpp:372
const Mesh & mesh() const
Returns the mesh.
Definition variabledofspace.hpp:70
size_t dimensionVertex(const Vertex &V) const
Returns the dimension of the local space on the vertex V.
Definition variabledofspace.hpp:165
size_t localOffset(const Face &F, const Edge &E) const
Returns the local offset of the edge E with respect to the face F.
Definition variabledofspace.hpp:266
Eigen::VectorXd restrict(const Cell &T, const Eigen::VectorXd vh) const
Restrict to a cell.
Definition variabledofspace.hpp:406
Eigen::VectorXd restrictFace(size_t iF, const Eigen::VectorXd &vh) const
Restrict to the face (including vertices and edges) of index iF.
Definition variabledofspace.cpp:114
size_t globalOffset(const Vertex &V) const
Return the global offset for the unknowns on the vertex V.
Definition variabledofspace.hpp:351
size_t localOffset(const Cell &T, const Face &F) const
Returns the local offset of the face F with respect to the cell T.
Definition variabledofspace.hpp:315
size_t numLocalDofsFace(const size_t iF) const
Returns the number of local DOFs on face of index iF.
Definition variabledofspace.hpp:102
Face< dimension > * face(std::size_t index) const
get a constant pointer to a face using its global index
Definition MeshND.hpp:196
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
Vertex< dimension > * vertex(std::size_t index) const
get a constant pointer to a vertex using its global index
Definition MeshND.hpp:194
std::size_t n_faces() const
number of faces in the mesh.
Definition MeshND.hpp:59
std::size_t n_cells() const
number of cells in the mesh.
Definition MeshND.hpp:60
Edge< dimension > * edge(std::size_t index) const
get a constant pointer to a edge using its global index
Definition MeshND.hpp:195
Cell< dimension > * cell(std::size_t index) const
get a constant pointer to a cell using its global index
Definition MeshND.hpp:197
Definition ddr-magnetostatics.hpp:41