Skip to content

Commit 5e6f3d4

Browse files
committed
Merge branch 'skarasov-code_clean'
2 parents 0bc96ef + 533d71f commit 5e6f3d4

21 files changed

+111
-118
lines changed

src/TreeSupport.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ void TreeSupport::generateSupportAreas(SliceDataStorage& storage)
4949
group_settings.get<bool>("support_enable")&&
5050
group_settings.get<ESupportStructure>("support_structure") == ESupportStructure::TREE;
5151

52-
if (!(global_use_tree_support ||
52+
if (!(global_use_tree_support ||
5353
std::any_of(storage.meshes.cbegin(),
5454
storage.meshes.cend(),
55-
[](const SliceMeshStorage& m) {
55+
[](const SliceMeshStorage& m) {
5656
return m.settings.get<bool>("support_enable") &&
5757
m.settings.get<ESupportStructure>("support_structure") == ESupportStructure::TREE;
5858
})))
@@ -284,7 +284,7 @@ void TreeSupport::dropNodes(std::vector<std::vector<Node*>>& contact_nodes)
284284
for (const std::unordered_map<Point, Node*>& group : nodes_per_part)
285285
{
286286
std::vector<Point> points_to_buildplate;
287-
for (const std::pair<Point, Node*>& entry : group)
287+
for (const std::pair<const Point, Node*>& entry : group)
288288
{
289289
points_to_buildplate.emplace_back(entry.first); //Just the position of the node.
290290
}
@@ -296,7 +296,7 @@ void TreeSupport::dropNodes(std::vector<std::vector<Node*>>& contact_nodes)
296296
const MinimumSpanningTree& mst = spanning_trees[group_index];
297297
//In the first pass, merge all nodes that are close together.
298298
std::unordered_set<Node*> to_delete;
299-
for (const std::pair<Point, Node*>& entry : nodes_per_part[group_index])
299+
for (const std::pair<const Point, Node*>& entry : nodes_per_part[group_index])
300300
{
301301
Node* p_node = entry.second;
302302
Node& node = *p_node;
@@ -359,7 +359,7 @@ void TreeSupport::dropNodes(std::vector<std::vector<Node*>>& contact_nodes)
359359
}
360360
}
361361
//In the second pass, move all middle nodes.
362-
for (const std::pair<Point, Node*>& entry : nodes_per_part[group_index])
362+
for (const std::pair<const Point, Node*>& entry : nodes_per_part[group_index])
363363
{
364364
Node* p_node = entry.second;
365365
const Node& node = *p_node;
@@ -418,7 +418,7 @@ void TreeSupport::dropNodes(std::vector<std::vector<Node*>>& contact_nodes)
418418
return branch_radius + branch_radius * (node.distance_to_top + 1) * diameter_angle_scale_factor;
419419
}
420420
else
421-
{
421+
{
422422
return branch_radius * (node.distance_to_top + 1) / tip_layers;
423423
}
424424
}();
@@ -448,7 +448,7 @@ void TreeSupport::dropNodes(std::vector<std::vector<Node*>>& contact_nodes)
448448
to_free_node_set.insert(*to_erase);
449449
contact_nodes[i_layer].erase(to_erase);
450450
to_free_node_set.insert(i_node);
451-
451+
452452
for (Node* neighbour : i_node->merged_neighbours)
453453
{
454454
unsupported_branch_leaves.push_front({ i_layer, neighbour });

src/infill/ImageBasedDensityProvider.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,6 @@ float ImageBasedDensityProvider::operator()(const AABB3D& query_cube) const
9292
}
9393
}
9494
return 1.0f - ((float)total_lightness) / value_count / 255.0f;
95-
};
95+
}
9696

97-
}; // namespace cura
97+
} // namespace cura

src/infill/SierpinskiFill.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void SierpinskiFill::createTree()
7373

7474
// calculate node statistics
7575
createTreeStatistics(root);
76-
76+
7777
createTreeRequestedLengths(root);
7878
}
7979

