Skip to content

Commit

Permalink
[CURA-11359] sanitize code (#1986)
Browse files Browse the repository at this point in the history
  • Loading branch information
casperlamboo authored Dec 1, 2023
2 parents 537f1c2 + a33ad67 commit 7be00de
Show file tree
Hide file tree
Showing 242 changed files with 12,091 additions and 11,790 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,14 @@ jobs:
files: |
**/*.xml
- name: Upload the detailed tests report
uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: LastTest.log
path: |
build/Release/Testing/Temporary/LastTest.log
retention-days: 5

- name: Conclusion
run: echo "Conclusion is ${{ fromJSON( steps.test-results.outputs.json ).conclusion }}"
8 changes: 3 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,22 +131,20 @@ set(engine_SRCS # Except main.cpp.
src/utils/ExtrusionJunction.cpp
src/utils/ExtrusionLine.cpp
src/utils/ExtrusionSegment.cpp
src/utils/FMatrix4x3.cpp
src/utils/gettime.cpp
src/utils/LinearAlg2D.cpp
src/utils/ListPolyIt.cpp
src/utils/Matrix4x3D.cpp
src/utils/MinimumSpanningTree.cpp
src/utils/Point3.cpp
src/utils/Point3LL.cpp
src/utils/PolygonConnector.cpp
src/utils/PolygonsPointIndex.cpp
src/utils/PolygonsSegmentIndex.cpp
src/utils/polygonUtils.cpp
src/utils/polygon.cpp
src/utils/PolylineStitcher.cpp
src/utils/ProximityPointLink.cpp
src/utils/Simplify.cpp
src/utils/SVG.cpp
src/utils/socket.cpp
src/utils/SquareGrid.cpp
src/utils/ThreadPool.cpp
src/utils/ToolpathVisualizer.cpp
Expand Down Expand Up @@ -282,4 +280,4 @@ endif ()
if (ENABLE_TESTING)
enable_testing()
add_subdirectory(tests)
endif ()
endif ()
4 changes: 2 additions & 2 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ def requirements(self):
self.requires("boost/1.82.0")
self.requires("rapidjson/1.1.0")
self.requires("stb/20200203")
self.requires("spdlog/1.10.0")
self.requires("fmt/9.0.0")
self.requires("spdlog/1.12.0")
self.requires("fmt/10.1.1")
self.requires("range-v3/0.12.0")
self.requires("scripta/0.1.0@ultimaker/testing")
self.requires("neargye-semver/0.3.0")
Expand Down
20 changes: 10 additions & 10 deletions include/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
#ifndef APPLICATION_H
#define APPLICATION_H

#include "utils/NoCopy.h"

#include <cassert>
#include <cstddef>
#include <string>

#include "utils/NoCopy.h"


namespace cura
{
Expand Down Expand Up @@ -38,19 +38,21 @@ class Application : NoCopy
* can assume that it is safe to access this without checking whether it is
* initialised.
*/
Communication* communication = nullptr;
Communication* communication_ = nullptr;

/*
* \brief The slice that is currently ongoing.
*
* If no slice has started yet, this will be a nullptr.
*/
Slice* current_slice = nullptr;
Slice* current_slice_ = nullptr;

/*!
* \brief ThreadPool with lifetime tied to Application
*/
ThreadPool* thread_pool = nullptr;
ThreadPool* thread_pool_ = nullptr;

std::string instance_uuid_;

/*!
* Gets the instance of this application class.
Expand Down Expand Up @@ -92,8 +94,6 @@ class Application : NoCopy
*/
void startThreadPool(int nworkers = 0);

std::string instance_uuid;

protected:
#ifdef ARCUS
/*!
Expand All @@ -120,13 +120,13 @@ class Application : NoCopy
/*
* \brief The number of arguments that the application was called with.
*/
size_t argc;
size_t argc_;

/*
* \brief An array of C strings containing the arguments that the
* application was called with.
*/
char** argv;
char** argv_;

/*!
* \brief Constructs a new Application instance.
Expand All @@ -147,4 +147,4 @@ class Application : NoCopy

} // namespace cura

#endif // APPLICATION_H
#endif // APPLICATION_H
23 changes: 14 additions & 9 deletions include/BeadingStrategy/BeadingStrategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "../settings/types/Angle.h"
#include "../settings/types/Ratio.h" //For the wall transition threshold.
#include "../utils/IntPoint.h"
#include "../utils/Point2LL.h"

namespace cura
{
Expand Down Expand Up @@ -36,7 +36,12 @@ class BeadingStrategy
coord_t left_over; //! The distance not covered by any bead; gap area.
};

BeadingStrategy(coord_t optimal_width, Ratio wall_split_middle_threshold, Ratio wall_add_middle_threshold, coord_t default_transition_length, float transitioning_angle = pi_div(3));
BeadingStrategy(
coord_t optimal_width,
Ratio wall_split_middle_threshold,
Ratio wall_add_middle_threshold,
coord_t default_transition_length,
double transitioning_angle = std::numbers::pi / 3.0);

BeadingStrategy(const BeadingStrategy& other);

Expand Down Expand Up @@ -80,7 +85,7 @@ class BeadingStrategy
*
* Transitions are used to smooth out the jumps in integer bead count; the jumps turn into ramps which could be positioned relative to the jump location.
*/
virtual float getTransitionAnchorPos(coord_t lower_bead_count) const;
virtual double getTransitionAnchorPos(coord_t lower_bead_count) const;

/*!
* Get the locations in a bead count region where \ref BeadingStrategy::compute exhibits a bend in the widths.
Expand All @@ -99,21 +104,21 @@ class BeadingStrategy
AngleRadians getTransitioningAngle() const;

protected:
std::string name;
std::string name_;

coord_t optimal_width; //! Optimal bead width, nominal width off the walls in 'ideal' circumstances.
coord_t optimal_width_; //! Optimal bead width, nominal width off the walls in 'ideal' circumstances.

Ratio wall_split_middle_threshold; //! Threshold when a middle wall should be split into two, as a ratio of the optimal wall width.
Ratio wall_split_middle_threshold_; //! Threshold when a middle wall should be split into two, as a ratio of the optimal wall width.

Ratio wall_add_middle_threshold; //! Threshold when a new middle wall should be added between an even number of walls, as a ratio of the optimal wall width.
Ratio wall_add_middle_threshold_; //! Threshold when a new middle wall should be added between an even number of walls, as a ratio of the optimal wall width.

coord_t default_transition_length; //! The length of the region to smoothly transfer between bead counts
coord_t default_transition_length_; //! The length of the region to smoothly transfer between bead counts

/*!
* The maximum angle between outline segments smaller than which we are going to add transitions
* Equals 180 - the "limit bisector angle" from the paper
*/
AngleRadians transitioning_angle;
AngleRadians transitioning_angle_;
};

