Skip to content

Commit 7f70dfc

Browse files
committed
[geogram] Update to 1.4.10
1 parent 4236015 commit 7f70dfc

File tree

176 files changed

+97068
-2005
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+97068
-2005
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ include(cmake/geogram.cmake)
3939

4040
set(VORPALINE_VERSION_MAJOR 1)
4141
set(VORPALINE_VERSION_MINOR 4)
42-
set(VORPALINE_VERSION_PATCH 9)
42+
set(VORPALINE_VERSION_PATCH 10)
4343
set(VORPALINE_VERSION ${VORPALINE_VERSION_MAJOR}.${VORPALINE_VERSION_MINOR}.${VORPALINE_VERSION_PATCH})
4444

4545
set(VORPALINE_INCLUDE_SUBPATH geogram${VORPALINE_VERSION_MAJOR})

CMakeLists.txt.rej

Lines changed: 0 additions & 11 deletions
This file was deleted.

imgui.ini

Lines changed: 0 additions & 30 deletions
This file was deleted.

out.meshb

-1.37 MB
Binary file not shown.

snap.ppm

Lines changed: 0 additions & 1546 deletions
This file was deleted.

src/bin/geocod/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ namespace {
202202
if(!lua_error_occured_ && init_graphics_called_) {
203203
exec_command("GLUP.init_graphics()");
204204
}
205+
glup_viewer_enable(GLUP_VIEWER_IDLE_REDRAW);
205206
}
206207

