SemiDiscreteOT 1.0
Semi-Discrete Optimal Transport Library
Loading...
Searching...
No Matches
ExactSot.h
Go to the documentation of this file.
1#pragma once
2
3#include <deal.II/base/point.h>
4#include <deal.II/lac/vector.h>
6#include <geogram/basic/common.h>
7#include <geogram/basic/logger.h>
8#include <geogram/basic/command_line.h>
9#include <geogram/basic/command_line_args.h>
10#include <geogram/basic/stopwatch.h>
11#include <geogram/basic/file_system.h>
12#include <geogram/basic/process.h>
13#include <geogram/basic/progress.h>
14#include <geogram/mesh/mesh.h>
15#include <geogram/mesh/mesh_io.h>
16#include <geogram/mesh/mesh_tetrahedralize.h>
17#include <geogram/voronoi/CVT.h>
18#include <exploragram/optimal_transport/optimal_transport_3d.h>
19#include <exploragram/optimal_transport/sampling.h>
20#include <memory>
21#include <fstream>
22#include <stdexcept>
23#include <iostream>
24#include <string>
25#include <vector>
26
27// Forward declarations for Geogram types
28namespace GEO {
29 class Mesh;
30 class OptimalTransportMap3d;
31}
32
39class ExactSot {
40public:
44 ExactSot();
45
50
51 // Delete copy operations due to unique GEO::Mesh ownership
52 ExactSot(const ExactSot&) = delete;
53 ExactSot& operator=(const ExactSot&) = delete;
54
60 bool set_source_mesh(const std::string& filename);
61
67 bool set_target_points(const std::string& filename, const std::string& io_coding);
68
74 void set_parameters(unsigned int max_iterations = 1000,
75 double epsilon = 0.01);
76
81 bool run();
82
87 std::vector<double> get_potential() const;
88
93 std::vector<dealii::Point<3>> get_target_points() const;
94
102 bool save_results(const std::string& potential_file,
103 const std::string& points_file,
104 const std::string& io_coding = "txt") const;
105
106private:
107 // Helper function to load volume mesh
108 bool load_volume_mesh(const std::string& filename, GEO::Mesh& mesh);
109
110 // Member variables
111 std::unique_ptr<GEO::Mesh> source_mesh;
112 GEO::vector<double> potential;
113 std::vector<dealii::Point<3>> target_points;
114
115 // Parameters
116 unsigned int max_iterations_;
117 double epsilon_;
118};
Class to handle exact semi-discrete optimal transport using Geogram.
Definition ExactSot.h:39
std::vector< double > get_potential() const
Get computed potential.
Definition ExactSot.cc:153
ExactSot()
Constructor.
Definition ExactSot.cc:4
ExactSot(const ExactSot &)=delete
double epsilon_
Definition ExactSot.h:117
std::vector< dealii::Point< 3 > > target_points
Definition ExactSot.h:113
bool set_source_mesh(const std::string &filename)
Set source mesh from file.
Definition ExactSot.cc:79
bool save_results(const std::string &potential_file, const std::string &points_file, const std::string &io_coding="txt") const
Save computation results to files.
Definition ExactSot.cc:161
void set_parameters(unsigned int max_iterations=1000, double epsilon=0.01)
Set parameters for the solver.
Definition ExactSot.cc:87
GEO::vector< double > potential
Definition ExactSot.h:112
bool set_target_points(const std::string &filename, const std::string &io_coding)
Set target points from file.
Definition ExactSot.cc:83
bool load_volume_mesh(const std::string &filename, GEO::Mesh &mesh)
Definition ExactSot.cc:52
unsigned int max_iterations_
Definition ExactSot.h:116
bool run()
Run the exact SOT computation.
Definition ExactSot.cc:93
std::unique_ptr< GEO::Mesh > source_mesh
Definition ExactSot.h:111
std::vector< dealii::Point< 3 > > get_target_points() const
Get target points.
Definition ExactSot.cc:157
ExactSot & operator=(const ExactSot &)=delete
~ExactSot()
Destructor.