7#include <MRPch/MREigenSparseCore.h>
42 MRMESH_API
void fixVertex( VertId v,
bool smooth =
true );
46 MRMESH_API
void fixVertex( VertId v,
const Vector3f & fixedPos,
bool smooth =
true );
58 [[nodiscard]]
const VertBitSet &
region()
const {
return region_; }
61 [[nodiscard]]
const VertBitSet &
freeVerts()
const {
return freeVerts_; }
64 [[nodiscard]]
const VertBitSet &
firstLayerFixedVerts()
const { assert( solverValid_ );
return firstLayerFixedVerts_; }
73 template <
typename I,
typename G,
typename S>
74 void prepareRhs_( I && iniRhs, G && g, S && s );
83 VertBitSet freeVerts_;
86 VertBitSet fixedSharpVertices_;
89 VertBitSet firstLayerFixedVerts_;
98 std::vector<Equation> equations_;
105 std::vector<Element> nonZeroElements_;
111 using SparseMatrix = Eigen::SparseMatrix<double,Eigen::RowMajor>;
115 bool solverValid_ =
false;
116 using SparseMatrixColMajor = Eigen::SparseMatrix<double,Eigen::ColMajor>;
123 virtual void compute(
const SparseMatrixColMajor& A ) = 0;
124 virtual Eigen::VectorXd
solve(
const Eigen::VectorXd& rhs ) = 0;
126 std::unique_ptr<Solver> solver_;
129 bool rhsValid_ =
false;
130 Eigen::VectorXd rhs_[3];
Definition MRLaplacian.h:24
Definition MRMeshTopology.h:22
const VertBitSet & freeVerts() const
return currently free vertices
Definition MRLaplacian.h:61
MRMESH_API void apply()
given fixed vertices, computes positions of remaining region vertices
const VertBitSet & firstLayerFixedVerts() const
return fixed vertices from the first layer around free vertices
Definition MRLaplacian.h:64
MRMESH_API void fixVertex(VertId v, const Vector3f &fixedPos, bool smooth=true)
int firstElem
coefficient on matrix diagonal
Definition MRLaplacian.h:96
virtual void compute(const SparseMatrixColMajor &A)=0
MRMESH_API void updateSolver()
if you manually call this method after initialization and fixing vertices then next apply call will b...
virtual Eigen::VectorXd solve(const Eigen::VectorXd &rhs)=0
EdgeWeights
determines the weight of each edge in applications like Laplacian
Definition MREnums.h:44
RememberShape
Definition MRLaplacian.h:27
MRMESH_API Laplacian(Mesh &mesh)
virtual ~Solver()=default
Laplacian(const MeshTopology &topology, VertCoords &points)
Definition MRLaplacian.h:33
double centerCoeff
equation right hand side
Definition MRLaplacian.h:95
MRMESH_API void init(const VertBitSet &freeVerts, EdgeWeights weights, VertexMass vmass=VertexMass::Unit, RememberShape rem=Laplacian::RememberShape::Yes)
const VertBitSet & region() const
return all initially free vertices and the first layer of vertices around them
Definition MRLaplacian.h:58
MRMESH_API void fixVertex(VertId v, bool smooth=true)
Vector3d rhs
Definition MRLaplacian.h:94
double coeff
Definition MRLaplacian.h:102
VertId neiVert
Definition MRLaplacian.h:103
VertexMass
determines the weight or mass of each vertex in applications like Laplacian
Definition MREnums.h:34
MRMESH_API void applyToScalar(VertScalars &scalarField)
given a pre-resized scalar field with set values in fixed vertices, computes the values in free verti...
@ No
true Laplacian mode when initial mesh shape is remembered and copied in apply
@ Unit
all vertices have same mass=1
only for bindings generation
Definition MRCameraOrientationPlugin.h:8