PolyFEM
Loading...
Searching...
No Matches
RBFWithQuadratic.hpp
Go to the documentation of this file.
1#pragma once
2
6
7#include <Eigen/Dense>
8
9namespace polyfem
10{
11 namespace basis
12 {
14 {
15 public:
16 inline static int index_mapping(const int alpha, const int beta, const int d, const int ass_dim)
17 {
18 return ass_dim * ass_dim * d + ass_dim * beta + alpha;
19 }
20
21 static void setup_monomials_vals_2d(const int star_index, const Eigen::MatrixXd &pts, assembler::ElementAssemblyValues &vals);
22 static void setup_monomials_strong_2d(const int dim, const assembler::LinearAssembler &assembler, const Eigen::MatrixXd &pts, const QuadratureVector &da, std::array<Eigen::MatrixXd, 5> &strong);
23
34 RBFWithQuadratic(const assembler::LinearAssembler &assembler, const Eigen::MatrixXd &centers, const Eigen::MatrixXd &collocation_points,
35 const Eigen::MatrixXd &local_basis_integral, const quadrature::Quadrature &quadr,
36 Eigen::MatrixXd &rhs, bool with_constraints = true);
37
45 void basis(const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &val) const;
46
54 void grad(const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &val) const;
55
62 void bases_values(const Eigen::MatrixXd &samples, Eigen::MatrixXd &val) const;
63
71 void bases_grads(const int axis, const Eigen::MatrixXd &samples, Eigen::MatrixXd &val) const;
72
73 private:
74 bool is_volume() const { return centers_.cols() == 3; }
75
76 // Computes the matrix that evaluates the kernels + polynomial terms on the given sample points
77 void compute_kernels_matrix(const Eigen::MatrixXd &samples, Eigen::MatrixXd &A) const;
78
79 // Computes the relationship w = L v + t between the unknowns (v) and the weights w
80 void compute_constraints_matrix_2d_old(const int num_bases, const quadrature::Quadrature &quadr,
81 const Eigen::MatrixXd &local_basis_integral, Eigen::MatrixXd &L, Eigen::MatrixXd &t) const;
82
83 // Computes the relationship w = L v + t between the unknowns (v) and the weights w
84 void compute_constraints_matrix_2d(const assembler::LinearAssembler &assembler, const int num_bases, const quadrature::Quadrature &quadr,
85 const Eigen::MatrixXd &local_basis_integral, Eigen::MatrixXd &L, Eigen::MatrixXd &t) const;
86
87 // Computes the relationship w = L v + t between the unknowns (v) and the weights w
88 void compute_constraints_matrix_3d(const assembler::LinearAssembler &assembler, const int num_bases, const quadrature::Quadrature &quadr,
89 const Eigen::MatrixXd &local_basis_integral, Eigen::MatrixXd &L, Eigen::MatrixXd &t) const;
90
91 // Computes the weights by solving a (possibly constrained) linear least square
92 void compute_weights(const assembler::LinearAssembler &assembler, const Eigen::MatrixXd &collocation_points,
93 const Eigen::MatrixXd &local_basis_integral, const quadrature::Quadrature &quadr,
94 Eigen::MatrixXd &rhs, bool with_constraints);
95
96 private:
97 // #C x dim matrix of kernel center positions
98 Eigen::MatrixXd centers_;
99
100 // (#C + dim + 1) x #B matrix of weights extending the #B bases that are non-vanishing on the polytope
101 Eigen::MatrixXd weights_;
102 };
103 } // namespace basis
104} // namespace polyfem
double val
Definition Assembler.cpp:86
QuadratureVector da
Definition Assembler.cpp:23
ElementAssemblyValues vals
Definition Assembler.cpp:22
stores per element basis values at given quadrature points and geometric mapping
assemble matrix based on the local assembler local assembler is eg Laplace, LinearElasticity etc
static void setup_monomials_strong_2d(const int dim, const assembler::LinearAssembler &assembler, const Eigen::MatrixXd &pts, const QuadratureVector &da, std::array< Eigen::MatrixXd, 5 > &strong)
void compute_constraints_matrix_3d(const assembler::LinearAssembler &assembler, const int num_bases, const quadrature::Quadrature &quadr, const Eigen::MatrixXd &local_basis_integral, Eigen::MatrixXd &L, Eigen::MatrixXd &t) const
void bases_values(const Eigen::MatrixXd &samples, Eigen::MatrixXd &val) const
Batch evaluates the RBF + polynomials on a set of sample points.
void bases_grads(const int axis, const Eigen::MatrixXd &samples, Eigen::MatrixXd &val) const
Batch evaluates the gradient of the RBF + polynomials on a set of sample points.
void compute_constraints_matrix_2d_old(const int num_bases, const quadrature::Quadrature &quadr, const Eigen::MatrixXd &local_basis_integral, Eigen::MatrixXd &L, Eigen::MatrixXd &t) const
void compute_weights(const assembler::LinearAssembler &assembler, const Eigen::MatrixXd &collocation_points, const Eigen::MatrixXd &local_basis_integral, const quadrature::Quadrature &quadr, Eigen::MatrixXd &rhs, bool with_constraints)
static void setup_monomials_vals_2d(const int star_index, const Eigen::MatrixXd &pts, assembler::ElementAssemblyValues &vals)
static int index_mapping(const int alpha, const int beta, const int d, const int ass_dim)
void compute_constraints_matrix_2d(const assembler::LinearAssembler &assembler, const int num_bases, const quadrature::Quadrature &quadr, const Eigen::MatrixXd &local_basis_integral, Eigen::MatrixXd &L, Eigen::MatrixXd &t) const
void grad(const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &val) const
Evaluates the gradient of one RBF function over a list of coordinates.
void compute_kernels_matrix(const Eigen::MatrixXd &samples, Eigen::MatrixXd &A) const
Eigen::Matrix< double, Eigen::Dynamic, 1, 0, MAX_QUAD_POINTS, 1 > QuadratureVector
Definition Types.hpp:17