9#pragma warning(disable: 4068)
10#pragma warning(disable: 4127)
11#pragma warning(disable: 4464)
12#pragma warning(disable: 5054)
13#pragma clang diagnostic push
14#pragma clang diagnostic ignored "-Wdeprecated-anon-enum-enum-conversion"
15#pragma clang diagnostic ignored "-Wunknown-warning-option"
16#pragma clang diagnostic ignored "-Wunused-but-set-variable"
17#pragma clang diagnostic ignored "-Wdeprecated-declarations"
18#include <Eigen/SparseCore>
19#pragma clang diagnostic pop
68 [[nodiscard]]
const VertBitSet &
region()
const {
return region_; }
71 [[nodiscard]]
const VertBitSet &
freeVerts()
const {
return freeVerts_; }
74 [[nodiscard]]
const VertBitSet &
firstLayerFixedVerts()
const { assert( solverValid_ );
return firstLayerFixedVerts_; }
83 template <
typename I,
typename G,
typename S>
84 void prepareRhs_( I && iniRhs, G && g, S && s );
93 VertBitSet freeVerts_;
96 VertBitSet fixedSharpVertices_;
99 VertBitSet firstLayerFixedVerts_;
105 double centerCoeff = 0;
108 std::vector<Equation> equations_;
115 std::vector<Element> nonZeroElements_;
118 Vector< int, VertId > regionVert2id_;
119 Vector< int, VertId > freeVert2id_;
121 using SparseMatrix = Eigen::SparseMatrix<double,Eigen::RowMajor>;
125 bool solverValid_ =
false;
126 using SparseMatrixColMajor = Eigen::SparseMatrix<double,Eigen::ColMajor>;
132 virtual ~Solver() =
default;
133 virtual void compute(
const SparseMatrixColMajor& A ) = 0;
134 virtual Eigen::VectorXd solve(
const Eigen::VectorXd& rhs ) = 0;
136 std::unique_ptr<Solver> solver_;
139 bool rhsValid_ =
false;
140 Eigen::VectorXd rhs_[3];
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:79
Definition MRMesh/MRLaplacian.h:34
const VertBitSet & freeVerts() const
return currently free vertices
Definition MRMesh/MRLaplacian.h:71
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 MRMesh/MRLaplacian.h:74
MRMESH_API void fixVertex(VertId v, const Vector3f &fixedPos, bool smooth=true)
MRMESH_API void updateSolver()
if you manually call this method after initialization and fixing vertices then next apply call will b...
RememberShape
Definition MRMesh/MRLaplacian.h:37
MRMESH_API Laplacian(Mesh &mesh)
Laplacian(const MeshTopology &topology, VertCoords &points)
Definition MRMesh/MRLaplacian.h:43
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 MRMesh/MRLaplacian.h:68
MRMESH_API void fixVertex(VertId v, bool smooth=true)
MRMESH_API void applyToScalar(VertScalars &scalarField)
given a pre-resized scalar field with set values in fixed vertices, computes the values in free verti...
Definition MRMesh/MRMeshTopology.h:18
Definition MRCameraOrientationPlugin.h:8
EdgeWeights
determines the weight of each edge in applications like Laplacian
Definition MREnums.h:18
VertexMass
determines the weight or mass of each vertex in applications like Laplacian
Definition MREnums.h:8
@ Unit
all vertices have same mass=1
Definition MRMesh/MRMesh.h:22