23#ifndef VULPES_FE_FE_SPACE_HPP_
24#define VULPES_FE_FE_SPACE_HPP_
42template <
typename DataType, std::
size_t Dim>
79 inline static constexpr std::size_t
dim = Dim;
90 if constexpr (std::is_same_v<FloatType, mpf_class>) {
91 mpf_set_default_prec(256);
115 template <
typename CellType>
117 return FeSpace::getMapping(cell);
125 return FeSpace::cellInitOptions();
165 template <
typename MeshType>
167 const MeshType& mesh,
168 MeshType::index_t cell_id,
169 MeshType::index_t owning_enty_id,
170 MeshType::index_t enty_dim,
171 MeshType::index_t enty_multiplicity)
const {
173 mesh, cell_id, owning_enty_id, enty_dim, enty_multiplicity);
177 FeSpace*
self() {
return static_cast<FeSpace*
>(
this); }
178 const FeSpace*
self()
const {
return static_cast<const FeSpace*
>(
this); }
194 Eigen::JacobiSVD<Eigen::MatrixXd> svd(A);
195 const auto& singularValues = svd.singularValues();
196 const double condNum =
197 singularValues(0) / singularValues(singularValues.size() - 1);
204template <
typename FloatType, std::
size_t Dim>
207 const auto n = points.size();
209 Eigen::Matrix<FloatType, -1, -1> V =
decltype(V)::Ones(n, n);
210 for (std::size_t p = 0; p < n; ++p) {
211 const auto& point = points[p];
212 for (std::size_t l = 1; l < n; ++l) {
214 for (std::size_t d = 0; d < Dim; ++d) {
226template <
typename FloatType>
228 const Eigen::Matrix<FloatType, -1, -1>& matrix) {
229 using MatrixType = Eigen::Matrix<FloatType, -1, -1>;
231 if constexpr (std::is_same_v<FloatType, mpq_class>) {
232 Eigen::PartialPivLU<MatrixType> lu_decomp(matrix);
233 return lu_decomp.inverse();
235 Eigen::FullPivLU<MatrixType> lu_decomp(matrix);
236 return lu_decomp.inverse();
244template <std::
size_t Dim,
typename FloatType>
FeSpaceBase(std::size_t order)
Definition fe_space.hpp:85
std::size_t getNumDofsForSubdimEntity(std::size_t dim) const
number of DoFs associated with each geometric entity (vtx = 0, edges = 1, faces = 2 or volume cells =...
Definition fe_space.hpp:132
FeSpace FeSpaceType
Definition fe_space.hpp:83
const auto & getBasis() const
get the polynomial basis in arbitrary precision
Definition fe_space.hpp:99
static constexpr FeType elemType()
constraint on cell shape (simplex, tensor, general)
Definition fe_space.hpp:109
static constexpr std::size_t fe_space_dim
Definition fe_space.hpp:80
static constexpr auto getMapping(const CellType &cell)
Get the geometrical mapping that maps a cell to the reference element (on which are defined the basis...
Definition fe_space.hpp:116
FloatType real_t
Definition fe_space.hpp:82
const auto & getBasisFast() const
get the polynomial basis in fixed precision
Definition fe_space.hpp:104
static constexpr bool needBasisScaling()
Definition fe_space.hpp:81
FeSpace * self()
Definition fe_space.hpp:177
static constexpr std::size_t dim
Definition fe_space.hpp:79
const std::size_t m_order
Definition fe_space.hpp:180
constexpr MeshType::index_t dofToCellDof(const MeshType &mesh, MeshType::index_t cell_id, MeshType::index_t owning_enty_id, MeshType::index_t enty_dim, MeshType::index_t enty_multiplicity) const
From the global descriptors of a dof, get the dof in local cell enumeration.
Definition fe_space.hpp:166
const FeSpace * self() const
Definition fe_space.hpp:178
DofPolicy m_dof_policy
Definition fe_space.hpp:182
std::array< std::size_t, Dim+1 > m_dofs_for_subdim_entity
Definition fe_space.hpp:181
static constexpr geometry::CellInitOptionsType cellInitOptions()
Statically define which geometrical features of a cell are needed during integration.
Definition fe_space.hpp:124
static constexpr bool dofsInteractionDistance()
Definition fe_space.hpp:142
constexpr std::size_t order() const
Get the polynomial order of the FE Space.
Definition fe_space.hpp:149
Definition fe_expr_base.hpp:58
Eigen::Matrix< FloatType, -1, -1 > buildVandermonde(const std::vector< Point< FloatType, Dim > > &points)
: Build Vandermonde matrix for a polynomial of P space
Definition fe_space.hpp:205
mpf_class real_t
Definition fe_space.hpp:188
double conditionNumber(const Eigen::MatrixXd &A)
: Estimate condition number of a dense matrix using SVD
Definition fe_space.hpp:193
Eigen::Matrix< FloatType, -1, -1 > computeInverse(const Eigen::Matrix< FloatType, -1, -1 > &matrix)
: Invert a matrix, use partial pivot if we have exact arithmetic
Definition fe_space.hpp:227
Eigen::Matrix< FloatType, -1, -1 > computeLagrangianPolyCoef(const std::vector< Point< FloatType, Dim > > &points)
: Compute the coefficients of interpolatory lagrangian polynomials of a set of points
Definition fe_space.hpp:245
Definition dof_policy.hpp:45
FeType
Definition fe_space.hpp:48
@ Poly
Definition fe_space.hpp:48
@ Simplex
Definition fe_space.hpp:48
@ Tensor
Definition fe_space.hpp:48
geometry::Cell< Dim, double, int32_t > CellType
Definition fe_expr_base.hpp:41
geometry::Point< DataType, Dim > Point
Definition fe_space.hpp:43
Eigen::Matrix< DataType, Dim, 1, Eigen::ColMajor > Point
Definition traits.hpp:34
std::underlying_type_t< CellInitOptions > CellInitOptionsType
Definition cell.hpp:95
std::array< T, Dim > getMonomial(std::size_t n)
Computes the Dim-D monomial exponents for a given linear index.
Definition monomial.hpp:199
constexpr U pow(U base, V exp, U result=U(1))
Computes the power of a number.
Definition vmath.hpp:171
Definition cell_manager.hpp:38
Static class describing the template for a DoF policy.
Definition dof_policy.hpp:58
static constexpr bool dofsInteractionDistance()
Returns the distance of interaction of dofs in different cells.
Definition dof_policy.hpp:72