HArD::Core2D
Hybrid Arbitrary Degree::Core 2D - Library to implement 2D schemes with edge and cell polynomials as unknowns
Loading...
Searching...
No Matches
sxcurl.hpp
Go to the documentation of this file.
1#ifndef SXCURL_HPP
2#define SXCURL_HPP
3
5#include <ddrcore.hpp>
6#include <integralweight.hpp>
7#include <xcurl.hpp>
8#include <sxgrad.hpp>
10
11namespace HArDCore2D
12{
14
15 class SXCurl : public VariableDOFSpace
16 {
17 public:
18 typedef std::function<Eigen::Vector2d(const Eigen::Vector2d &)> FunctionType;
19
21
23 {
25 const Eigen::MatrixXd & _serendipity,
26 const Eigen::MatrixXd & _extension,
27 const Eigen::MatrixXd & _reduction
28 )
32 {
33 // Do nothing
34 }
35
36 Eigen::MatrixXd serendipity;
37 Eigen::MatrixXd extension;
38 Eigen::MatrixXd reduction;
39 };
40
42 SXCurl(const DDRCore & ddr_core, const SerendipityProblem & ser_pro, bool use_threads = true, std::ostream & output = std::cout);
43
45 const Mesh & mesh() const
46 {
47 return m_ddr_core.mesh();
48 }
49
51 const size_t & degree() const
52 {
53 return m_ddr_core.degree();
54 }
56 Eigen::VectorXd interpolate(
57 const FunctionType & v,
58 const int deg_quad = -1
59 ) const;
60 //----------------------------------//
61 //---- Cell transfer operators -----//
63 inline const Eigen::MatrixXd & ScurlCell(size_t iT) const
64 {
65 return (*m_cell_transfer_operators[iT]).serendipity;
66 }
67
69 inline const Eigen::MatrixXd & EcurlCell(size_t iT) const
70 {
71 return (*m_cell_transfer_operators[iT]).extension;
72 }
73
75 inline const Eigen::MatrixXd & RcurlCell(size_t iT) const
76 {
77 return (*m_cell_transfer_operators[iT]).reduction;
78 }
79
81 inline const Eigen::MatrixXd & ScurlCell(const Cell & T) const
82 {
83 return ScurlCell(T.global_index());
84 }
85
87 inline const Eigen::MatrixXd & EcurlCell(const Cell & T) const
88 {
89 return EcurlCell(T.global_index());
90 }
91
93 inline const Eigen::MatrixXd & RcurlCell(const Cell & T) const
94 {
95 return RcurlCell(T.global_index());
96 }
97
98 //-----------------------------------------------------------------//
99 //---- Full curl and potential reconstructions, and L2 product ----//
100
102 inline const Eigen::MatrixXd cellCurl(size_t iT) const
103 {
104 return m_xcurl.cellOperators(iT).curl * EcurlCell(iT);
105 }
106
108 inline const Eigen::MatrixXd cellCurl(const Cell & T) const
109 {
110 return cellCurl(T.global_index());
111 }
112
114 inline const Eigen::MatrixXd cellPotential(size_t iT) const
115 {
116 return m_xcurl.cellOperators(iT).potential * EcurlCell(iT);
117 }
118
120 inline const Eigen::MatrixXd cellPotential(const Cell & T) const
121 {
122 return cellPotential(T.global_index());
123 }
124
126 Eigen::MatrixXd computeStabilisation(
127 const size_t iT,
128 const double & penalty_factor = 1.,
130 ) const;
131
133 Eigen::MatrixXd computeL2Product(
134 const size_t iT,
135 const double & penalty_factor = 1.,
136 const Eigen::MatrixXd & mass_Pk2_T = Eigen::MatrixXd::Zero(1,1),
138 ) const
139 {
140 return EcurlCell(iT).transpose()
142 *EcurlCell(iT);
143 }
144
145
147 Eigen::MatrixXd computeL2ProductGradient(
148 const size_t iT,
149 const SXGrad & sx_grad,
150 const std::string & side,
151 const double & penalty_factor = 1.,
152 const Eigen::MatrixXd & mass_Pk2_T = Eigen::MatrixXd::Zero(1,1),
154 ) const;
155
156 //-----------------------//
157 //---- Getters ----------//
158
160 inline const DDRCore::CellBases & cellBases(size_t iT) const
161 {
162 return m_ddr_core.cellBases(iT);
163 }
164
166 inline const DDRCore::CellBases & cellBases(const Cell & T) const
167 {
168 return m_ddr_core.cellBases(T.global_index());
169 }
170
172 inline const DDRCore::EdgeBases & edgeBases(size_t iE) const
173 {
174 return m_ddr_core.edgeBases(iE);
175 }
176
178 inline const DDRCore::EdgeBases & edgeBases(const Edge & E) const
179 {
180 return m_ddr_core.edgeBases(E.global_index());
181 }
182
183 private:
184 TransferOperators _compute_cell_transfer_operators(size_t iT);
185
186 const DDRCore & m_ddr_core;
187 const SerendipityProblem & m_ser_pro;
188 const XCurl m_xcurl;
189
190 // Containers for serendipity, extension and reduction operators
191 std::vector<std::unique_ptr<TransferOperators> > m_cell_transfer_operators;
192
193 bool m_use_threads;
194 std::ostream & m_output;
195
196 };
197
198} // end of namespace HArDCore2D
199#endif
Construct all polynomial spaces for the DDR sequence.
Definition ddrcore.hpp:63
Discrete Serendipity Hcurl space: local operators, L2 product and global interpolator.
Definition sxcurl.hpp:16
const Eigen::MatrixXd & RcurlCell(size_t iT) const
Return the reduction for the cell of index iT.
Definition sxcurl.hpp:75
const Eigen::MatrixXd & ScurlCell(size_t iT) const
Return the serendipity reconstruction for the cell of index iT.
Definition sxcurl.hpp:63
const DDRCore::CellBases & cellBases(size_t iT) const
Return cell bases for the face of index iT.
Definition sxcurl.hpp:160
const Eigen::MatrixXd cellPotential(const Cell &T) const
Return the potential operator on cell T.
Definition sxcurl.hpp:120
Eigen::VectorXd interpolate(const FunctionType &v, const int deg_quad=-1) const
Interpolator of a continuous function.
Definition sxcurl.cpp:51
const Eigen::MatrixXd cellCurl(size_t iT) const
Return the full curl operator on the cell of index iT.
Definition sxcurl.hpp:102
const Eigen::MatrixXd cellPotential(size_t iT) const
Return the potential operator on the cell of index iT.
Definition sxcurl.hpp:114
const Eigen::MatrixXd cellCurl(const Cell &T) const
Return the full curl operator on cell T.
Definition sxcurl.hpp:108
const Eigen::MatrixXd & EcurlCell(size_t iT) const
Return the extension for the cell of index iT.
Definition sxcurl.hpp:69
const DDRCore::CellBases & cellBases(const Cell &T) const
Return cell bases for cell T.
Definition sxcurl.hpp:166
const Eigen::MatrixXd & EcurlCell(const Cell &T) const
Return the extension for cell T.
Definition sxcurl.hpp:87
Eigen::MatrixXd computeL2ProductGradient(const size_t iT, const SXGrad &sx_grad, const std::string &side, const double &penalty_factor=1., const Eigen::MatrixXd &mass_Pk2_T=Eigen::MatrixXd::Zero(1, 1), const IntegralWeight &weight=IntegralWeight(1.)) const
Compute the matrix of the (weighted) L2-product as 'computeL2Product', with application of the discre...
Definition sxcurl.cpp:202
const size_t & degree() const
Return the polynomial degree.
Definition sxcurl.hpp:51
const DDRCore::EdgeBases & edgeBases(const Edge &E) const
Return edge bases for edge E.
Definition sxcurl.hpp:178
const DDRCore::EdgeBases & edgeBases(size_t iE) const
Return edge bases for the edge of index iE.
Definition sxcurl.hpp:172
const Mesh & mesh() const
Return the mesh.
Definition sxcurl.hpp:45
std::function< Eigen::Vector2d(const Eigen::Vector2d &)> FunctionType
Definition sxcurl.hpp:18
const Eigen::MatrixXd & ScurlCell(const Cell &T) const
Return the serendipity reconstruction for cell T.
Definition sxcurl.hpp:81
Eigen::MatrixXd computeStabilisation(const size_t iT, const double &penalty_factor=1., const IntegralWeight &weight=IntegralWeight(1.)) const
Compute the local stabilisation matrix.
Definition sxcurl.cpp:185
Eigen::MatrixXd computeL2Product(const size_t iT, const double &penalty_factor=1., const Eigen::MatrixXd &mass_Pk2_T=Eigen::MatrixXd::Zero(1, 1), const IntegralWeight &weight=IntegralWeight(1.)) const
Compute the matrix of the (weighted) L2-product.
Definition sxcurl.hpp:133
const Eigen::MatrixXd & RcurlCell(const Cell &T) const
Return the reduction for cell T.
Definition sxcurl.hpp:93
Discrete Serendipity Hgrad space: local operators, L2 product and global interpolator.
Definition sxgrad.hpp:20
Construct all polynomial spaces for the DDR sequence.
Definition serendipity_problem.hpp:20
Base class for global DOF spaces.
Definition variabledofspace.hpp:17
Discrete Hcurl space: local operators, L2 product and global interpolator.
Definition xcurl.hpp:18
Definition Mesh2D.hpp:26
const Mesh & mesh() const
Return a const reference to the mesh.
Definition ddrcore.hpp:116
const size_t & degree() const
Return the polynomial degree.
Definition ddrcore.hpp:122
Eigen::MatrixXd potential
Definition xcurl.hpp:36
const LocalOperators & cellOperators(size_t iT) const
Return cell operators for the cell of index iT.
Definition xcurl.hpp:61
Eigen::MatrixXd computeL2Product(const size_t iT, const double &penalty_factor=1., const Eigen::MatrixXd &mass_Pk2_T=Eigen::MatrixXd::Zero(1, 1), const IntegralWeight &weight=IntegralWeight(1.)) const
Compute the matrix of the (weighted) L2-product for the cell of index iT.
Definition xcurl.cpp:212
const CellBases & cellBases(size_t iT) const
Return cell bases for element iT.
Definition ddrcore.hpp:128
const EdgeBases & edgeBases(size_t iE) const
Return edge bases for edge iE.
Definition ddrcore.hpp:136
Eigen::MatrixXd curl
Definition xcurl.hpp:35
bool use_threads
Definition HHO_DiffAdvecReac.hpp:45
depending on the Matrix Market format indicated by or array(dense array storage). The data will be duplicated % as appropriate if symmetry is indicated in the header. % % Optionally
if(strcmp(field, 'real')) % real valued entries T
Definition mmread.m:93
Definition mhd-solutions.hpp:9
static auto v
Definition ddrcore-test.hpp:32
Structure to store element bases.
Definition ddrcore.hpp:81
Structure to store edge bases.
Definition ddrcore.hpp:103
Structure for weights (scalar, at the moment) in integral.
Definition integralweight.hpp:33
A structure to store the serendipity, extension and reduction operators.
Definition sxcurl.hpp:23
TransferOperators(const Eigen::MatrixXd &_serendipity, const Eigen::MatrixXd &_extension, const Eigen::MatrixXd &_reduction)
Definition sxcurl.hpp:24
Eigen::MatrixXd extension
Definition sxcurl.hpp:37
Eigen::MatrixXd reduction
Definition sxcurl.hpp:38
Eigen::MatrixXd serendipity
Definition sxcurl.hpp:36