using BeadingStrategyPtr = std::unique_ptr<BeadingStrategy>;
Expand Down
8 changes: 3 additions & 5 deletions include/BeadingStrategy/BeadingStrategyFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ namespace cura
class BeadingStrategyFactory
{
public:
static BeadingStrategyPtr makeStrategy
(
static BeadingStrategyPtr makeStrategy(
const coord_t preferred_bead_width_outer = MM2INT(0.5),
const coord_t preferred_bead_width_inner = MM2INT(0.5),
const coord_t preferred_transition_length = MM2INT(0.4),
const float transitioning_angle = M_PI / 4.0,
const double transitioning_angle = std::numbers::pi / 4.0,
const bool print_thin_walls = false,
const coord_t min_bead_width = 0,
const coord_t min_feature_size = 0,
Expand All @@ -27,8 +26,7 @@ class BeadingStrategyFactory
const coord_t max_bead_count = 0,
const coord_t outer_wall_offset = 0,
const int inward_distributed_center_wall_count = 2,
const Ratio minimum_variable_line_ratio = 0.5
);
const Ratio minimum_variable_line_ratio = 0.5);
};

} // namespace cura
Expand Down
16 changes: 8 additions & 8 deletions include/BeadingStrategy/DistributedBeadingStrategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ namespace cura
class DistributedBeadingStrategy : public BeadingStrategy
{
protected:
float one_over_distribution_radius_squared; // (1 / distribution_radius)^2
double one_over_distribution_radius_squared_; // (1 / distribution_radius)^2

public:
/*!
* \param distribution_radius the radius (in number of beads) over which to distribute the discrepancy between the feature size and the optimal thickness
*/
DistributedBeadingStrategy
(
* \param distribution_radius the radius (in number of beads) over which to distribute the discrepancy between the feature size and the optimal thickness
*/
DistributedBeadingStrategy(
const coord_t optimal_width,
const coord_t default_transition_length,
const AngleRadians transitioning_angle,
const Ratio wall_split_middle_threshold,
const Ratio wall_add_middle_threshold,
const int distribution_radius
);
const int distribution_radius);

virtual ~DistributedBeadingStrategy() override {}
virtual ~DistributedBeadingStrategy() override
{
}

Beading compute(coord_t thickness, coord_t bead_count) const override;
coord_t getOptimalBeadCount(coord_t thickness) const override;
Expand Down
6 changes: 3 additions & 3 deletions include/BeadingStrategy/LimitedBeadingStrategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ class LimitedBeadingStrategy : public BeadingStrategy

coord_t getTransitioningLength(coord_t lower_bead_count) const override;

float getTransitionAnchorPos(coord_t lower_bead_count) const override;
double getTransitionAnchorPos(coord_t lower_bead_count) const override;

protected:
const coord_t max_bead_count;
const BeadingStrategyPtr parent;
const coord_t max_bead_count_;
const BeadingStrategyPtr parent_;
};


