HArD::Core2D
Hybrid Arbitrary Degree::Core 2D - Library to implement 2D schemes with edge and cell polynomials as unknowns
Loading...
Searching...
No Matches
serendipity_problem.hpp
Go to the documentation of this file.
1
2#ifndef SERENDIPITY_PROBLEM_HPP
3#define SERENDIPITY_PROBLEM_HPP
4
5#include <ddrcore.hpp>
6
7namespace HArDCore2D
8{
9
16 //------------------------------------------------------------------------------
17
20 {
21 public:
24
26 /* PartialPivLU does not seem to always work... */
27 typedef Eigen::FullPivLU<Eigen::MatrixXd> InverseProblem;
28
30 SerendipityProblem(const DDRCore & ddrcore, bool use_threads = true, std::ostream & output = std::cout);
31
32 //---------- Serendipity edges and faces, and degrees -------------//
34 inline const std::vector<size_t> & serendipityEdges(size_t iT) const
35 {
36 return m_serendipity_edges[iT];
37 }
38
40 inline const int n_serendipityEdges(size_t iT) const
41 {
42 return m_serendipity_edges[iT].size();
43 }
44
46 inline const int serDegreeCell(size_t iT) const
47 {
48 return m_ddrcore.degree() + 1 - n_serendipityEdges(iT);
49 }
50
51
52 //---------- Serendipity dimensions and bases for grad -------------//
54 inline size_t dimCellPolyl(size_t iT) const
55 {
57 }
58
60 inline size_t dimCellPolyl(const Cell & T) const
61 {
62 return dimCellPolyl(T.global_index());
63 }
64
66 inline const PolylBasisCellType & cellBasisPolyl(size_t iT) const
67 {
68 // Make sure that the basis has been created
69 assert( m_cell_bases_Polyl[iT] );
70 return *m_cell_bases_Polyl[iT].get();
71
72 }
73
75 inline const PolylBasisCellType & cellBasisPolyl(const Cell & T) const
76 {
77 return cellBasisPolyl(T.global_index());
78 }
79
81 Eigen::VectorXd nDOFs_cells_SXGrad() const;
82
83 //---------- Serendipity dimensions and bases for curl -------------//
84
86 inline size_t dimCellRolyCompllpo(size_t iT) const
87 {
89 }
90
92 inline size_t dimCellRolyCompllpo(const Cell & T) const
93 {
94 return dimCellRolyCompllpo(T.global_index());
95 }
96
98 inline const RolyCompllpoBasisCellType & cellBasisRolyCompllpo(size_t iT) const
99 {
100 // Make sure that the basis has been created
101 assert( m_cell_bases_RolyCompllpo[iT] );
102 return *m_cell_bases_RolyCompllpo[iT].get();
103
104 }
105
107 inline const RolyCompllpoBasisCellType & cellBasisRolyCompllpo(const Cell & T) const
108 {
109 return cellBasisRolyCompllpo(T.global_index());
110 }
111
113 Eigen::VectorXd nDOFs_cells_SXCurl() const;
114
115
116
117 //---------- Serendipity dimensions and bases for rotrot -------------//
118
119
120
122 Eigen::VectorXd nDOFs_cells_SXRotRot() const;
123
124
125
126 //------------ Serendipity operators ---------------//
127
129 const Eigen::MatrixXd SerendipityOperatorCell(const size_t iT, const Eigen::MatrixXd & LT) const;
130
132 inline const Eigen::MatrixXd SerendipityOperatorCell(const Cell & T, const Eigen::MatrixXd & LT) const
133 {
134 return SerendipityOperatorCell(T.global_index(), LT);
135 };
136
137
139 inline const Mesh & mesh() const
140 {
141 return m_ddrcore.mesh();
142 }
143
145 inline const DDRCore & ddrCore() const
146 {
147 return m_ddrcore;
148 }
149
150 private:
151
153 std::vector<size_t> _compute_serendipity_edges(size_t iT);
154
156 InverseProblem _compute_inverse_problem_cells(size_t iT);
157
158 // Pointer do DDRCore
159 const DDRCore & m_ddrcore;
160 // Output stream
161 std::ostream & m_output;
162
163 // cell basis P^l
164 std::vector<std::unique_ptr<PolylBasisCellType> > m_cell_bases_Polyl;
165
166 // cell basis R^{c,l+1}
167 std::vector<std::unique_ptr<RolyCompllpoBasisCellType> > m_cell_bases_RolyCompllpo;
168
169 // List the local indices of edges/faces used for the serendipity on each face/cell
170 std::vector<std::vector<size_t>> m_serendipity_edges;
171
172 // Store the inverse of the matrix to compute serendipity operators on cells
173 std::vector<InverseProblem> m_inverse_problem_cells;
174
175 };
176
177} // end of namespace HArDCore2D
178
179#endif // SERENDIPITY_PROBLEM_HPP
Construct all polynomial spaces for the DDR sequence.
Definition ddrcore.hpp:63
Generate a basis restricted to the first "dimension" functions.
Definition basis.hpp:1099
Construct all polynomial spaces for the DDR sequence.
Definition serendipity_problem.hpp:20
Definition Mesh2D.hpp:26
const Mesh & mesh() const
Return a const reference to the mesh.
Definition ddrcore.hpp:116
const Eigen::MatrixXd SerendipityOperatorCell(const size_t iT, const Eigen::MatrixXd &LT) const
Compute the serendipity operator on the cell of index iT.
Definition serendipity_problem.cpp:147
const RolyCompllpoBasisCellType & cellBasisRolyCompllpo(size_t iT) const
Return the basis of R^{c,l+1} on cell of index iT.
Definition serendipity_problem.hpp:98
const std::vector< size_t > & serendipityEdges(size_t iT) const
Return the list of serendipity edges in a cell.
Definition serendipity_problem.hpp:34
const size_t & degree() const
Return the polynomial degree.
Definition ddrcore.hpp:122
const int n_serendipityEdges(size_t iT) const
Return the number of serendipity edges in a cell.
Definition serendipity_problem.hpp:40
const RolyCompllpoBasisCellType & cellBasisRolyCompllpo(const Cell &T) const
Return the basis of R^{c,l+1} on cell T.
Definition serendipity_problem.hpp:107
const PolylBasisCellType & cellBasisPolyl(const Cell &T) const
Return the basis of P^l on cell T.
Definition serendipity_problem.hpp:75
Eigen::FullPivLU< Eigen::MatrixXd > InverseProblem
Type for inverses of matrix for serendipity problem.
Definition serendipity_problem.hpp:27
Eigen::VectorXd nDOFs_cells_SXCurl() const
Number of DOFs on cells for serendipity XCurl space.
Definition serendipity_problem.cpp:165
Eigen::VectorXd nDOFs_cells_SXRotRot() const
Number of DOFs on cells for serendipity XRotRot space.
Definition serendipity_problem.cpp:177
size_t dimCellPolyl(const Cell &T) const
Return the dimension of P^{l+1} on cell T.
Definition serendipity_problem.hpp:60
size_t dimCellPolyl(size_t iT) const
Return the dimension of P^l on cell of index iT.
Definition serendipity_problem.hpp:54
const DDRCore & ddrCore() const
Return a const reference to the underlying DDR core.
Definition serendipity_problem.hpp:145
Eigen::VectorXd nDOFs_cells_SXGrad() const
Number of DOFs on cells for serendipity XGrad space.
Definition serendipity_problem.cpp:153
size_t dimCellRolyCompllpo(size_t iT) const
Return the dimension of R^{c,l+1} on cell of index iT.
Definition serendipity_problem.hpp:86
const int serDegreeCell(size_t iT) const
Return the serendipity degree ell_T in a cell.
Definition serendipity_problem.hpp:46
RestrictedBasis< DDRCore::RolyComplBasisCellType > RolyCompllpoBasisCellType
Definition serendipity_problem.hpp:23
const PolylBasisCellType & cellBasisPolyl(size_t iT) const
Return the basis of P^l on cell of index iT.
Definition serendipity_problem.hpp:66
const Mesh & mesh() const
Return a const reference to the mesh.
Definition serendipity_problem.hpp:139
const Eigen::MatrixXd SerendipityOperatorCell(const Cell &T, const Eigen::MatrixXd &LT) const
Compute the serendipity operator on the Cell T.
Definition serendipity_problem.hpp:132
RestrictedBasis< DDRCore::PolyBasisCellType > PolylBasisCellType
Definition serendipity_problem.hpp:22
size_t dimCellRolyCompllpo(const Cell &T) const
Return the dimension of R^{c,l+1} on cell T.
Definition serendipity_problem.hpp:92
bool use_threads
Definition HHO_DiffAdvecReac.hpp:47
if(strcmp(field, 'real')) % real valued entries T
Definition mmread.m:93
Definition ddr-klplate.hpp:27
Basis dimensions for various polynomial spaces on edges/faces/elements (when relevant): Pk,...
Definition polynomialspacedimension.hpp:55