207208
/**

src/lib/exploragram/optimal_transport/optimal_transport.cpp

Lines changed: 69 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ namespace GEO {
106106
}
107107

108108
newton_ = false;
109-
verbose_ = false;
109+
verbose_ = true;
110110

111111
instance_ = nil;
112112
lambda_p_ = 0.0;
@@ -153,10 +153,6 @@ namespace GEO {
153153
lambda_p_ = total_mass_ / double(nb_points);
154154
}
155155

156-
// See http://arxiv.org/abs/1603.05579
157-
// Kitawaga, Merigot, Thibert,
158-
// A Newton Algorithm for semi-discrete OT
159-
160156
void OptimalTransportMap::optimize_full_Newton(
161157
index_t max_iterations, index_t n
162158
) {
@@ -174,7 +170,9 @@ namespace GEO {
174170
w_did_not_change_ = false;
175171

176172
for(index_t k=0; k<max_iterations; ++k) {
177-
std::cerr << "======= k = " << k << std::endl;
173+
if(verbose_) {
174+
std::cerr << "======= k = " << k << std::endl;
175+
}
178176
xk=weights_;
179177

180178
new_linear_system(n);
@@ -187,20 +185,26 @@ namespace GEO {
187185
if(epsilon0 == 0.0) {
188186
epsilon0 = 0.5 * geo_min(measure_of_smallest_cell_, lambda_p_);
189187
}
190-
191-
Logger::out("OTM") << " Solving linear system" << std::endl;
188+
189+
if(verbose_) {
190+
Logger::out("OTM") << " Solving linear system" << std::endl;
191+
}
192192

193193
solve_linear_system(pk.data());
194194

195-
std::cerr << "Line search ..." << std::endl;
195+
if(verbose_) {
196+
std::cerr << "Line search ..." << std::endl;
197+
}
196198

197199
w_did_not_change_ = false;
198200

199201
double alphak = 1.0;
200202
double gknorm = g_norm_;
201203

202204
for(index_t inner_iter=0; inner_iter < 100; ++inner_iter) {
203-
std::cerr << " inner iter = " << inner_iter << std::endl;
205+
if(verbose_) {
206+
std::cerr << " inner iter = " << inner_iter << std::endl;
207+
}
204208

205209
// weights = xk + alphak pk
206210
for(index_t i=0; i<n; ++i) {
@@ -217,13 +221,15 @@ namespace GEO {
217221
if(Laguerre_centroids_ != nil) {
218222
callback_->set_Laguerre_centroids(nil);
219223
}
220-
221-
std::cerr << "cell measure :"
222-
<< measure_of_smallest_cell_
223-
<< "(>=?)" << epsilon0 << std::endl;
224-
std::cerr << "gradient norm:"
225-
<< g_norm_ << "(<=?)"
226-
<< (1.0 - 0.5*alphak) * gknorm << std::endl;
224+
225+
if(verbose_) {
226+
std::cerr << "cell measure :"
227+
<< measure_of_smallest_cell_
228+
<< "(>=?)" << epsilon0 << std::endl;
229+
std::cerr << "gradient norm:"
230+
<< g_norm_ << "(<=?)"
231+
<< (1.0 - 0.5*alphak) * gknorm << std::endl;
232+
}
227233
if(
228234
(measure_of_smallest_cell_ >= epsilon0) &&
229235
(g_norm_ <= (1.0 - 0.5*alphak) * gknorm)
@@ -282,8 +288,10 @@ namespace GEO {
282288
// To make sure everything is reset properly
283289
double dummy = 0;
284290
funcgrad(n, weights_.data(), dummy, nil);
285-
Logger::out("OTM")
286-
<< "Used " << current_call_iter_ << " iterations" << std::endl;
291+
if(verbose_) {
292+
Logger::out("OTM")
293+
<< "Used " << current_call_iter_ << " iterations" << std::endl;
294+
}
287295
if(save_RVD_last_iter_) {
288296
save_RVD(current_iter_);
289297
}
@@ -378,12 +386,14 @@ namespace GEO {
378386
void OptimalTransportMap::optimize_levels(
379387
const vector<index_t>& levels, index_t max_iterations
380388
) {
381-
if(levels.size() > 2) {
382-
Logger::out("OTM") << "Using " << levels.size()-1
383-
<< " levels" << std::endl;
384-
} else {
385-
Logger::out("OTM") << "Using 1 level" << std::endl;
386-
}
389+
if(verbose_) {
390+
if(levels.size() > 2) {
391+
Logger::out("OTM") << "Using " << levels.size()-1
392+
<< " levels" << std::endl;
393+
} else {
394+
Logger::out("OTM") << "Using 1 level" << std::endl;
395+
}
396+
}
387397
for(index_t l = 0; l + 1 < levels.size(); ++l) {
388398
level_ = l+1;
389399
index_t b = levels[l];
@@ -420,7 +430,9 @@ namespace GEO {
420430
void OptimalTransportMap::newiteration() {
421431
//xxx std::cerr << "newiteration" << std::endl;
422432
if(save_RVD_iter_) {
423-
std::cerr << " save iter" << std::endl;
433+
if(verbose_) {
434+
std::cerr << " save iter" << std::endl;
435+
}
424436
save_RVD(current_iter_);
425437
}
426438
++current_iter_;
@@ -466,11 +478,13 @@ namespace GEO {
466478
{
467479
Stopwatch* SW = nil;
468480
if(newton_) {
469-
SW = new Stopwatch("Power diagram");
470-
Logger::out("OTM") << "In power diagram..." << std::endl;
481+
if(verbose_) {
482+
SW = new Stopwatch("Power diagram");
483+
Logger::out("OTM") << "In power diagram..." << std::endl;
484+
}
471485
}
472486
delaunay_->set_vertices(n, points_dimp1_.data());
473-
if(newton_) {
487+
if(verbose_ && newton_) {
474488
delete SW;
475489
}
476490
}
@@ -505,12 +519,12 @@ namespace GEO {
505519

506520
{
507521
Stopwatch* W = nil;
508-
if(newton_) {
522+
if(verbose_ && newton_) {
509523
W = new Stopwatch("RVD");
510524
Logger::out("OTM") << "In RVD (funcgrad)..." << std::endl;
511525
}
512526
call_callback_on_RVD();
513-
if(newton_) {
527+
if(verbose_ && newton_) {
514528
delete W;
515529
}
516530
}
@@ -631,15 +645,17 @@ namespace GEO {
631645

632646
// "custom task progress" (clears the standard message
633647
// and replaces it with another one).
634-
if(pretty_log_) {
635-
if(current_call_iter_ != 0) {
636-
CmdLine::ui_clear_line();
637-
}
638-
CmdLine::ui_message(str.str());
639-
} else {
640-
str << " f=" << f;
641-
CmdLine::ui_message(str.str() + "\n");
642-
}
648+
if(verbose_) {
649+
if(pretty_log_) {
650+
if(current_call_iter_ != 0) {
651+
CmdLine::ui_clear_line();
652+
}
653+
CmdLine::ui_message(str.str());
654+
} else {
655+
str << " f=" << f;
656+
CmdLine::ui_message(str.str() + "\n");
657+
}
658+
}
643659
++current_call_iter_;
644660
}
645661

@@ -673,7 +689,9 @@ namespace GEO {
673689
nlInitExtension("SUPERLU");
674690
}
675691

676-
nlEnable(NL_VERBOSE);
692+
if(verbose_) {
693+
nlEnable(NL_VERBOSE);
694+
}
677695

678696
nlSolverParameteri(NL_NB_VARIABLES, NLint(n));
679697
if(use_SUPERLU) {
@@ -704,14 +722,16 @@ namespace GEO {
704722
nlGetIntegerv(NL_USED_ITERATIONS, &used_iters);
705723
nlGetDoublev(NL_ELAPSED_TIME, &elapsed_time);
706724
nlGetDoublev(NL_GFLOPS, &gflops);
707-
nlGetDoublev(NL_ERROR, &error);
708-
std::cerr << " "
709-
<< used_iters << " iters in "
710-
<< elapsed_time << " seconds "
711-
<< gflops << " GFlop/s"
712-
<< " ||Ax-b||/||b||="
713-
<< error
714-
<< std::endl;
725+
nlGetDoublev(NL_ERROR, &error);
726+
if(verbose_) {
727+
std::cerr << " "
728+
<< used_iters << " iters in "
729+
<< elapsed_time << " seconds "
730+
<< gflops << " GFlop/s"
731+
<< " ||Ax-b||/||b||="
732+
<< error
733+
<< std::endl;
734+
}
715735
}
716736
for(NLint i=0; i<n; ++i) {
717737
x[i] = nlGetVariable(NLuint(i));

src/lib/exploragram/optimal_transport/optimal_transport.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,21 @@ namespace GEO {
164164
*/
165165
void optimize(index_t max_iterations);
166166

