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#include <Eigen/SparseCore>
18#pragma clang diagnostic pop
66 [[nodiscard]]
const VertBitSet &
region()
const {
return region_; }
69 [[nodiscard]]
const VertBitSet &
freeVerts()
const {
return freeVerts_; }
72 [[nodiscard]]
const VertBitSet &
firstLayerFixedVerts()
const { assert( solverValid_ );
return firstLayerFixedVerts_; }
81 template <
typename I,
typename G,
typename S>
82 void prepareRhs_(
I && iniRhs, G && g, S && s );
91 VertBitSet freeVerts_;
94 VertBitSet fixedSharpVertices_;
97 VertBitSet firstLayerFixedVerts_;
103 double centerCoeff = 0;
106 std::vector<Equation> equations_;
113 std::vector<Element> nonZeroElements_;
116 Vector< int, VertId > regionVert2id_;
117 Vector< int, VertId > freeVert2id_;
119 using SparseMatrix = Eigen::SparseMatrix<double,Eigen::RowMajor>;
123 bool solverValid_ =
false;
124 using SparseMatrixColMajor = Eigen::SparseMatrix<double,Eigen::ColMajor>;
130 virtual ~Solver() =
default;
131 virtual void compute(
const SparseMatrixColMajor& A ) = 0;
132 virtual Eigen::VectorXd solve(
const Eigen::VectorXd& rhs ) = 0;
134 std::unique_ptr<Solver> solver_;
137 bool rhsValid_ =
false;
138 Eigen::VectorXd rhs_[3];
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:79
Definition MRMesh/MRLaplacian.h:32
const VertBitSet & freeVerts() const
return currently free vertices
Definition MRMesh/MRLaplacian.h:69
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:72
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:35
MRMESH_API Laplacian(Mesh &mesh)
Laplacian(const MeshTopology &topology, VertCoords &points)
Definition MRMesh/MRLaplacian.h:41
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:66
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
EdgeWeights
determines the weight of each edge in applications like Laplacian
Definition MREnums.h:18
I
Definition MRMesh/MRMeshFwd.h:121
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