@@ -142,7 +142,7 @@ void SierpinskiFill::createTreeRequestedLengths(SierpinskiTriangle& triangle)
142142
for (SierpinskiTriangle& child : triangle.children)
143143
{
144144
createTreeRequestedLengths(child);
145-
145+
146146
triangle.requested_length += child.requested_length;
147147
triangle.total_child_realized_length += child.realized_length;
148148
}
@@ -244,9 +244,9 @@ bool SierpinskiFill::subdivideAll()
244244
bool SierpinskiFill::bubbleUpConstraintErrors()
245245
{
246246
std::vector<std::vector<std::list<SierpinskiTriangle*>::iterator>> depth_ordered = getDepthOrdered();
247-
247+
248248
bool redistributed_anything = false;
249-
249+
250250
for (int depth = max_depth; depth >= 0; depth--)
251251
{
252252
std::vector<std::list<SierpinskiTriangle*>::iterator>& depth_nodes = depth_ordered[depth];
@@ -312,7 +312,7 @@ std::list<SierpinskiFill::SierpinskiTriangle*>::iterator SierpinskiFill::subdivi
312312

313313
}
314314
if (redistribute_errors && deep_debug_checking) debugCheck(false);
315-
315+
316316
std::list<SierpinskiFill::SierpinskiTriangle*>::iterator first_child_it = std::prev(begin);
317317
// the actual subdivision
318318
for (std::list<SierpinskiTriangle*>::iterator it = begin; it != end; ++it)
@@ -330,13 +330,13 @@ std::list<SierpinskiFill::SierpinskiTriangle*>::iterator SierpinskiFill::subdivi
330330
sequence.erase(begin, end);
331331

332332
if (redistribute_errors && deep_debug_checking) debugCheck(false);
333-
333+
334334
if (redistribute_errors)
335335
{ // make positive errors in children well balanced
336336
// Pass along error from parent
337337
balanceErrors(first_child_it, std::next(last_child_it));
338338
}
339-
339+
340340
if (redistribute_errors && deep_debug_checking) debugCheck();
341341

342342
return last_child_it;
@@ -431,7 +431,7 @@ void SierpinskiFill::balanceErrors(std::list<SierpinskiFill::SierpinskiTriangle*
431431
{
432432
return nodes[a]->getValueError() < nodes[b]->getValueError();
433433
});
434-
434+
435435
// add error to children with too low value
436436
float added = 0;
437437
unsigned int node_order_idx;
@@ -452,9 +452,9 @@ void SierpinskiFill::balanceErrors(std::list<SierpinskiFill::SierpinskiTriangle*
452452
{
453453
return;
454454
}
455-
455+
456456
// subtract the added value from remaining children
457-
// divide acquired negative balancing error among remaining nodes with positive value error
457+
// divide acquired negative balancing error among remaining nodes with positive value error
458458
float subtracted = 0;
459459
// divide up added among remaining children in ratio to their value error
460460
float total_remaining_value_error = 0;
@@ -466,13 +466,13 @@ void SierpinskiFill::balanceErrors(std::list<SierpinskiFill::SierpinskiTriangle*
466466
assert(val_err > -allowed_length_error);
467467
total_remaining_value_error += val_err;
468468
}
469-
469+
470470
if (total_remaining_value_error < added - allowed_length_error)
471471
{
472472
logWarning("total_remaining: %f should be > %f\n", total_remaining_value_error, added);
473473
assert(false);
474474
}
475-
475+
476476
if (std::abs(total_remaining_value_error) < .0001) //Error is insignificant.
477477
{
478478
return;
@@ -484,7 +484,7 @@ void SierpinskiFill::balanceErrors(std::list<SierpinskiFill::SierpinskiTriangle*
484484
SierpinskiTriangle* node = nodes[node_idx];
485485
float val_error = node->getValueError();
486486
assert(val_error > -allowed_length_error);
487-
487+
488488
float diff = added * val_error / total_remaining_value_error;
489489
subtracted += diff;
490490
node_error_compensation[node_idx] = -diff;
@@ -530,9 +530,9 @@ void SierpinskiFill::diffuseError()
530530
SierpinskiTriangle& triangle = *(*it);
531531

532532
float boundary = (triangle.realized_length + triangle.total_child_realized_length) * .5f;
533-
533+
534534
float nodal_value = ((use_errors_in_dithering)? triangle.getErroredValue() : triangle.requested_length);
535-
535+
536536
float boundary_error = nodal_value - boundary + error;
537537

538538
std::list<SierpinskiTriangle*>::iterator begin = it;
@@ -702,7 +702,7 @@ Polygon SierpinskiFill::generateCross() const
702702

703703
for (SierpinskiTriangle* max_level_it : sequence)
704704
{
705-
SierpinskiTriangle& triangle = *max_level_it;
705+
SierpinskiTriangle& triangle = *max_level_it;
706706
Point edge_middle = triangle.a + triangle.b + triangle.straight_corner;
707707
switch(triangle.dir)
708708
{
@@ -728,9 +728,9 @@ Polygon SierpinskiFill::generateCross() const
728728

729729
Polygon SierpinskiFill::generateCross(coord_t z, coord_t min_dist_to_side, coord_t pocket_size) const
730730
{
731-
731+
732732
Polygon ret;
733-
733+
734734
std::function<Point (int, Edge)> get_edge_crossing_location = [&ret, z, min_dist_to_side](int depth, Edge e)
735735
{
736736
coord_t period = 8 << (14 - depth / 2);
@@ -744,14 +744,14 @@ Polygon SierpinskiFill::generateCross(coord_t z, coord_t min_dist_to_side, coord
744744
from_l = std::min(vSize(e.l - e.r) - min_dist_to_side, from_l);
745745
return e.l + normal(e.r - e.l, from_l);
746746
};
747-
747+
748748
SierpinskiTriangle* last_triangle = nullptr;
749749
for (SierpinskiTriangle* node : sequence)
750750
{
751751
SierpinskiTriangle& triangle = *node;
752-
752+
753753
ret.add(get_edge_crossing_location(triangle.depth, triangle.getFromEdge()));
754-
754+
755755
last_triangle = &triangle;
756756
}
757757
assert(last_triangle);
@@ -836,4 +836,4 @@ void SierpinskiFill::debugCheck(bool check_subdivision)
836836
}
837837
}
838838

839-
}; // namespace cura
839+
} // namespace cura

src/infill/SierpinskiFillProvider.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,4 @@ SierpinskiFillProvider::FractalConfig SierpinskiFillProvider::getFractalConfig(c
8989

9090

9191

92-
}; // namespace cura
92+
} // namespace cura

src/layerPart.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void createLayerParts(SliceMeshStorage& mesh, Slicer* slicer)
9595

9696
// OpenMP compatibility fix for GCC <= 8 and GCC >= 9
9797
// See https://www.gnu.org/software/gcc/gcc-9/porting_to.html, section "OpenMP data sharing"
98-
#if defined(__GNUC__) && __GNUC__ <= 8
98+
#if defined(__GNUC__) && __GNUC__ <= 8 && !defined(__clang__)
9999
#pragma omp parallel for default(none) shared(mesh, slicer) schedule(dynamic)
100100
#else
101101
#pragma omp parallel for default(none) shared(mesh, slicer, total_layers) schedule(dynamic)

src/pathPlanning/Comb.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ void Comb::Crossing::findCrossingInOrMid(const PartsView& partsView_inside, cons
380380
{ // mid-case
381381
in_or_mid = dest_point;
382382
}
383-
};
383+
}
384384

385385
bool Comb::Crossing::findOutside(const Polygons& outside, const Point close_to, const bool fail_on_unavoidable_obstacles, Comb& comber)
386386
{

src/pathPlanning/CombPath.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66

77
#include "../utils/IntPoint.h"
88

9-
namespace cura
9+
namespace cura
1010
{
1111

12-
struct CombPath : public std::vector<Point> //!< A single path either inside or outise the parts
12+
class CombPath : public std::vector<Point> //!< A single path either inside or outise the parts
1313
{
14+
public:
1415
bool cross_boundary = false; //!< Whether the path crosses a boundary.
1516
};
1617

src/pathPlanning/CombPaths.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44

55
#include "CombPath.h"
66

7-
namespace cura
7+
namespace cura
88
{
99

10-
struct CombPaths : public std::vector<CombPath> //!< A list of paths alternating between inside a part and outside a part
10+
class CombPaths : public std::vector<CombPath> //!< A list of paths alternating between inside a part and outside a part
1111
{
12+
public:
1213
bool throughAir = false; //!< Whether the path is one which moves through air.
13-
};
14+
};
1415

1516
}//namespace cura
1617

src/settings/AdaptiveLayerHeights.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ void AdaptiveLayerHeights::calculateLayers()
128128

129129
// find the minimum slope of all the interesting triangles
130130
double minimum_slope = std::numeric_limits<double>::max();
131-
for (const int& triangle_index : triangles_of_interest)
131+
for (const size_t& triangle_index : triangles_of_interest)
132132
{
133133
const double slope = face_slopes.at(triangle_index);
134134
if (minimum_slope > slope)
@@ -237,4 +237,4 @@ void AdaptiveLayerHeights::calculateMeshTriangleSlopes()
237237
}
238238
}
239239

240-
}
240+
}

src/settings/FlowTempGraph.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ double FlowTempGraph::getTemp(const double flow, const Temperature material_prin
3535

3636
logWarning("Warning! Flow too high!\n"); // TODO
3737
return data.back().temp;
38-
};
38+
}
3939

40-
} //namespace cura
40+
} //namespace cura

0 commit comments

Comments
 (0)