27#include <DGtal/base/Common.h>
28#include <DGtal/helpers/StdDefs.h>
29#include <DGtal/helpers/Shortcuts.h>
30#include <DGtal/helpers/ShortcutsGeometry.h>
31#include <DGtal/shapes/SurfaceMesh.h>
32#include <DGtal/geometry/surfaces/DigitalSurfaceRegularization.h>
33#include <DGtal/dec/PolygonalCalculus.h>
34#include <DGtal/math/linalg/DirichletConditions.h>
36#include <polyscope/polyscope.h>
37#include <polyscope/surface_mesh.h>
38#include <polyscope/point_cloud.h>
42#include <Eigen/Sparse>
66 DC::IntegerVector b = DC::IntegerVector::Zero( g.rows() );
70 std::cout<<
"Number of boundary edges= "<<boundaryEdges.size()<<std::endl;
74 for(
auto &e: boundaryEdges)
77 g(adjVertices.first) = pihVertex(adjVertices.first);
78 g(adjVertices.second) = pihVertex(adjVertices.second);
79 b(adjVertices.first) = 1;
80 b(adjVertices.second) = 1;
84 PolyDEC::Solver solver;
85 PolyDEC::SparseMatrix L_dirichlet = DC::dirichletOperator( L, b );
86 solver.compute( L_dirichlet );
87 ASSERT(solver.info()==Eigen::Success);
88 PolyDEC::Form g_dirichlet = DC::dirichletVector( L, g, b, g );
89 PolyDEC::Form x_dirichlet = solver.solve( g_dirichlet );
90 PolyDEC::Form u = DC::dirichletSolution( x_dirichlet, b, g );
93 psMesh->addVertexScalarQuantity(
"g", g);
94 psMesh->addVertexScalarQuantity(
"u", u);
99 ImGui::SliderFloat(
"Phi scale", &scale, 0., 10.);
100 if(ImGui::Button(
"Compute Laplace problem"))
109 params(
"polynomial",
"0.1*y*y -0.1*x*x - 2.0*z" )(
"gridstep", h );
118 std::vector<std::vector<SH3::SurfaceMesh::Vertex>> faces;
119 std::vector<RealPoint> positions = primalSurface->positions();
120 for(
auto face= 0 ; face < primalSurface->nbFaces(); ++face)
121 faces.push_back(primalSurface->incidentVertices( face ));
127 psMesh = polyscope::registerSurfaceMesh(
"digital surface", positions, faces);
Aim: A helper class to solve a system with Dirichlet boundary conditions.
Implements differential operators on polygonal surfaces from degoes2020discrete.
SparseMatrix globalLaplaceBeltrami(const double lambda=1.0) const
Aim: This class is used to simplify shape and surface creation. With it, you can create new shapes an...
static Parameters parametersGeometryEstimation()
static Parameters defaultParameters()
Aim: This class is used to simplify shape and surface creation. With it, you can create new shapes an...
static KSpace getKSpace(const Point &low, const Point &up, Parameters params=parametersKSpace())
static CountedPtr< DigitizedImplicitShape3D > makeDigitizedImplicitShape3D(CountedPtr< ImplicitShape3D > shape, Parameters params=parametersDigitizedImplicitShape3D())
static CountedPtr< DigitalSurface > makeDigitalSurface(CountedPtr< TPointPredicate > bimage, const KSpace &K, const Parameters ¶ms=parametersDigitalSurface())
static Parameters defaultParameters()
static CountedPtr< SurfaceMesh > makePrimalSurfaceMesh(Cell2Index &c2i, CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface)
static CountedPtr< BinaryImage > makeBinaryImage(Domain shapeDomain)
static CountedPtr< ImplicitShape3D > makeImplicitShape3D(const Parameters ¶ms=parametersImplicitShape3D())
CountedPtr< SH3::DigitalSurface > surface
CountedPtr< SH3::BinaryImage > binary_image
SurfaceMesh< RealPoint, RealVector > SurfMesh
polyscope::SurfaceMesh * psMesh
Shortcuts< Z3i::KSpace > SH3
ShortcutsGeometry< Z3i::KSpace > SHG3
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: Represents an embedded mesh as faces and a list of vertices. Vertices may be shared among faces ...
Edges computeManifoldBoundaryEdges() const
VertexPair edgeVertices(Edge e) const
RealPoint & position(Vertex v)