Expand Down
50 changes: 25 additions & 25 deletions include/BeadingStrategy/OuterWallInsetBeadingStrategy.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//Copyright (c) 2020 Ultimaker B.V.
//CuraEngine is released under the terms of the AGPLv3 or higher.
// Copyright (c) 2020 Ultimaker B.V.
// CuraEngine is released under the terms of the AGPLv3 or higher.

#ifndef OUTER_WALL_INSET_BEADING_STRATEGY_H
#define OUTER_WALL_INSET_BEADING_STRATEGY_H
Expand All @@ -8,28 +8,28 @@

namespace cura
{
/*
* This is a meta strategy that allows for the outer wall to be inset towards the inside of the model.
*/
class OuterWallInsetBeadingStrategy : public BeadingStrategy
{
public:
OuterWallInsetBeadingStrategy(coord_t outer_wall_offset, BeadingStrategyPtr parent);
virtual ~OuterWallInsetBeadingStrategy() = default;

Beading compute(coord_t thickness, coord_t bead_count) const override;
coord_t getOptimalThickness(coord_t bead_count) const override;
coord_t getTransitionThickness(coord_t lower_bead_count) const override;
coord_t getOptimalBeadCount(coord_t thickness) const override;
coord_t getTransitioningLength(coord_t lower_bead_count) const override;
virtual std::string toString() const;
private:
BeadingStrategyPtr parent;
coord_t outer_wall_offset;
};
/*
* This is a meta strategy that allows for the outer wall to be inset towards the inside of the model.
*/
class OuterWallInsetBeadingStrategy : public BeadingStrategy
{
public:
OuterWallInsetBeadingStrategy(coord_t outer_wall_offset, BeadingStrategyPtr parent);

virtual ~OuterWallInsetBeadingStrategy() = default;

Beading compute(coord_t thickness, coord_t bead_count) const override;

coord_t getOptimalThickness(coord_t bead_count) const override;
coord_t getTransitionThickness(coord_t lower_bead_count) const override;
coord_t getOptimalBeadCount(coord_t thickness) const override;
coord_t getTransitioningLength(coord_t lower_bead_count) const override;

virtual std::string toString() const;

private:
BeadingStrategyPtr parent_;
coord_t outer_wall_offset_;
};
} // namespace cura
#endif // OUTER_WALL_INSET_BEADING_STRATEGY_H
Loading

0 comments on commit 7be00de

Please sign in to comment.