167+
/**
168+
* \brief Enable/disable messages during optimization.
169+
* \param[in] x true if messages should be displayed, false
170+
* otherwise.
171+
*/
172+
void set_verbose(bool x) {
173+
verbose_ = x;
174+
}
175+
167176
/**
168177
* \brief Computes the weights that realize the optimal
169178
* transport map between the source mesh and the target
170179
* pointset.
180+
* \details The algorithm is described in http://arxiv.org/abs/1603.05579
181+
* Kitawaga, Merigot, Thibert, A Newton Algorithm for semi-discrete OT.
171182
* \param[in] max_iterations maximum number of solver iterations.
172183
* \param[in] n number of weights to optimize, used in hierarchical
173184
* mode. If zero, optimizes all the weights.

src/lib/exploragram/optimal_transport/optimal_transport_2d.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,8 @@ namespace GEO {
358358
const double* points,
359359
double* centroids,
360360
bool parallel_pow,
361-
Mesh* RVD
361+
Mesh* RVD,
362+
bool verbose
362363
) {
363364
geo_argused(parallel_pow); // Not implemented yet.
364365

@@ -381,6 +382,7 @@ namespace GEO {
381382
OTM.set_points(nb_points, points);
382383
OTM.set_epsilon(0.01);
383384
OTM.set_Laguerre_centroids(centroids);
385+
OTM.set_verbose(verbose);
384386
OTM.optimize(1000);
385387

386388
if(RVD != nil) {

src/lib/exploragram/optimal_transport/optimal_transport_2d.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ namespace GEO {
6969
const double* points,
7070
double* centroids,
7171
bool parallel_pow=true,
72-
Mesh* RVD=nil
72+
Mesh* RVD=nil,
73+
bool verbose=false
7374
);
7475

7576
/**

0 commit comments

Comments
 (0)