PolyFEM
Loading...
Searching...
No Matches
RBFWithQuadraticLagrange.hpp
Go to the documentation of this file.
1#pragma once
2
5#include <Eigen/Dense>
6
7namespace polyfem
8{
9 namespace basis
10 {
11 // See `RBFWithQuadratic.cpp` for a detail commented version of the code.
12 // This class implements the same consistency constraints, but uses Lagrange
13 // multipliers to solve the constrained least-square system, instead of
14 // eliminating the constraints explicitly from the system.
16 {
17 public:
28 RBFWithQuadraticLagrange(const assembler::LinearAssembler &assembler, const Eigen::MatrixXd &centers, const Eigen::MatrixXd &collocation_points,
29 const Eigen::MatrixXd &local_basis_integral, const quadrature::Quadrature &quadr,
30 Eigen::MatrixXd &rhs, bool with_constraints = true);
31
39 void basis(const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &val) const;
40
48 void grad(const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &val) const;
49
56 void bases_values(const Eigen::MatrixXd &samples, Eigen::MatrixXd &val) const;
57
65 void bases_grads(const int axis, const Eigen::MatrixXd &samples, Eigen::MatrixXd &val) const;
66
67 private:
68 bool is_volume() const { return centers_.cols() == 3; }
69
70 // Computes the matrix that evaluates the kernels + polynomial terms on the given sample points
71 void compute_kernels_matrix(const Eigen::MatrixXd &samples, Eigen::MatrixXd &A) const;
72
73 // Computes the constraint matrix C that we want to impose (C w = d)
74 void compute_constraints_matrix_2d_old(const int num_bases, const quadrature::Quadrature &quadr, Eigen::MatrixXd &C) const;
75 void compute_constraints_matrix_2d(const assembler::LinearAssembler &assembler, const int num_bases, const quadrature::Quadrature &quadr, Eigen::MatrixXd &C) const;
76
77 // Computes the constraint matrix C that we want to impose (C w = d)
78 void compute_constraints_matrix_3d(const int num_bases, const quadrature::Quadrature &quadr, Eigen::MatrixXd &C) const;
79
80 // Computes the weights by solving a (possibly constrained) linear least square
81 void compute_weights(const assembler::LinearAssembler &assembler, const Eigen::MatrixXd &collocation_points,
82 const Eigen::MatrixXd &local_basis_integral, const quadrature::Quadrature &quadr,
83 Eigen::MatrixXd &rhs, bool with_constraints);
84
85 private:
86 // #C x dim matrix of kernel center positions
87 Eigen::MatrixXd centers_;
88
89 // (#C + dim + 1) x #B matrix of weights extending the #B bases that are non-vanishing on the polytope
90 Eigen::MatrixXd weights_;
91 };
92 } // namespace basis
93} // namespace polyfem
double val
Definition Assembler.cpp:86
assemble matrix based on the local assembler local assembler is eg Laplace, LinearElasticity etc
void compute_constraints_matrix_2d_old(const int num_bases, const quadrature::Quadrature &quadr, Eigen::MatrixXd &C) const
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(const assembler::LinearAssembler &assembler, const int num_bases, const quadrature::Quadrature &quadr, Eigen::MatrixXd &C) const
void bases_values(const Eigen::MatrixXd &samples, Eigen::MatrixXd &val) const
Batch evaluates the RBF + polynomials on a set of sample points.
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)
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_constraints_matrix_3d(const int num_bases, const quadrature::Quadrature &quadr, Eigen::MatrixXd &C) const
void basis(const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &val) const
Evaluates one RBF function over a list of coordinates.
void compute_kernels_matrix(const Eigen::MatrixXd &samples, Eigen::MatrixXd &A) const