@@ -6397,13 +6397,14 @@ namespace GEO {
63976397 void ProgressTask::next() {
63986398 step_++;
63996399 step_ = std::min(step_, max_steps_);
6400- update();
6400+ update();
64016401 }
64026402
64036403 void ProgressTask::progress(index_t step) {
64046404 if(step_ != step) {
64056405 step_ = step;
6406- update();
6406+ step_ = std::min(step_, max_steps_);
6407+ update();
64076408 }
64086409 }
64096410
@@ -6412,10 +6413,14 @@ namespace GEO {
64126413 }
64136414
64146415 void ProgressTask::update() {
6415- percent_ = std::min(index_t(100), index_t(step_ * 100 / max_steps_));
6416- if(!quiet_) {
6417- task_progress(step_, percent_);
6418- }
6416+ index_t new_percent =
6417+ std::min(index_t(100), index_t(step_ * 100 / max_steps_));
6418+ if(new_percent != percent_) {
6419+ percent_ = new_percent;
6420+ if(!quiet_) {
6421+ task_progress(step_, percent_);
6422+ }
6423+ }
64196424 }
64206425}
64216426
@@ -19461,7 +19466,7 @@ namespace {
1946119466
1946219467 return (det > epsval) * -1 + (det < -epsval);
1946319468 }
19464-
19469+
1946519470#endif
1946619471
1946719472 inline int in_sphere_3d_filter_optim(
@@ -27711,6 +27716,7 @@ namespace {
2771127716 void push(ushort val) {
2771227717 ++index_;
2771327718 vbw_assert(index_ < capacity_);
27719+ (void)capacity_; // To silence a warning.
2771427720 buffer_[index_] = val;
2771527721 }
2771627722
@@ -28136,19 +28142,19 @@ namespace VBW {
2813628142 return;
2813728143 }
2813828144
28139- auto triangle_distance = [this](index_t t , vec4 P ) {
28140- Triangle T = get_triangle(t );
28145+ auto triangle_distance = [this](index_t t_in , vec4 P_in ) {
28146+ Triangle T = get_triangle(t_in );
2814128147 vbw_assert(T.i != VERTEX_AT_INFINITY);
2814228148 vbw_assert(T.j != VERTEX_AT_INFINITY);
2814328149 vbw_assert(T.k != VERTEX_AT_INFINITY);
2814428150 vec4 p1 = vertex_plane(T.i);
2814528151 vec4 p2 = vertex_plane(T.j);
2814628152 vec4 p3 = vertex_plane(T.k);
2814728153 return det4x4(
28148- p1.x, p2.x, p3.x, P .x,
28149- p1.y, p2.y, p3.y, P .y,
28150- p1.z, p2.z, p3.z, P .z,
28151- p1.w, p2.w, p3.w, P .w
28154+ p1.x, p2.x, p3.x, P_in .x,
28155+ p1.y, p2.y, p3.y, P_in .y,
28156+ p1.z, p2.z, p3.z, P_in .z,
28157+ p1.w, p2.w, p3.w, P_in .w
2815228158 );
2815328159 };
2815428160
@@ -28915,7 +28921,9 @@ namespace {
2891528921 }
2891628922
2891728923 inline index_t pop_count(index_t x) {
28918- static_assert(sizeof(index_t) == 4, "Only supported with 32 bit indices");
28924+ static_assert(
28925+ sizeof(index_t) == 4, "Only supported with 32 bit indices"
28926+ );
2891928927#if defined(GEO_COMPILER_GCC_FAMILY)
2892028928 return index_t(__builtin_popcount(x));
2892128929#elif defined(GEO_COMPILER_MSVC)
@@ -28982,7 +28990,9 @@ namespace GEO {
2898228990
2898328991 }
2898428992
28985- void set_pool(index_t pool_begin, index_t pool_end, index_t max_used_t = 1) {
28993+ void set_pool(
28994+ index_t pool_begin, index_t pool_end, index_t max_used_t = 1
28995+ ) {
2898628996 // Initialize free list in memory pool
2898728997 first_free_ = pool_begin;
2898828998 for(index_t t=pool_begin; t<pool_end-1; ++t) {
@@ -29172,7 +29182,7 @@ namespace GEO {
2917229182 finite_tet_vertex(t,0) < nb_vertices_non_periodic_ ||
2917329183 finite_tet_vertex(t,1) < nb_vertices_non_periodic_ ||
2917429184 finite_tet_vertex(t,2) < nb_vertices_non_periodic_ ||
29175- finite_tet_vertex(t,3) < nb_vertices_non_periodic_ ) ;
29185+ finite_tet_vertex(t,3) < nb_vertices_non_periodic_ ) ;
2917629186 }
2917729187
2917829188 bool tet_is_free(index_t t) const {
@@ -29312,7 +29322,9 @@ namespace GEO {
2931229322 signed_index_t v3 = cavity_.facet_vertex(f,2);
2931329323 new_tet = new_tetrahedron(signed_index_t(v), v1, v2, v3);
2931429324 set_tet_adjacent(new_tet, 0, t_neigh);
29315- set_tet_adjacent(t_neigh, find_tet_adjacent(t_neigh,old_tet), new_tet);
29325+ set_tet_adjacent(
29326+ t_neigh, find_tet_adjacent(t_neigh,old_tet), new_tet
29327+ );
2931629328 cavity_.set_facet_tet(f, new_tet);
2931729329 }
2931829330
@@ -29669,7 +29681,8 @@ namespace GEO {
2966929681 vec4 lifted_vertex(index_t v, const vec3& p) {
2967029682 return vec4(
2967129683 p.x, p.y, p.z,
29672- geo_sqr(p.x) + geo_sqr(p.y) + geo_sqr(p.z) - non_periodic_weight(periodic_vertex_real(v))
29684+ geo_sqr(p.x) + geo_sqr(p.y) + geo_sqr(p.z)
29685+ - non_periodic_weight(periodic_vertex_real(v))
2967329686 );
2967429687 }
2967529688
@@ -29683,18 +29696,29 @@ namespace GEO {
2968329696 return PCK::orient_3d(V[0], V[1], V[2], V[3]);
2968429697 }
2968529698
29686- Sign in_circle_3dlifted_SOS(index_t i, index_t j, index_t k, index_t l) const {
29699+ Sign in_circle_3dlifted_SOS(
29700+ index_t i, index_t j, index_t k, index_t l
29701+ ) const {
2968729702
2968829703 // In non-periodic mode, directly access vertices.
2968929704 if(!periodic_) {
2969029705 const double* pi = non_periodic_vertex_ptr(i);
2969129706 const double* pj = non_periodic_vertex_ptr(j);
2969229707 const double* pk = non_periodic_vertex_ptr(k);
29693- const double* pl = non_periodic_vertex_ptr(l);
29694- double hi = geo_sqr(pi[0]) + geo_sqr(pi[1]) + geo_sqr(pi[2]) - non_periodic_weight(i);
29695- double hj = geo_sqr(pj[0]) + geo_sqr(pj[1]) + geo_sqr(pj[2]) - non_periodic_weight(j);
29696- double hk = geo_sqr(pk[0]) + geo_sqr(pk[1]) + geo_sqr(pk[2]) - non_periodic_weight(k);
29697- double hl = geo_sqr(pl[0]) + geo_sqr(pl[1]) + geo_sqr(pl[2]) - non_periodic_weight(l);
29708+ const double* pl = non_periodic_vertex_ptr(l);
29709+
29710+ double hi = geo_sqr(pi[0]) + geo_sqr(pi[1]) + geo_sqr(pi[2])
29711+ - non_periodic_weight(i);
29712+
29713+ double hj = geo_sqr(pj[0]) + geo_sqr(pj[1]) + geo_sqr(pj[2])
29714+ - non_periodic_weight(j);
29715+
29716+ double hk = geo_sqr(pk[0]) + geo_sqr(pk[1]) + geo_sqr(pk[2])
29717+ - non_periodic_weight(k);
29718+
29719+ double hl = geo_sqr(pl[0]) + geo_sqr(pl[1]) + geo_sqr(pl[2])
29720+ - non_periodic_weight(l);
29721+
2969829722 return PCK::in_circle_3dlifted_SOS(
2969929723 pi, pj, pk, pl,
2970029724 hi, hj, hk, hl
@@ -29713,7 +29737,9 @@ namespace GEO {
2971329737 );
2971429738 }
2971529739
29716- Sign orient_3dlifted_SOS(index_t i, index_t j, index_t k, index_t l, index_t m) const {
29740+ Sign orient_3dlifted_SOS(
29741+ index_t i, index_t j, index_t k, index_t l, index_t m
29742+ ) const {
2971729743
2971829744 // In non-periodic mode, directly access vertices.
2971929745 if(!periodic_) {
@@ -29722,11 +29748,22 @@ namespace GEO {
2972229748 const double* pk = non_periodic_vertex_ptr(k);
2972329749 const double* pl = non_periodic_vertex_ptr(l);
2972429750 const double* pm = non_periodic_vertex_ptr(m);
29725- double hi = geo_sqr(pi[0]) + geo_sqr(pi[1]) + geo_sqr(pi[2]) - non_periodic_weight(i);
29726- double hj = geo_sqr(pj[0]) + geo_sqr(pj[1]) + geo_sqr(pj[2]) - non_periodic_weight(j);
29727- double hk = geo_sqr(pk[0]) + geo_sqr(pk[1]) + geo_sqr(pk[2]) - non_periodic_weight(k);
29728- double hl = geo_sqr(pl[0]) + geo_sqr(pl[1]) + geo_sqr(pl[2]) - non_periodic_weight(l);
29729- double hm = geo_sqr(pm[0]) + geo_sqr(pm[1]) + geo_sqr(pm[2]) - non_periodic_weight(m);
29751+
29752+ double hi = geo_sqr(pi[0]) + geo_sqr(pi[1]) + geo_sqr(pi[2])
29753+ - non_periodic_weight(i);
29754+
29755+ double hj = geo_sqr(pj[0]) + geo_sqr(pj[1]) + geo_sqr(pj[2])
29756+ - non_periodic_weight(j);
29757+
29758+ double hk = geo_sqr(pk[0]) + geo_sqr(pk[1]) + geo_sqr(pk[2])
29759+ - non_periodic_weight(k);
29760+
29761+ double hl = geo_sqr(pl[0]) + geo_sqr(pl[1]) + geo_sqr(pl[2])
29762+ - non_periodic_weight(l);
29763+
29764+ double hm = geo_sqr(pm[0]) + geo_sqr(pm[1]) + geo_sqr(pm[2])
29765+ - non_periodic_weight(m);
29766+
2973029767 return PCK::orient_3dlifted_SOS(
2973129768 pi, pj, pk, pl, pm,
2973229769 hi, hj, hk, hl, hm
@@ -30353,7 +30390,9 @@ namespace GEO {
3035330390 // v needs to be a real vertex.
3035430391 geo_debug_assert(periodic_vertex_instance(v) == 0);
3035530392
30356- geo_debug_assert(T[0] != -1 && T[1] != -1 && T[2] != -1 && T[3] != -1);
30393+ geo_debug_assert(
30394+ T[0] != -1 && T[1] != -1 && T[2] != -1 && T[3] != -1
30395+ );
3035730396
3035830397 // The following expression is 10% faster than using
3035930398 // if() statements. This uses the C++ norm, that
@@ -30521,9 +30560,10 @@ namespace GEO {
3052130560
3052230561 index_t tbord = index_t(tet_adjacent(t1,t1fbord));
3052330562
30524- // We generate the tetrahedron with the three vertices of the tet outside
30525- // the conflict zone and the newly created vertex in the local frame of the
30526- // tet outside the conflict zone.
30563+ // We generate the tetrahedron with the three vertices
30564+ // of the tet outside the conflict zone and the newly
30565+ // created vertex in the local frame of the tet outside
30566+ // the conflict zone.
3052730567
3052830568 // Replace in new_t the vertex opposite to t1fbord with v
3052930569 set_tet_vertex(new_t, t1fbord, v);
@@ -31454,10 +31494,13 @@ namespace GEO {
3145431494 index_t v_real = periodic_vertex_real(v);
3145531495 index_t v_instance = periodic_vertex_instance(v);
3145631496
31457- geo_debug_assert((vertex_instances_[v_real] & (1u << v_instance))!=0);
31497+ geo_debug_assert(
31498+ (vertex_instances_[v_real] &
31499+ (1u << v_instance))!=0
31500+ );
3145831501
3145931502 index_t slot = pop_count(
31460- vertex_instances_[v_real] & ((1u << v_instance)-1)
31503+ vertex_instances_[v_real] & ((1u << v_instance)-1)
3146131504 ) - 1;
3146231505
3146331506 periodic_v_to_cell_data_[
@@ -31538,7 +31581,9 @@ namespace GEO {
3153831581 is_locked_ = false;
3153931582 }
3154031583
31541- void PeriodicDelaunay3d::get_incident_tets(index_t v, IncidentTetrahedra& W) const {
31584+ void PeriodicDelaunay3d::get_incident_tets(
31585+ index_t v, IncidentTetrahedra& W
31586+ ) const {
3154231587
3154331588 geo_debug_assert(
3154431589 periodic_ || v < nb_vertices_non_periodic_
@@ -31553,7 +31598,9 @@ namespace GEO {
3155331598 index_t v_real = periodic_vertex_real(v);
3155431599 index_t v_instance = periodic_vertex_instance(v);
3155531600
31556- geo_debug_assert((vertex_instances_[v_real] & (1u << v_instance))!=0);
31601+ geo_debug_assert(
31602+ (vertex_instances_[v_real] & (1u << v_instance))!=0
31603+ );
3155731604
3155831605 index_t slot = pop_count(
3155931606 vertex_instances_[v_real] & ((1u << v_instance)-1)
@@ -31577,7 +31624,9 @@ namespace GEO {
3157731624 t = W.S.top();
3157831625 W.S.pop();
3157931626 const signed_index_t* T = &(cell_to_v_store_[4 * t]);
31580- index_t lv = PeriodicDelaunay3dThread::find_4(T,signed_index_t(v));
31627+ index_t lv = PeriodicDelaunay3dThread::find_4(
31628+ T,signed_index_t(v)
31629+ );
3158131630 index_t neigh = index_t(cell_to_cell_store_[4*t + (lv + 1)%4]);
3158231631 if(neigh != index_t(-1) && !W.has_incident_tet(neigh)) {
3158331632 W.add_incident_tet(neigh);
@@ -31911,9 +31960,16 @@ namespace GEO {
3191131960 for(int dU=0; dU<2; ++dU) {
3191231961 for(int dV=0; dV<2; ++dV) {
3191331962 for(int dW=0; dW<2; ++dW) {
31914- int Tx = dU*VXLAT[0][0] + dV*VXLAT[1][0] + dW*VXLAT[2][0];
31915- int Ty = dU*VXLAT[0][1] + dV*VXLAT[1][1] + dW*VXLAT[2][1];
31916- int Tz = dU*VXLAT[0][2] + dV*VXLAT[1][2] + dW*VXLAT[2][2];
31963+
31964+ int Tx = dU*VXLAT[0][0] + dV*VXLAT[1][0] +
31965+ dW*VXLAT[2][0];
31966+
31967+ int Ty = dU*VXLAT[0][1] + dV*VXLAT[1][1] +
31968+ dW*VXLAT[2][1];
31969+
31970+ int Tz = dU*VXLAT[0][2] + dV*VXLAT[1][2] +
31971+ dW*VXLAT[2][2];
31972+
3191731973 use_instance[T_to_instance(Tx,Ty,Tz)] = true;
3191831974 }
3191931975 }
@@ -31982,13 +32038,15 @@ namespace GEO {
3198232038 bool cell_is_outside_cube = false;
3198332039
3198432040 // Determines the periodic vertices to create, that is,
31985- // whenever the cell of the current vertex has an intersection
31986- // with one of the 27 cubes, an instance needs to be created there.
31987- index_t nb_instances = get_periodic_vertex_instances_to_create(
31988- v, C, use_instance,
31989- cell_is_on_boundary, cell_is_outside_cube,
31990- W
31991- );
32041+ // whenever the cell of the current vertex has an
32042+ // intersection with one of the 27 cubes, an instance
32043+ // needs to be created there.
32044+ index_t nb_instances =
32045+ get_periodic_vertex_instances_to_create(
32046+ v, C, use_instance,
32047+ cell_is_on_boundary, cell_is_outside_cube,
32048+ W
32049+ );
3199232050
3199332051
3199432052 Process::acquire_spinlock(lock);
@@ -32008,7 +32066,9 @@ namespace GEO {
3200832066 for(index_t instance=1; instance<27; ++instance) {
3200932067 if(use_instance[instance]) {
3201032068 vertex_instances_[v] |= (1u << instance);
32011- reorder_.push_back(make_periodic_vertex(v,instance));
32069+ reorder_.push_back(
32070+ make_periodic_vertex(v,instance)
32071+ );
3201232072 }
3201332073 }
3201432074 }
@@ -32070,7 +32130,8 @@ namespace GEO {
3207032130 index_t wp = index_t(cell_vertex(t,lv));
3207132131 if(wp != vp && wp != index_t(-1)) {
3207232132 index_t w = periodic_vertex_real(wp);
32073- index_t w_instance = periodic_vertex_instance(wp);
32133+ index_t w_instance =
32134+ periodic_vertex_instance(wp);
3207432135 int wTx = translation[w_instance][0];
3207532136 int wTy = translation[w_instance][1];
3207632137 int wTz = translation[w_instance][2];
@@ -32082,15 +32143,23 @@ namespace GEO {
3208232143 Ty < -1 || Ty > 1 ||
3208332144 Tz < -1 || Tz > 1
3208432145 ) {
32085- std::cerr << "FATAL ERROR: large displacement !!"
32086- << std::endl;
32146+ std::cerr
32147+ << "FATAL ERROR: "
32148+ << "large displacement !!"
32149+ << std::endl;
3208732150 geo_assert_not_reached;
3208832151 } else {
32089- index_t w_new_instance = T_to_instance(Tx, Ty, Tz);
32090- if((vertex_instances[w] & (1u << w_new_instance)) == 0) {
32091- vertex_instances[w] |= (1u << w_new_instance);
32152+ index_t w_new_instance =
32153+ T_to_instance(Tx, Ty, Tz);
32154+ if((vertex_instances[w] &
32155+ (1u << w_new_instance)) == 0
32156+ ) {
32157+ vertex_instances[w] |=
32158+ (1u << w_new_instance);
3209232159 reorder_.push_back(
32093- make_periodic_vertex(w, w_new_instance)
32160+ make_periodic_vertex(
32161+ w, w_new_instance
32162+ )
3209432163 );
3209532164 }
3209632165 }
@@ -32099,7 +32168,7 @@ namespace GEO {
3209932168 }
3210032169 }
3210132170 }
32102- }
32171+ } // No, seriously ... 8 closing braces ...
3210332172 std::swap(vertex_instances_, vertex_instances);
3210432173 insert_vertices(nb_vertices_phase_I, reorder_.size());
3210532174 }
0 commit comments