HArD::Core2D
Hybrid Arbitrary Degree::Core 2D - Library to implement 2D schemes with edge and cell polynomials as unknowns
Loading...
Searching...
No Matches
vsxcurl.hpp
Go to the documentation of this file.
1#ifndef VSXCURL_HPP
2#define VSXCURL_HPP
3
4#include <sxcurl.hpp>
5#include <unsupported/Eigen/KroneckerProduct>
6
7
8namespace HArDCore2D
9{
11 {
12 public:
13 // Type of continuous functions corresponding to the discrete space VScurl
14 typedef std::function<Eigen::Matrix2d(const Eigen::Vector2d &)> FunctionType;
15 // Types for element bases
19
20 // Type for edge basis
23
24
25 struct CellBases
26 {
27 std::unique_ptr<Poly2x2BasisCellType> Polyk2x2;
28 };
29
31 VSXCurl(const SerendipityProblem & sp, bool use_threads = true, std::ostream & output = std::cout);
32
34 const Mesh & mesh() const
35 {
36 return m_sxcurl.mesh();
37 }
38
40 const SXCurl & sXcurl() const
41 {
42 return m_sxcurl;
43 }
44
46 const size_t & degree() const
47 {
48 return m_sxcurl.degree();
49 }
50
52 Eigen::VectorXd interpolate(
53 const FunctionType & q,
54 const int doe_cell = -1
55 ) const;
56
57
58 inline auto Polyk(size_t iT) const -> const PolyBasisCellType& {
59 return *m_sxcurl.cellBases(iT).Polyk;
60 }
61
62 //---------------------------------------------------------------------//
63 //---- Curl and potential reconstructions, and stabilisation -----//
64 inline const Eigen::MatrixXd cellCurl(size_t iT) const
65 {
66 return PermuteTensorization(m_sxcurl.cellBases(iT).Polyk->dimension(), dimspace)
67 * Eigen::KroneckerProduct(m_sxcurl.cellCurl(iT), Eigen::Matrix2d::Identity());
68 }
69
71 inline const Eigen::MatrixXd cellCurl(const Cell & T) const
72 {
73 return cellCurl(T.global_index());
74 }
75
77 inline const Eigen::MatrixXd cellPotential(size_t iT) const
78 {
79 Eigen::MatrixXd PotPermutedBasis
80 = PermuteTensorization(dimspace, m_sxcurl.cellBases(iT).Polyk->dimension()) * m_sxcurl.cellPotential(iT);
81 return PermuteTensorization( m_sxcurl.cellBases(iT).Polyk->dimension(), dimspace*dimspace)
82 * Eigen::KroneckerProduct(PotPermutedBasis , Eigen::Matrix2d::Identity());
83 }
84
86 inline const Eigen::MatrixXd cellPotential(const Cell & T) const
87 {
88 return cellPotential(T.global_index());
89 }
90
92 Eigen::MatrixXd computeL2Product(
93 const size_t iT,
94 const double & penalty_factor = 1.,
95 const Eigen::MatrixXd & mass_Pk2_T = Eigen::MatrixXd::Zero(1,1),
96 const IntegralWeight & weight = IntegralWeight(1.)
97 ) const
98 {
99 return Eigen::KroneckerProduct(m_sxcurl.computeL2Product(iT, penalty_factor, mass_Pk2_T, weight), Eigen::Matrix2d::Identity());
100 }
101
102
103 //-----------------------//
104 //---- Getters ----------//
105
107 inline const CellBases & cellBases(size_t iT) const
108 {
109 assert( m_cell_bases[iT] );
110 return *m_cell_bases[iT].get();
111 }
112
114 inline const CellBases & cellBases(const Cell & T) const
115 {
116 return cellBases(T.global_index());
117 }
118 private:
119/* const DDRCore & m_ddr_core;
120 const SerendipityProblem& m_sp; // Warning */
121 const SXCurl m_sxcurl; // Not a reference as it is not created outside this class
122 CellBases _compute_cell_bases(size_t iT);
123
124 // Cell bases
125 std::vector<std::unique_ptr<CellBases> > m_cell_bases;
126
127
128 bool m_use_threads;
129 std::ostream & m_output;
130
131 };
132
133} // end of namespace HArDCore2D
134#endif
135
Definition basis.hpp:315
Matrix family obtained from a scalar family.
Definition basis.hpp:750
Discrete Serendipity Hcurl space: local operators, L2 product and global interpolator.
Definition sxcurl.hpp:16
const DDRCore::CellBases & cellBases(size_t iT) const
Return cell bases for the face of index iT.
Definition sxcurl.hpp:153
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 size_t & degree() const
Return the polynomial degree.
Definition sxcurl.hpp:51
const Mesh & mesh() const
Return the mesh.
Definition sxcurl.hpp:45
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:126
Construct all polynomial spaces for the DDR sequence.
Definition serendipity_problem.hpp:20
Vector family obtained by tensorization of a scalar family.
Definition basis.hpp:564
Definition vsxcurl.hpp:11
const CellBases & cellBases(const Cell &T) const
Return vector/matrix cell bases for cell T.
Definition vsxcurl.hpp:114
const Mesh & mesh() const
Return the mesh.
Definition vsxcurl.hpp:34
Family< MonomialScalarBasisCell > PolyBasisCellType
Definition vsxcurl.hpp:16
const Eigen::MatrixXd cellPotential(const Cell &T) const
Return the potential operator on cell T.
Definition vsxcurl.hpp:86
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 vsxcurl.hpp:92
const Eigen::MatrixXd cellCurl(const Cell &T) const
Return the gradient operator (expressed on Polyk2x2) on cell T.
Definition vsxcurl.hpp:71
const Eigen::MatrixXd cellPotential(size_t iT) const
Return the potential operator.
Definition vsxcurl.hpp:77
Family< MonomialScalarBasisEdge > PolyBasisEdgeType
Definition vsxcurl.hpp:21
Eigen::VectorXd interpolate(const FunctionType &q, const int doe_cell=-1) const
Interpolator of a continuous function.
Definition vsxcurl.cpp:56
TensorizedVectorFamily< DDRCore::PolyBasisCellType, dimspace > Poly2BasisCellType
Definition vsxcurl.hpp:17
TensorizedVectorFamily< DDRCore::PolyBasisEdgeType, dimspace > Poly2BasisEdgeType
Definition vsxcurl.hpp:22
const CellBases & cellBases(size_t iT) const
Return vector/matrix cell bases for the face of index iT.
Definition vsxcurl.hpp:107
const size_t & degree() const
Return the polynomial degree.
Definition vsxcurl.hpp:46
std::function< Eigen::Matrix2d(const Eigen::Vector2d &)> FunctionType
Definition vsxcurl.hpp:14
auto Polyk(size_t iT) const -> const PolyBasisCellType &
Definition vsxcurl.hpp:58
const SXCurl & sXcurl() const
Return the underlying sXgrad space.
Definition vsxcurl.hpp:40
const Eigen::MatrixXd cellCurl(size_t iT) const
Definition vsxcurl.hpp:64
MatrixFamily< DDRCore::PolyBasisCellType, dimspace > Poly2x2BasisCellType
Definition vsxcurl.hpp:18
Base class for global DOF spaces.
Definition variabledofspace.hpp:17
Definition Mesh2D.hpp:26
Eigen::MatrixXd PermuteTensorization(const size_t a, const size_t b)
Returns the matrix giving the permutation of the tensorization of a family of size a with a family of...
Definition basis.cpp:224
constexpr int dimspace
Dimension, and generic types for vector in correct dimension (makes it easier to translate a code bet...
Definition basis.hpp:53
std::unique_ptr< PolyBasisCellType > Polyk
Definition ddrcore.hpp:86
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
static auto q
Definition ddrcore-test.hpp:14
Structure for weights (scalar, at the moment) in integral.
Definition integralweight.hpp:33
Definition vsxcurl.hpp:26
std::unique_ptr< Poly2x2BasisCellType > Polyk2x2
Definition vsxcurl.hpp:27