From a364141c58d9154cab2a7be21b65e66ba54b8606 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 25 Sep 2023 20:43:31 +0200 Subject: [PATCH] Mesh: C++ core guidelines --- src/Mod/Mesh/App/AppMeshPy.cpp | 38 ++--- src/Mod/Mesh/App/Core/Algorithm.cpp | 14 +- src/Mod/Mesh/App/Core/Algorithm.h | 18 ++- src/Mod/Mesh/App/Core/Approximation.cpp | 26 ++-- src/Mod/Mesh/App/Core/Approximation.h | 25 +++- src/Mod/Mesh/App/Core/Builder.h | 12 +- src/Mod/Mesh/App/Core/Curvature.cpp | 10 +- src/Mod/Mesh/App/Core/Curvature.h | 2 +- src/Mod/Mesh/App/Core/CylinderFit.cpp | 23 +-- src/Mod/Mesh/App/Core/Degeneration.cpp | 2 +- src/Mod/Mesh/App/Core/Degeneration.h | 2 +- src/Mod/Mesh/App/Core/Elements.cpp | 30 ++-- src/Mod/Mesh/App/Core/Elements.h | 20 ++- src/Mod/Mesh/App/Core/Evaluation.cpp | 21 ++- src/Mod/Mesh/App/Core/Evaluation.h | 20 ++- src/Mod/Mesh/App/Core/Grid.cpp | 102 +++++++------ src/Mod/Mesh/App/Core/Grid.h | 35 +++-- src/Mod/Mesh/App/Core/Helpers.h | 4 +- src/Mod/Mesh/App/Core/IO/ReaderOBJ.cpp | 2 +- src/Mod/Mesh/App/Core/IO/WriterOBJ.cpp | 2 +- src/Mod/Mesh/App/Core/Info.cpp | 8 +- src/Mod/Mesh/App/Core/Info.h | 6 +- src/Mod/Mesh/App/Core/Iterator.h | 55 +++++-- src/Mod/Mesh/App/Core/KDTree.h | 9 +- src/Mod/Mesh/App/Core/MeshIO.cpp | 94 ++++++------ src/Mod/Mesh/App/Core/MeshIO.h | 4 +- src/Mod/Mesh/App/Core/MeshKernel.cpp | 34 +++-- src/Mod/Mesh/App/Core/MeshKernel.h | 3 + src/Mod/Mesh/App/Core/Segmentation.cpp | 20 +-- src/Mod/Mesh/App/Core/Segmentation.h | 71 ++++++++-- src/Mod/Mesh/App/Core/SetOperations.cpp | 34 ++--- src/Mod/Mesh/App/Core/SetOperations.h | 14 +- src/Mod/Mesh/App/Core/Smoothing.cpp | 12 +- src/Mod/Mesh/App/Core/Smoothing.h | 15 +- src/Mod/Mesh/App/Core/SphereFit.cpp | 12 +- src/Mod/Mesh/App/Core/SphereFit.h | 2 +- src/Mod/Mesh/App/Core/Tools.h | 9 +- src/Mod/Mesh/App/Core/TopoAlgorithm.cpp | 8 +- src/Mod/Mesh/App/Core/TopoAlgorithm.h | 7 +- src/Mod/Mesh/App/Core/Triangulation.cpp | 17 ++- src/Mod/Mesh/App/Core/Triangulation.h | 12 ++ src/Mod/Mesh/App/Core/Trim.cpp | 6 +- src/Mod/Mesh/App/Core/Visitor.cpp | 4 +- src/Mod/Mesh/App/Core/tritritest.h | 4 +- src/Mod/Mesh/App/Edge.cpp | 30 +++- src/Mod/Mesh/App/Edge.h | 4 +- src/Mod/Mesh/App/EdgePyImp.cpp | 6 +- src/Mod/Mesh/App/Exporter.cpp | 12 +- src/Mod/Mesh/App/Exporter.h | 36 ++++- src/Mod/Mesh/App/Facet.cpp | 34 ++++- src/Mod/Mesh/App/Facet.h | 4 +- src/Mod/Mesh/App/FacetPyImp.cpp | 2 - src/Mod/Mesh/App/FeatureMeshSetOperations.cpp | 2 +- src/Mod/Mesh/App/Mesh.cpp | 48 ++++++- src/Mod/Mesh/App/Mesh.h | 8 +- src/Mod/Mesh/App/MeshPointPyImp.cpp | 2 +- src/Mod/Mesh/App/MeshProperties.cpp | 8 +- src/Mod/Mesh/App/MeshProperties.h | 11 +- src/Mod/Mesh/App/MeshPyImp.cpp | 134 +++++++++--------- src/Mod/Mesh/App/MeshTexture.cpp | 2 +- src/Mod/Mesh/App/MeshTexture.h | 2 +- src/Mod/Mesh/Gui/AppMeshGui.cpp | 8 +- src/Mod/Mesh/Gui/Command.cpp | 6 +- src/Mod/Mesh/Gui/DlgDecimating.cpp | 3 +- src/Mod/Mesh/Gui/DlgDecimating.h | 4 +- src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp | 46 +++--- src/Mod/Mesh/Gui/DlgEvaluateMeshImp.h | 2 +- src/Mod/Mesh/Gui/DlgRegularSolidImp.cpp | 4 +- src/Mod/Mesh/Gui/DlgSmoothing.cpp | 10 +- src/Mod/Mesh/Gui/DlgSmoothing.h | 2 +- src/Mod/Mesh/Gui/MeshEditor.cpp | 20 ++- src/Mod/Mesh/Gui/MeshEditor.h | 12 +- src/Mod/Mesh/Gui/MeshSelection.cpp | 10 +- src/Mod/Mesh/Gui/MeshSelection.h | 7 +- src/Mod/Mesh/Gui/PropertyEditorMesh.cpp | 2 + src/Mod/Mesh/Gui/RemeshGmsh.cpp | 12 +- src/Mod/Mesh/Gui/RemeshGmsh.h | 2 +- src/Mod/Mesh/Gui/RemoveComponents.cpp | 6 +- src/Mod/Mesh/Gui/RemoveComponents.h | 4 +- src/Mod/Mesh/Gui/Segmentation.cpp | 4 +- src/Mod/Mesh/Gui/Selection.h | 2 +- src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp | 40 +++--- src/Mod/Mesh/Gui/SoFCIndexedFaceSet.h | 2 + src/Mod/Mesh/Gui/SoFCMeshObject.cpp | 26 ++-- src/Mod/Mesh/Gui/SoFCMeshObject.h | 10 +- src/Mod/Mesh/Gui/SoPolygon.h | 2 + src/Mod/Mesh/Gui/ViewProvider.cpp | 36 +++-- src/Mod/Mesh/Gui/ViewProvider.h | 4 +- src/Mod/Mesh/Gui/ViewProviderCurvature.cpp | 10 +- src/Mod/Mesh/Gui/ViewProviderCurvature.h | 4 +- src/Mod/Mesh/Gui/ViewProviderDefects.cpp | 20 ++- src/Mod/Mesh/Gui/ViewProviderDefects.h | 23 +-- src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.cpp | 6 +- src/Mod/Mesh/Gui/ViewProviderMeshPyImp.cpp | 10 +- src/Mod/Mesh/Gui/ViewProviderTransform.cpp | 2 + src/Mod/Mesh/Gui/ViewProviderTransform.h | 2 +- .../Gui/ViewProviderTransformDemolding.cpp | 2 + .../Mesh/Gui/ViewProviderTransformDemolding.h | 1 + src/Mod/Mesh/Gui/Workbench.cpp | 2 + 99 files changed, 984 insertions(+), 597 deletions(-) diff --git a/src/Mod/Mesh/App/AppMeshPy.cpp b/src/Mod/Mesh/App/AppMeshPy.cpp index 9733d6122a..9f366f6bb7 100644 --- a/src/Mod/Mesh/App/AppMeshPy.cpp +++ b/src/Mod/Mesh/App/AppMeshPy.cpp @@ -27,12 +27,6 @@ #include #endif -#include "Core/Approximation.h" -#include "Core/Evaluation.h" -#include "Core/Iterator.h" -#include "Core/MeshIO.h" -#include "Core/MeshKernel.h" -#include "WildMagic4/Wm4ContBox3.h" #include #include #include @@ -41,6 +35,12 @@ #include #include #include +#include "Core/Approximation.h" +#include "Core/Evaluation.h" +#include "Core/Iterator.h" +#include "Core/MeshIO.h" +#include "Core/MeshKernel.h" +#include "WildMagic4/Wm4ContBox3.h" #include "Exporter.h" #include "Importer.h" @@ -139,7 +139,7 @@ private: } Py::Object read(const Py::Tuple& args) { - char* Name; + char* Name {}; if (!PyArg_ParseTuple(args.ptr(), "et", "utf-8", &Name)) { throw Py::Exception(); } @@ -152,7 +152,7 @@ private: } Py::Object open(const Py::Tuple& args) { - char* Name; + char* Name {}; if (!PyArg_ParseTuple(args.ptr(), "et", "utf-8", &Name)) { throw Py::Exception(); } @@ -170,7 +170,7 @@ private: } Py::Object importer(const Py::Tuple& args) { - char* Name; + char* Name {}; char* DocName = nullptr; if (!PyArg_ParseTuple(args.ptr(), "et|s", "utf-8", &Name, &DocName)) { throw Py::Exception(); @@ -199,8 +199,8 @@ private: Py::Object exporter(const Py::Tuple& args, const Py::Dict& keywds) { - PyObject* objects; - char* fileNamePy; + PyObject* objects {}; + char* fileNamePy {}; // If tolerance is specified via python interface, use that. // If not, use the preference, if that exists, else default to 0.1mm. @@ -292,7 +292,7 @@ private: Py::Object show(const Py::Tuple& args) { - PyObject* pcObj; + PyObject* pcObj {}; char* name = "Mesh"; if (!PyArg_ParseTuple(args.ptr(), "O!|s", &(MeshPy::Type), &pcObj, &name)) { throw Py::Exception(); @@ -334,7 +334,7 @@ private: } PyErr_Clear(); - PyObject* box; + PyObject* box {}; if (PyArg_ParseTuple(args.ptr(), "O!", &Base::BoundBoxPy::Type, &box)) { Py::BoundingBox bbox(box, false); mesh = MeshObject::createCube(bbox.getValue()); @@ -468,7 +468,7 @@ private: } Py::Object calculateEigenTransform(const Py::Tuple& args) { - PyObject* input; + PyObject* input {}; if (!PyArg_ParseTuple(args.ptr(), "O", &input)) { throw Py::Exception(); @@ -513,7 +513,7 @@ private: } Py::Object polynomialFit(const Py::Tuple& args) { - PyObject* input; + PyObject* input {}; if (!PyArg_ParseTuple(args.ptr(), "O", &input)) { throw Py::Exception(); @@ -543,7 +543,7 @@ private: dict.setItem(Py::String("Sigma"), Py::Float(fit)); // coefficients - double a, b, c, d, e, f; + double a {}, b {}, c {}, d {}, e {}, f {}; polyFit.GetCoefficients(a, b, c, d, e, f); Py::Tuple p(6); p.setItem(0, Py::Float(a)); @@ -564,11 +564,11 @@ private: } dict.setItem(Py::String("Residuals"), r); - return dict; + return dict; // NOLINT } Py::Object minimumVolumeOrientedBox(const Py::Tuple& args) { - PyObject* input; + PyObject* input {}; if (!PyArg_ParseTuple(args.ptr(), "O", &input)) { throw Py::Exception(); @@ -626,7 +626,7 @@ private: result.setItem(5, Py::Float(mobox.Extent[1])); result.setItem(6, Py::Float(mobox.Extent[2])); - return result; + return result; // NOLINT } }; diff --git a/src/Mod/Mesh/App/Core/Algorithm.cpp b/src/Mod/Mesh/App/Core/Algorithm.cpp index 36f2cccb64..52dbb2d5d4 100644 --- a/src/Mod/Mesh/App/Core/Algorithm.cpp +++ b/src/Mod/Mesh/App/Core/Algorithm.cpp @@ -51,7 +51,7 @@ bool MeshAlgorithm::IsVertexVisible(const Base::Vector3f& rcVertex, Base::Vector3f cDirection = rcVertex - rcView; float fDistance = cDirection.Length(); Base::Vector3f cIntsct; - FacetIndex uInd; + FacetIndex uInd {}; // search for the nearest facet to rcView in direction to rcVertex if (NearestFacetOnRay(rcView, cDirection, /*1.2f*fDistance,*/ rclGrid, cIntsct, uInd)) { @@ -265,8 +265,8 @@ bool MeshAlgorithm::FirstFacetToVertex(const Base::Vector3f& rPt, else { // if not then check the distance to the border of the triangle Base::Vector3f res; - float fDist; - unsigned short uSide; + float fDist {}; + unsigned short uSide {}; cFacet.ProjectPointToPlane(rPt, res); cFacet.NearestEdgeToPoint(res, fDist, uSide); if (fDist < fEps) { @@ -405,7 +405,7 @@ void MeshAlgorithm::GetFacetBorders(const std::vector& raulInd, } // search for edges in the unsorted list - PointIndex ulFirst, ulLast; + PointIndex ulFirst {}, ulLast {}; std::list clBorder; ulFirst = aclEdges.begin()->first; ulLast = aclEdges.begin()->second; @@ -1187,7 +1187,7 @@ void MeshAlgorithm::CheckFacets(const MeshFacetGrid& rclGrid, MeshFacetIterator clIter(_rclMesh, 0); Base::Vector3f clPt2d; Base::Vector3f clGravityOfFacet; - bool bNoPointInside; + bool bNoPointInside {}; // Cache current view projection matrix since calls to Coin's projection are expensive Base::ViewProjMatrix fixedProj(pclProj->getComposedProjectionMatrix()); // Precompute the polygon's bounding box @@ -1614,7 +1614,7 @@ bool MeshAlgorithm::ConnectLines(std::list>& openEdges, std::list& boundary) const; -protected: +private: const MeshKernel& _rclMesh; /**< The mesh kernel. */ }; @@ -424,6 +424,10 @@ class MeshExport MeshCollector public: MeshCollector() = default; virtual ~MeshCollector() = default; + MeshCollector(const MeshCollector&) = default; + MeshCollector(MeshCollector&&) = default; + MeshCollector& operator=(const MeshCollector&) = default; + MeshCollector& operator=(MeshCollector&&) = default; virtual void Append(const MeshCore::MeshKernel&, FacetIndex index) = 0; }; @@ -435,7 +439,7 @@ public: {} void Append(const MeshCore::MeshKernel& kernel, FacetIndex index) override { - PointIndex ulP1, ulP2, ulP3; + PointIndex ulP1 {}, ulP2 {}, ulP3 {}; kernel.GetFacetPoints(index, ulP1, ulP2, ulP3); indices.push_back(ulP1); indices.push_back(ulP2); @@ -499,7 +503,7 @@ protected: std::set& visit, MeshCollector& collect) const; -protected: +private: const MeshKernel& _rclMesh; /**< The mesh kernel. */ std::vector> _map; }; @@ -528,7 +532,7 @@ public: /// Returns an array of common facets of the passed facet indexes. std::vector GetIndices(FacetIndex, FacetIndex) const; -protected: +private: const MeshKernel& _rclMesh; /**< The mesh kernel. */ std::vector> _map; }; @@ -557,7 +561,7 @@ public: void AddNeighbour(PointIndex, PointIndex); void RemoveNeighbour(PointIndex, PointIndex); -protected: +private: const MeshKernel& _rclMesh; /**< The mesh kernel. */ std::vector> _map; }; @@ -582,7 +586,7 @@ public: void Rebuild(); const std::pair& operator[](const MeshEdge&) const; -protected: +private: class EdgeOrder { public: @@ -630,7 +634,7 @@ public: return _norm; } -protected: +private: const MeshKernel& _rclMesh; /**< The mesh kernel. */ std::vector _norm; }; diff --git a/src/Mod/Mesh/App/Core/Approximation.cpp b/src/Mod/Mesh/App/Core/Approximation.cpp index ad204d493a..b986c2eeb5 100644 --- a/src/Mod/Mesh/App/Core/Approximation.cpp +++ b/src/Mod/Mesh/App/Core/Approximation.cpp @@ -146,8 +146,15 @@ float PlaneFit::Fit() return FLOAT_MAX; } - double sxx, sxy, sxz, syy, syz, szz, mx, my, mz; - sxx = sxy = sxz = syy = syz = szz = mx = my = mz = 0.0; + double sxx {0.0}; + double sxy {0.0}; + double sxz {0.0}; + double syy {0.0}; + double syz {0.0}; + double szz {0.0}; + double mx {0.0}; + double my {0.0}; + double mz {0.0}; for (const auto& vPoint : _vPoints) { sxx += double(vPoint.x * vPoint.x); @@ -356,9 +363,9 @@ float PlaneFit::GetSignedStdDeviation() const return FLOAT_MAX; } - float fSumXi = 0.0f, fSumXi2 = 0.0f, fMean = 0.0f, fDist = 0.0f; + float fSumXi = 0.0F, fSumXi2 = 0.0F, fMean = 0.0F, fDist = 0.0F; float fMinDist = FLOAT_MAX; - float fFactor; + float fFactor = 0.0F; float ulPtCt = float(CountPoints()); Base::Vector3f clGravity, clPt; @@ -1036,8 +1043,7 @@ struct LMCylinderFunctor // 'fjac' has dimensions m x n // It will contain the jacobian of the errors, calculated numerically in this case. - double epsilon; - epsilon = 1e-5; + const double epsilon = 1e-5; for (int i = 0; i < x.size(); i++) { Eigen::VectorXd xPlus(x); @@ -1122,8 +1128,12 @@ Base::Vector3f CylinderFit::GetInitialAxisFromNormals(const std::vector>& rcPts) const; + Approximation(const Approximation&) = default; + Approximation(Approximation&&) = default; + Approximation& operator=(const Approximation&) = default; + Approximation& operator=(Approximation&&) = default; + protected: // NOLINTBEGIN std::list _vPoints; /**< Holds the points for the fit algorithm. */ @@ -387,7 +392,7 @@ public: std::vector toBezier(double umin = 0.0, double umax = 1.0, double vmin = 0.0, double vmax = 1.0) const; -protected: +private: double PolynomFit(); double _fCoeff[10]; /**< Ziel der Koeffizienten aus dem Fit */ }; @@ -437,7 +442,7 @@ public: */ void GetBounding(Base::Vector3f& bottom, Base::Vector3f& top) const; -protected: +private: Base::Vector3f _vBase; /**< Base vector of the cylinder. */ Base::Vector3f _vAxis; /**< Axis of the cylinder. */ float _fRadius {0}; /**< Radius of the cylinder. */ @@ -474,7 +479,7 @@ public: */ void ProjectToSphere(); -protected: +private: Base::Vector3f _vCenter; /**< Center of the sphere. */ float _fRadius {0}; /**< Radius of the cylinder. */ }; @@ -498,11 +503,19 @@ public: * @param pKoef Pointer to the quadric coefficients * (double [10]) */ + // NOLINTBEGIN explicit FunctionContainer(const double* pKoef) { Assign(pKoef); pImplSurf = new Wm4::QuadricSurface(dKoeff); } + // NOLINTEND + + FunctionContainer(const FunctionContainer&) = delete; + FunctionContainer(FunctionContainer&&) = delete; + FunctionContainer& operator=(const FunctionContainer&) = delete; + FunctionContainer& operator=(FunctionContainer&&) = delete; + /** * Apply quadric coefficients * @param pKoef Pointer to the quadric coefficients @@ -676,7 +689,7 @@ public: return (2.0 * dKoeff[6]); } -protected: +private: double dKoeff[10]; /**< Coefficients of quadric */ Wm4::ImplicitSurface* pImplSurf; /**< Access to the WildMagic library */ @@ -695,7 +708,7 @@ public: float Fit() override; float Value(float x, float y) const; -protected: +private: float _fCoeff[9]; }; diff --git a/src/Mod/Mesh/App/Core/Builder.h b/src/Mod/Mesh/App/Core/Builder.h index 02da3e5663..e9ab351bb8 100644 --- a/src/Mod/Mesh/App/Core/Builder.h +++ b/src/Mod/Mesh/App/Core/Builder.h @@ -70,8 +70,8 @@ private: FacetIndex facetIdx; Edge(PointIndex p1, PointIndex p2, FacetIndex idx) + : facetIdx {idx} { - facetIdx = idx; if (p1 > p2) { pt1 = p2; pt2 = p1; @@ -117,6 +117,11 @@ public: explicit MeshBuilder(MeshKernel& rclM); ~MeshBuilder(); + MeshBuilder(const MeshBuilder&) = delete; + MeshBuilder(MeshBuilder&&) = delete; + MeshBuilder& operator=(const MeshBuilder&) = delete; + MeshBuilder& operator=(MeshBuilder&&) = delete; + /** * Set the tolerance for the comparison of points. Normally you don't need to set the tolerance. */ @@ -198,6 +203,11 @@ public: explicit MeshFastBuilder(MeshKernel& rclM); ~MeshFastBuilder(); + MeshFastBuilder(const MeshFastBuilder&) = delete; + MeshFastBuilder(MeshFastBuilder&&) = delete; + MeshFastBuilder& operator=(const MeshFastBuilder&) = delete; + MeshFastBuilder& operator=(MeshFastBuilder&&) = delete; + /** Initializes the class. Must be done before adding facets * @param ctFacets count of facets. */ diff --git a/src/Mod/Mesh/App/Core/Curvature.cpp b/src/Mod/Mesh/App/Core/Curvature.cpp index d60463f040..8c36fed6ce 100644 --- a/src/Mod/Mesh/App/Core/Curvature.cpp +++ b/src/Mod/Mesh/App/Core/Curvature.cpp @@ -59,11 +59,11 @@ MeshCurvature::MeshCurvature(const MeshKernel& kernel) std::generate(mySegment.begin(), mySegment.end(), Base::iotaGen(0)); } -MeshCurvature::MeshCurvature(const MeshKernel& kernel, const std::vector& segm) +MeshCurvature::MeshCurvature(const MeshKernel& kernel, std::vector segm) : myKernel(kernel) , myMinPoints(20) , myRadius(0.5f) - , mySegment(segm) + , mySegment(std::move(segm)) {} void MeshCurvature::ComputePerFace(bool parallel) @@ -357,7 +357,7 @@ public: {} void Append(const MeshCore::MeshKernel& kernel, FacetIndex index) override { - PointIndex ulP1, ulP2, ulP3; + PointIndex ulP1 {}, ulP2 {}, ulP3 {}; kernel.GetFacetPoints(index, ulP1, ulP2, ulP3); indices.insert(ulP1); indices.insert(ulP2); @@ -411,13 +411,13 @@ CurvatureInfo FacetCurvature::Compute(FacetIndex index) const fitPoints.push_back(verts[it] - face_gravity); } - float fMin, fMax; + float fMin {}, fMax {}; if (fitPoints.size() >= myMinPoints) { SurfaceFit surf_fit; surf_fit.AddPoints(fitPoints); surf_fit.Fit(); rkNormal = surf_fit.GetNormal(); - double dMin, dMax, dDistance; + double dMin {}, dMax {}, dDistance {}; if (surf_fit.GetCurvatureInfo(0.0, 0.0, 0.0, dMin, dMax, rkDir1, rkDir0, dDistance)) { fMin = (float)dMin; fMax = (float)dMax; diff --git a/src/Mod/Mesh/App/Core/Curvature.h b/src/Mod/Mesh/App/Core/Curvature.h index 9f724d1491..1e96135103 100644 --- a/src/Mod/Mesh/App/Core/Curvature.h +++ b/src/Mod/Mesh/App/Core/Curvature.h @@ -60,7 +60,7 @@ class MeshExport MeshCurvature { public: explicit MeshCurvature(const MeshKernel& kernel); - MeshCurvature(const MeshKernel& kernel, const std::vector& segm); + MeshCurvature(const MeshKernel& kernel, std::vector segm); float GetRadius() const { return myRadius; diff --git a/src/Mod/Mesh/App/Core/CylinderFit.cpp b/src/Mod/Mesh/App/Core/CylinderFit.cpp index 194ef85306..7a20d73bbb 100644 --- a/src/Mod/Mesh/App/Core/CylinderFit.cpp +++ b/src/Mod/Mesh/App/Core/CylinderFit.cpp @@ -291,7 +291,7 @@ float CylinderFit::Fit() // solL: Yc, Zc, M, N, R // solM: Xc, Zc, L, N, R // solN: Xc, Yc, L, M, R - SolutionD solDir; + SolutionD solDir {}; findBestSolDirection(solDir); // Initialise some matrices and vectors @@ -300,7 +300,7 @@ float CylinderFit::Fit() Eigen::VectorXd atpl(5); // Iteration loop... - double sigma0; + double sigma0 {}; bool cont = true; while (cont && (_numIter < _maxIter)) { ++_numIter; @@ -327,7 +327,7 @@ float CylinderFit::Fit() // Before updating the unknowns, compute the residuals and sigma0 and check the residual // convergence - bool vConverged; + bool vConverged {}; if (!computeResiduals(solDir, x, residuals, sigma0, _vConvLimit, vConverged)) { return FLOAT_MAX; } @@ -465,8 +465,8 @@ void CylinderFit::setupNormalEquationMatrices(SolutionD solDir, // For each point, setup the observation equation coefficients and add their // contribution into the normal equation matrices - double a[5], b[3]; - double f0, qw; + double a[5] {}, b[3] {}; + double f0 {}, qw {}; std::vector::const_iterator vIt = residuals.begin(); std::list::const_iterator cIt; for (cIt = _vPoints.begin(); cIt != _vPoints.end(); ++cIt, ++vIt) { @@ -523,11 +523,12 @@ void CylinderFit::setupObservation(SolutionD solDir, b[2] = 2.0 * (dz - _vAxis.x * _vAxis.z * dx - _vAxis.y * _vAxis.z * dy - _vAxis.z * _vAxis.z * dz); + double ddxdl {}, ddydl {}, ddzdl {}; + double ddxdm {}, ddydm {}, ddzdm {}; + double ddxdn {}, ddydn {}, ddzdn {}; + // partials of the parameters switch (solDir) { - double ddxdl, ddydl, ddzdl; - double ddxdm, ddydm, ddzdm; - double ddxdn, ddydn, ddzdn; case solL: // order of parameters: Yc, Zc, M, N, R ddxdm = -2.0 * _vAxis.y * dx00 + (_vAxis.x - _vAxis.y * _vAxis.y / _vAxis.x) * dy00 @@ -645,8 +646,8 @@ bool CylinderFit::computeResiduals(SolutionD solDir, vConverged = true; int nPtsUsed = 0; sigma0 = 0.0; - double a[5], b[3]; - double f0, qw; + double a[5] {}, b[3] {}; + double f0 {}, qw {}; // double maxdVx = 0.0; // double maxdVy = 0.0; // double maxdVz = 0.0; @@ -747,7 +748,7 @@ bool CylinderFit::updateParameters(SolutionD solDir, const Eigen::VectorXd& x) } // Update the dependent axis direction parameter - double l2, m2, n2; + double l2 {}, m2 {}, n2 {}; switch (solDir) { case solL: l2 = 1.0 - _vAxis.y * _vAxis.y - _vAxis.z * _vAxis.z; diff --git a/src/Mod/Mesh/App/Core/Degeneration.cpp b/src/Mod/Mesh/App/Core/Degeneration.cpp index 9f00419996..b01895a624 100644 --- a/src/Mod/Mesh/App/Core/Degeneration.cpp +++ b/src/Mod/Mesh/App/Core/Degeneration.cpp @@ -283,7 +283,7 @@ struct MeshFacet_Less { bool operator()(const FaceIterator& x, const FaceIterator& y) const { - PointIndex tmp; + PointIndex tmp {}; PointIndex x0 = x->_aulPoints[0]; PointIndex x1 = x->_aulPoints[1]; PointIndex x2 = x->_aulPoints[2]; diff --git a/src/Mod/Mesh/App/Core/Degeneration.h b/src/Mod/Mesh/App/Core/Degeneration.h index 0baf629930..6477002c98 100644 --- a/src/Mod/Mesh/App/Core/Degeneration.h +++ b/src/Mod/Mesh/App/Core/Degeneration.h @@ -584,7 +584,7 @@ public: {} bool Evaluate() override; -protected: +private: std::vector& _facets; }; diff --git a/src/Mod/Mesh/App/Core/Elements.cpp b/src/Mod/Mesh/App/Core/Elements.cpp index 4f04abe768..068801c94f 100644 --- a/src/Mod/Mesh/App/Core/Elements.cpp +++ b/src/Mod/Mesh/App/Core/Elements.cpp @@ -55,7 +55,7 @@ PointIndex MeshPointArray::Get(const MeshPoint& rclPoint) PointIndex MeshPointArray::GetOrAddIndex(const MeshPoint& rclPoint) { - PointIndex ulIndex; + PointIndex ulIndex {}; if ((ulIndex = Get(rclPoint)) == POINT_INDEX_MAX) { push_back(rclPoint); @@ -111,7 +111,7 @@ MeshFacetArray::MeshFacetArray(MeshFacetArray&& ary) = default; void MeshFacetArray::Erase(_TIterator pIter) { - FacetIndex i, *pulN; + FacetIndex i {}, *pulN {}; _TIterator pPass, pEnd; FacetIndex ulInd = pIter - begin(); erase(pIter); @@ -494,7 +494,7 @@ bool MeshGeomFacet::IsPointOf(const Base::Vector3f& rclPoint, float fDistance) c // force internal normal to be computed if not done yet Base::Vector3f clNorm(GetNormal()), clProjPt(rclPoint), clEdge; Base::Vector3f clP0(_aclPoints[0]), clP1(_aclPoints[1]), clP2(_aclPoints[2]); - float fLP, fLE; + float fLP {}, fLE {}; clNorm.Normalize(); clProjPt.ProjectToPlane(_aclPoints[0], clNorm); @@ -616,8 +616,8 @@ void MeshGeomFacet::ProjectFacetToPlane(MeshGeomFacet& rclFacet) const void MeshGeomFacet::Enlarge(float fDist) { Base::Vector3f clM, clU, clV, clPNew[3]; - float fA, fD; - PointIndex i, ulP1, ulP2, ulP3; + float fA {}, fD {}; + PointIndex i {}, ulP1 {}, ulP2 {}, ulP3 {}; for (i = 0; i < 3; i++) { ulP1 = i; @@ -683,7 +683,7 @@ bool MeshGeomFacet::IsDegenerated(float epsilon) const bool MeshGeomFacet::IsDeformed(float fCosOfMinAngle, float fCosOfMaxAngle) const { - float fCosAngle; + float fCosAngle {}; Base::Vector3f u, v; for (int i = 0; i < 3; i++) { @@ -1047,8 +1047,10 @@ void MeshGeomFacet::SubSample(float fStep, std::vector& rclPoint float fDetABC = bx * cy; - for (float px = (fStep / 2.0f); px < fLenAB; px += fStep) { - for (float py = (fStep / 2.0f); py < cy; py += fStep) { + for (float px = (fStep / 2.0f); px < fLenAB; px += fStep) // NOLINT + { + for (float py = (fStep / 2.0f); py < cy; py += fStep) // NOLINT + { float u = (bx * cy + cx * py - px * cy - bx * py) / fDetABC; float v = (px * cy - cx * py) / fDetABC; float w = (bx * py) / fDetABC; @@ -1146,9 +1148,9 @@ int MeshGeomFacet::IntersectWithFacet(const MeshGeomFacet& rclFacet, return 0; } - float V[3][3], U[3][3]; + float V[3][3] {}, U[3][3] {}; int coplanar = 0; - float isectpt1[3], isectpt2[3]; + float isectpt1[3] {}, isectpt2[3] {}; for (int i = 0; i < 3; i++) { V[i][0] = _aclPoints[i].x; @@ -1313,7 +1315,7 @@ float MeshGeomFacet::CenterOfCircumCircle(Base::Vector3f& rclCenter) const unsigned short MeshGeomFacet::NearestEdgeToPoint(const Base::Vector3f& rclPt) const { - unsigned short usSide; + unsigned short usSide {}; const Base::Vector3f& rcP1 = _aclPoints[0]; const Base::Vector3f& rcP2 = _aclPoints[1]; @@ -1543,7 +1545,7 @@ float MeshGeomFacet::MinimumAngle() const bool MeshGeomFacet::IsPointOfSphere(const Base::Vector3f& rP) const { - float radius; + float radius {}; Base::Vector3f center; radius = CenterOfCircumCircle(center); radius *= radius; @@ -1554,7 +1556,7 @@ bool MeshGeomFacet::IsPointOfSphere(const Base::Vector3f& rP) const bool MeshGeomFacet::IsPointOfSphere(const MeshGeomFacet& rFacet) const { - float radius; + float radius {}; Base::Vector3f center; radius = CenterOfCircumCircle(center); radius *= radius; @@ -1575,7 +1577,7 @@ float MeshGeomFacet::AspectRatio() const Base::Vector3f d1 = _aclPoints[1] - _aclPoints[2]; Base::Vector3f d2 = _aclPoints[2] - _aclPoints[0]; - float l2, maxl2 = d0.Sqr(); + float l2 {}, maxl2 = d0.Sqr(); if ((l2 = d1.Sqr()) > maxl2) { maxl2 = l2; } diff --git a/src/Mod/Mesh/App/Core/Elements.h b/src/Mod/Mesh/App/Core/Elements.h index dfd349a81b..32994a3a5c 100644 --- a/src/Mod/Mesh/App/Core/Elements.h +++ b/src/Mod/Mesh/App/Core/Elements.h @@ -665,14 +665,16 @@ public: */ bool IsCoplanar(const MeshGeomFacet& facet) const; -protected: +private: mutable Base::Vector3f _clNormal; /**< Normal of the facet. */ mutable bool _bNormalCalculated; /**< True if the normal is already calculated. */ public: + // NOLINTBEGIN Base::Vector3f _aclPoints[3]; /**< Geometric corner points. */ unsigned char _ucFlag; /**< Flag property */ unsigned long _ulProp; /**< Free usable property. */ + // NOLINTEND }; using TMeshPointArray = std::vector; @@ -993,7 +995,7 @@ inline bool MeshGeomFacet::IntersectWithPlane(const Base::Vector3f& rclBase, && (bD0 == (_aclPoints[2].DistanceToPlane(rclBase, rclNormal) > 0.0f))); } -inline MeshFacet::MeshFacet() +inline MeshFacet::MeshFacet() // NOLINT : _ucFlag(0) , _ulProp(0) { @@ -1009,15 +1011,9 @@ inline MeshFacet::MeshFacet(PointIndex p1, FacetIndex n3) : _ucFlag(0) , _ulProp(0) -{ - _aulPoints[0] = p1; - _aulPoints[1] = p2; - _aulPoints[2] = p3; - - _aulNeighbours[0] = n1; - _aulNeighbours[1] = n2; - _aulNeighbours[2] = n3; -} + , _aulPoints {p1, p2, p3} + , _aulNeighbours {n1, n2, n3} +{} void MeshFacet::SetVertices(PointIndex p1, PointIndex p2, PointIndex p3) { @@ -1191,7 +1187,7 @@ inline unsigned short MeshFacet::Side(PointIndex ulP0, PointIndex ulP1) const inline unsigned short MeshFacet::Side(const MeshFacet& rFace) const { - unsigned short side; + unsigned short side {}; for (int i = 0; i < 3; i++) { side = Side(rFace._aulPoints[i], rFace._aulPoints[(i + 1) % 3]); if (side != USHRT_MAX) { diff --git a/src/Mod/Mesh/App/Core/Evaluation.cpp b/src/Mod/Mesh/App/Core/Evaluation.cpp index 707c712ceb..5397320bef 100644 --- a/src/Mod/Mesh/App/Core/Evaluation.cpp +++ b/src/Mod/Mesh/App/Core/Evaluation.cpp @@ -184,7 +184,7 @@ unsigned long MeshEvalOrientation::HasFalsePositives(const std::vector MeshEvalOrientation::GetIndices() const { - FacetIndex ulStartFacet, ulVisited; + FacetIndex ulStartFacet {}, ulVisited {}; if (_rclMesh.CountFacets() == 0) { return {}; @@ -346,7 +346,7 @@ bool MeshEvalTopology::Evaluate() Base::SequencerLauncher seq("Checking topology...", rclFAry.size()); for (pI = rclFAry.begin(); pI != rclFAry.end(); ++pI) { for (int i = 0; i < 3; i++) { - Edge_Index item; + Edge_Index item {}; item.p0 = std::min(pI->_aulPoints[i], pI->_aulPoints[(i + 1) % 3]); item.p1 = std::max(pI->_aulPoints[i], pI->_aulPoints[(i + 1) % 3]); item.f = pI - rclFAry.begin(); @@ -485,7 +485,7 @@ bool MeshEvalPointManifolds::Evaluate() const std::set& nf = vf_it[index]; const std::set& np = vv_it[index]; - std::set::size_type sp, sf; + std::set::size_type sp {}, sf {}; sp = np.size(); sf = nf.size(); // for an inner point the number of adjacent points is equal to the number of shared faces @@ -607,7 +607,7 @@ bool MeshEvalSelfIntersection::Evaluate() MeshFacetGrid cMeshFacetGrid(_rclMesh); const MeshFacetArray& rFaces = _rclMesh.GetFacets(); MeshGridIterator clGridIter(cMeshFacetGrid); - unsigned long ulGridX, ulGridY, ulGridZ; + unsigned long ulGridX {}, ulGridY {}, ulGridZ {}; cMeshFacetGrid.GetCtGrids(ulGridX, ulGridY, ulGridZ); MeshFacetIterator cMFI(_rclMesh); @@ -713,7 +713,7 @@ void MeshEvalSelfIntersection::GetIntersections( MeshFacetGrid cMeshFacetGrid(_rclMesh); const MeshFacetArray& rFaces = _rclMesh.GetFacets(); MeshGridIterator clGridIter(cMeshFacetGrid); - unsigned long ulGridX, ulGridY, ulGridZ; + unsigned long ulGridX {}, ulGridY {}, ulGridZ {}; cMeshFacetGrid.GetCtGrids(ulGridX, ulGridY, ulGridZ); MeshFacetIterator cMFI(_rclMesh); @@ -838,7 +838,7 @@ bool MeshEvalNeighbourhood::Evaluate() Base::SequencerLauncher seq("Checking indices...", rclFAry.size()); for (pI = rclFAry.begin(); pI != rclFAry.end(); ++pI) { for (int i = 0; i < 3; i++) { - Edge_Index item; + Edge_Index item {}; item.p0 = std::min(pI->_aulPoints[i], pI->_aulPoints[(i + 1) % 3]); item.p1 = std::max(pI->_aulPoints[i], pI->_aulPoints[(i + 1) % 3]); item.f = pI - rclFAry.begin(); @@ -905,7 +905,7 @@ std::vector MeshEvalNeighbourhood::GetIndices() const Base::SequencerLauncher seq("Checking indices...", rclFAry.size()); for (pI = rclFAry.begin(); pI != rclFAry.end(); ++pI) { for (int i = 0; i < 3; i++) { - Edge_Index item; + Edge_Index item {}; item.p0 = std::min(pI->_aulPoints[i], pI->_aulPoints[(i + 1) % 3]); item.p1 = std::max(pI->_aulPoints[i], pI->_aulPoints[(i + 1) % 3]); item.f = pI - rclFAry.begin(); @@ -981,7 +981,7 @@ void MeshKernel::RebuildNeighbours(FacetIndex index) MeshFacetArray::_TConstIterator pB = this->_aclFacetArray.begin(); for (pI = pB + index; pI != this->_aclFacetArray.end(); ++pI) { for (int i = 0; i < 3; i++) { - Edge_Index item; + Edge_Index item {}; item.p0 = std::min(pI->_aulPoints[i], pI->_aulPoints[(i + 1) % 3]); item.p1 = std::max(pI->_aulPoints[i], pI->_aulPoints[(i + 1) % 3]); item.f = pI - pB; @@ -1111,7 +1111,7 @@ bool MeshEigensystem::Evaluate() float xmin = 0.0f, xmax = 0.0f, ymin = 0.0f, ymax = 0.0f, zmin = 0.0f, zmax = 0.0f; Base::Vector3f clVect, clProj; - float fH; + float fH {}; const MeshPointArray& aclPoints = _rclMesh.GetPoints(); for (const auto& it : aclPoints) { @@ -1192,8 +1192,7 @@ void MeshEigensystem::CalculateLocalSystem() _cW = planeFit.GetNormal(); // set the sign for the vectors - float fSumU, fSumV, fSumW; - fSumU = fSumV = fSumW = 0.0f; + float fSumU {0.0F}, fSumV {0.0F}, fSumW {0.0F}; for (it = aclPoints.begin(); it != aclPoints.end(); ++it) { float fU = _cU * (*it - _cC); float fV = _cV * (*it - _cC); diff --git a/src/Mod/Mesh/App/Core/Evaluation.h b/src/Mod/Mesh/App/Core/Evaluation.h index 366e152e8f..a9456ed938 100644 --- a/src/Mod/Mesh/App/Core/Evaluation.h +++ b/src/Mod/Mesh/App/Core/Evaluation.h @@ -50,6 +50,11 @@ public: {} virtual ~MeshEvaluation() = default; + MeshEvaluation(const MeshEvaluation&) = delete; + MeshEvaluation(MeshEvaluation&&) = delete; + MeshEvaluation& operator=(const MeshEvaluation&) = delete; + MeshEvaluation& operator=(MeshEvaluation&&) = delete; + /** * Evaluates the mesh kernel with respect to certain criteria. Must be reimplemented by every * subclass. This pure virtual function returns false if the mesh kernel is invalid according @@ -58,6 +63,7 @@ public: virtual bool Evaluate() = 0; protected: + // NOLINTNEXTLINE const MeshKernel& _rclMesh; /**< Mesh kernel */ }; @@ -78,6 +84,11 @@ public: {} virtual ~MeshValidation() = default; + MeshValidation(const MeshValidation&) = delete; + MeshValidation(MeshValidation&&) = delete; + MeshValidation& operator=(const MeshValidation&) = delete; + MeshValidation& operator=(MeshValidation&&) = delete; + /** * This function attempts to change the mesh kernel to be valid according to the checked * criterion: True is returned if the errors could be fixed, false otherwise. @@ -85,6 +96,7 @@ public: virtual bool Fixup() = 0; protected: + // NOLINTNEXTLINE MeshKernel& _rclMesh; /**< Mesh kernel */ }; @@ -207,8 +219,10 @@ public: } protected: + // NOLINTBEGIN std::vector> nonManifoldList; std::list> nonManifoldFacets; + // NOLINTEND }; /** @@ -229,7 +243,7 @@ public: return deletedFaces; } -protected: +private: std::vector deletedFaces; const std::list>& nonManifoldList; }; @@ -264,7 +278,7 @@ public: return static_cast(nonManifoldPoints.size()); } -protected: +private: std::vector nonManifoldPoints; std::list> facetsOfNonManifoldPoints; }; @@ -300,7 +314,7 @@ public: {} bool Fixup() override; -protected: +private: const std::vector>& _raclManifoldList; }; diff --git a/src/Mod/Mesh/App/Core/Grid.cpp b/src/Mod/Mesh/App/Core/Grid.cpp index 0ad39efa4e..3f58ee2c84 100644 --- a/src/Mod/Mesh/App/Core/Grid.cpp +++ b/src/Mod/Mesh/App/Core/Grid.cpp @@ -101,8 +101,6 @@ void MeshGrid::InitGrid() { assert(_pclMesh); - unsigned long i, j; - // Calculate grid length if not initialised // if ((_ulCtGridsX == 0) || (_ulCtGridsY == 0) || (_ulCtGridsZ == 0)) { @@ -139,9 +137,9 @@ void MeshGrid::InitGrid() // Create data structure _aulGrid.clear(); _aulGrid.resize(_ulCtGridsX); - for (i = 0; i < _ulCtGridsX; i++) { + for (unsigned long i = 0; i < _ulCtGridsX; i++) { _aulGrid[i].resize(_ulCtGridsY); - for (j = 0; j < _ulCtGridsY; j++) { + for (unsigned long j = 0; j < _ulCtGridsY; j++) { _aulGrid[i][j].resize(_ulCtGridsZ); } } @@ -151,7 +149,7 @@ unsigned long MeshGrid::Inside(const Base::BoundBox3f& rclBB, std::vector& raulElements, bool bDelDoubles) const { - unsigned long i, j, k, ulMinX, ulMinY, ulMinZ, ulMaxX, ulMaxY, ulMaxZ; + unsigned long ulMinX {}, ulMinY {}, ulMinZ {}, ulMaxX {}, ulMaxY {}, ulMaxZ {}; raulElements.clear(); @@ -159,9 +157,9 @@ unsigned long MeshGrid::Inside(const Base::BoundBox3f& rclBB, Position(Base::Vector3f(rclBB.MinX, rclBB.MinY, rclBB.MinZ), ulMinX, ulMinY, ulMinZ); Position(Base::Vector3f(rclBB.MaxX, rclBB.MaxY, rclBB.MaxZ), ulMaxX, ulMaxY, ulMaxZ); - for (i = ulMinX; i <= ulMaxX; i++) { - for (j = ulMinY; j <= ulMaxY; j++) { - for (k = ulMinZ; k <= ulMaxZ; k++) { + for (auto i = ulMinX; i <= ulMaxX; i++) { + for (auto j = ulMinY; j <= ulMaxY; j++) { + for (auto k = ulMinZ; k <= ulMaxZ; k++) { raulElements.insert(raulElements.end(), _aulGrid[i][j][k].begin(), _aulGrid[i][j][k].end()); @@ -185,7 +183,7 @@ unsigned long MeshGrid::Inside(const Base::BoundBox3f& rclBB, float fMaxDist, bool bDelDoubles) const { - unsigned long i, j, k, ulMinX, ulMinY, ulMinZ, ulMaxX, ulMaxY, ulMaxZ; + unsigned long ulMinX {}, ulMinY {}, ulMinZ {}, ulMaxX {}, ulMaxY {}, ulMaxZ {}; float fGridDiag = GetBoundBox(0, 0, 0).CalcDiagonalLength(); float fMinDistP2 = (fGridDiag * fGridDiag) + (fMaxDist * fMaxDist); @@ -195,9 +193,9 @@ unsigned long MeshGrid::Inside(const Base::BoundBox3f& rclBB, Position(Base::Vector3f(rclBB.MinX, rclBB.MinY, rclBB.MinZ), ulMinX, ulMinY, ulMinZ); Position(Base::Vector3f(rclBB.MaxX, rclBB.MaxY, rclBB.MaxZ), ulMaxX, ulMaxY, ulMaxZ); - for (i = ulMinX; i <= ulMaxX; i++) { - for (j = ulMinY; j <= ulMaxY; j++) { - for (k = ulMinZ; k <= ulMaxZ; k++) { + for (auto i = ulMinX; i <= ulMaxX; i++) { + for (auto j = ulMinY; j <= ulMaxY; j++) { + for (auto k = ulMinZ; k <= ulMaxZ; k++) { if (Base::DistanceP2(GetBoundBox(i, j, k).GetCenter(), rclOrg) < fMinDistP2) { raulElements.insert(raulElements.end(), _aulGrid[i][j][k].begin(), @@ -220,7 +218,7 @@ unsigned long MeshGrid::Inside(const Base::BoundBox3f& rclBB, unsigned long MeshGrid::Inside(const Base::BoundBox3f& rclBB, std::set& raulElements) const { - unsigned long i, j, k, ulMinX, ulMinY, ulMinZ, ulMaxX, ulMaxY, ulMaxZ; + unsigned long ulMinX {}, ulMinY {}, ulMinZ {}, ulMaxX {}, ulMaxY {}, ulMaxZ {}; raulElements.clear(); @@ -228,9 +226,9 @@ unsigned long MeshGrid::Inside(const Base::BoundBox3f& rclBB, Position(Base::Vector3f(rclBB.MinX, rclBB.MinY, rclBB.MinZ), ulMinX, ulMinY, ulMinZ); Position(Base::Vector3f(rclBB.MaxX, rclBB.MaxY, rclBB.MaxZ), ulMaxX, ulMaxY, ulMaxZ); - for (i = ulMinX; i <= ulMaxX; i++) { - for (j = ulMinY; j <= ulMaxY; j++) { - for (k = ulMinZ; k <= ulMaxZ; k++) { + for (auto i = ulMinX; i <= ulMaxX; i++) { + for (auto j = ulMinY; j <= ulMaxY; j++) { + for (auto k = ulMinZ; k <= ulMaxZ; k++) { raulElements.insert(_aulGrid[i][j][k].begin(), _aulGrid[i][j][k].end()); } } @@ -302,7 +300,7 @@ void MeshGrid::CalculateGridLength(unsigned long ulCtGrid, unsigned long ulMaxGr float fVolume = fLenX * fLenY * fLenZ; if (fVolume > 0.0f) { - float fVolElem; + float fVolElem {}; if (_ulCtElements > (ulMaxGrids * ulCtGrid)) { fVolElem = (fLenX * fLenY * fLenZ) / float(ulMaxGrids * ulCtGrid); } @@ -316,7 +314,7 @@ void MeshGrid::CalculateGridLength(unsigned long ulCtGrid, unsigned long ulMaxGr else { // Planar bounding box float fArea = fLenX * fLenY + fLenX * fLenZ + fLenY * fLenZ; - float fAreaElem; + float fAreaElem {}; if (_ulCtElements > (ulMaxGrids * ulCtGrid)) { fAreaElem = fArea / float(ulMaxGrids * ulCtGrid); } @@ -499,7 +497,7 @@ void MeshGrid::SearchNearestFromPoint(const Base::Vector3f& rclPt, Base::BoundBox3f clBB = GetBoundBox(); if (clBB.IsInBox(rclPt)) { // Point lies within - unsigned long ulX, ulY, ulZ; + unsigned long ulX {}, ulY {}, ulZ {}; Position(rclPt, ulX, ulY, ulZ); // int nX = ulX, nY = ulY, nZ = ulZ; unsigned long ulMaxLevel = @@ -605,11 +603,9 @@ void MeshGrid::GetHull(unsigned long ulX, int nY2 = std::min(int(_ulCtGridsY) - 1, int(ulY) + int(ulDistance)); int nZ2 = std::min(int(_ulCtGridsZ) - 1, int(ulZ) + int(ulDistance)); - int i, j; - // top plane - for (i = nX1; i <= nX2; i++) { - for (j = nY1; j <= nY2; j++) { + for (int i = nX1; i <= nX2; i++) { + for (int j = nY1; j <= nY2; j++) { GetElements(static_cast(i), static_cast(j), static_cast(nZ1), @@ -617,8 +613,8 @@ void MeshGrid::GetHull(unsigned long ulX, } } // bottom plane - for (i = nX1; i <= nX2; i++) { - for (j = nY1; j <= nY2; j++) { + for (int i = nX1; i <= nX2; i++) { + for (int j = nY1; j <= nY2; j++) { GetElements(static_cast(i), static_cast(j), static_cast(nZ2), @@ -626,8 +622,8 @@ void MeshGrid::GetHull(unsigned long ulX, } } // left plane - for (i = nY1; i <= nY2; i++) { - for (j = (nZ1 + 1); j <= (nZ2 - 1); j++) { + for (int i = nY1; i <= nY2; i++) { + for (int j = (nZ1 + 1); j <= (nZ2 - 1); j++) { GetElements(static_cast(nX1), static_cast(i), static_cast(j), @@ -635,8 +631,8 @@ void MeshGrid::GetHull(unsigned long ulX, } } // right plane - for (i = nY1; i <= nY2; i++) { - for (j = (nZ1 + 1); j <= (nZ2 - 1); j++) { + for (int i = nY1; i <= nY2; i++) { + for (int j = (nZ1 + 1); j <= (nZ2 - 1); j++) { GetElements(static_cast(nX2), static_cast(i), static_cast(j), @@ -644,8 +640,8 @@ void MeshGrid::GetHull(unsigned long ulX, } } // front plane - for (i = (nX1 + 1); i <= (nX2 - 1); i++) { - for (j = (nZ1 + 1); j <= (nZ2 - 1); j++) { + for (int i = (nX1 + 1); i <= (nX2 - 1); i++) { + for (int j = (nZ1 + 1); j <= (nZ2 - 1); j++) { GetElements(static_cast(i), static_cast(nY1), static_cast(j), @@ -653,8 +649,8 @@ void MeshGrid::GetHull(unsigned long ulX, } } // back plane - for (i = (nX1 + 1); i <= (nX2 - 1); i++) { - for (j = (nZ1 + 1); j <= (nZ2 - 1); j++) { + for (int i = (nX1 + 1); i <= (nX2 - 1); i++) { + for (int j = (nZ1 + 1); j <= (nZ2 - 1); j++) { GetElements(static_cast(i), static_cast(nY2), static_cast(j), @@ -680,7 +676,7 @@ unsigned long MeshGrid::GetElements(unsigned long ulX, unsigned long MeshGrid::GetElements(const Base::Vector3f& rclPoint, std::vector& aulFacets) const { - unsigned long ulX, ulY, ulZ; + unsigned long ulX {}, ulY {}, ulZ {}; if (!CheckPosition(rclPoint, ulX, ulY, ulZ)) { return 0; } @@ -724,7 +720,7 @@ bool MeshGrid::GetPositionToIndex(unsigned long id, MeshFacetGrid::MeshFacetGrid(const MeshKernel& rclM) : MeshGrid(rclM) { - RebuildGrid(); + MeshFacetGrid::RebuildGrid(); } MeshFacetGrid::MeshFacetGrid(const MeshKernel& rclM, int iCtGridPerAxis) @@ -820,7 +816,7 @@ unsigned long MeshFacetGrid::SearchNearestFromPoint(const Base::Vector3f& rclPt) Base::BoundBox3f clBB = GetBoundBox(); if (clBB.IsInBox(rclPt)) { // Point lies within - unsigned long ulX, ulY, ulZ; + unsigned long ulX {}, ulY {}, ulZ {}; Position(rclPt, ulX, ulY, ulZ); float fMinGridDist = std::min(std::min(_fGridLenX, _fGridLenY), _fGridLenZ); unsigned long ulDistance = 0; @@ -938,7 +934,7 @@ unsigned long MeshFacetGrid::SearchNearestFromPoint(const Base::Vector3f& rclPt, Inside(clBB, aulFacets, rclPt, fMaxSearchArea, true); for (ElementIndex facet : aulFacets) { - float fDist; + float fDist {}; if (clFTool.Distance(rclPt, facet, fMinDist, fDist)) { fMinDist = fDist; @@ -964,11 +960,9 @@ void MeshFacetGrid::SearchNearestFacetInHull(unsigned long ulX, int nY2 = std::min(int(_ulCtGridsY) - 1, int(ulY) + int(ulDistance)); int nZ2 = std::min(int(_ulCtGridsZ) - 1, int(ulZ) + int(ulDistance)); - int i, j; - // top plane - for (i = nX1; i <= nX2; i++) { - for (j = nY1; j <= nY2; j++) { + for (int i = nX1; i <= nX2; i++) { + for (int j = nY1; j <= nY2; j++) { SearchNearestFacetInGrid(static_cast(i), static_cast(j), static_cast(nZ1), @@ -978,8 +972,8 @@ void MeshFacetGrid::SearchNearestFacetInHull(unsigned long ulX, } } // bottom plane - for (i = nX1; i <= nX2; i++) { - for (j = nY1; j <= nY2; j++) { + for (int i = nX1; i <= nX2; i++) { + for (int j = nY1; j <= nY2; j++) { SearchNearestFacetInGrid(static_cast(i), static_cast(j), static_cast(nZ2), @@ -989,8 +983,8 @@ void MeshFacetGrid::SearchNearestFacetInHull(unsigned long ulX, } } // left plane - for (i = nY1; i <= nY2; i++) { - for (j = (nZ1 + 1); j <= (nZ2 - 1); j++) { + for (int i = nY1; i <= nY2; i++) { + for (int j = (nZ1 + 1); j <= (nZ2 - 1); j++) { SearchNearestFacetInGrid(static_cast(nX1), static_cast(i), static_cast(j), @@ -1000,8 +994,8 @@ void MeshFacetGrid::SearchNearestFacetInHull(unsigned long ulX, } } // right plane - for (i = nY1; i <= nY2; i++) { - for (j = (nZ1 + 1); j <= (nZ2 - 1); j++) { + for (int i = nY1; i <= nY2; i++) { + for (int j = (nZ1 + 1); j <= (nZ2 - 1); j++) { SearchNearestFacetInGrid(static_cast(nX2), static_cast(i), static_cast(j), @@ -1011,8 +1005,8 @@ void MeshFacetGrid::SearchNearestFacetInHull(unsigned long ulX, } } // front plane - for (i = (nX1 + 1); i <= (nX2 - 1); i++) { - for (j = (nZ1 + 1); j <= (nZ2 - 1); j++) { + for (int i = (nX1 + 1); i <= (nX2 - 1); i++) { + for (int j = (nZ1 + 1); j <= (nZ2 - 1); j++) { SearchNearestFacetInGrid(static_cast(i), static_cast(nY1), static_cast(j), @@ -1022,8 +1016,8 @@ void MeshFacetGrid::SearchNearestFacetInHull(unsigned long ulX, } } // back plane - for (i = (nX1 + 1); i <= (nX2 - 1); i++) { - for (j = (nZ1 + 1); j <= (nZ2 - 1); j++) { + for (int i = (nX1 + 1); i <= (nX2 - 1); i++) { + for (int j = (nZ1 + 1); j <= (nZ2 - 1); j++) { SearchNearestFacetInGrid(static_cast(i), static_cast(nY2), static_cast(j), @@ -1056,7 +1050,7 @@ void MeshFacetGrid::SearchNearestFacetInGrid(unsigned long ulX, MeshPointGrid::MeshPointGrid(const MeshKernel& rclM) : MeshGrid(rclM) { - RebuildGrid(); + MeshPointGrid::RebuildGrid(); } MeshPointGrid::MeshPointGrid() @@ -1090,7 +1084,7 @@ MeshPointGrid::MeshPointGrid(const MeshKernel& rclM, float fGridLen) void MeshPointGrid::AddPoint(const MeshPoint& rclPt, ElementIndex ulPtIndex, float fEpsilon) { (void)fEpsilon; - unsigned long ulX, ulY, ulZ; + unsigned long ulX {}, ulY {}, ulZ {}; Pos(Base::Vector3f(rclPt.x, rclPt.y, rclPt.z), ulX, ulY, ulZ); if ((ulX < _ulCtGridsX) && (ulY < _ulCtGridsY) && (ulZ < _ulCtGridsZ)) { _aulGrid[ulX][ulY][ulZ].insert(ulPtIndex); @@ -1172,7 +1166,7 @@ void MeshPointGrid::Pos(const Base::Vector3f& rclPoint, unsigned long MeshPointGrid::FindElements(const Base::Vector3f& rclPoint, std::set& aulElements) const { - unsigned long ulX, ulY, ulZ; + unsigned long ulX {}, ulY {}, ulZ {}; Pos(rclPoint, ulX, ulY, ulZ); // check if the given point is inside the grid structure diff --git a/src/Mod/Mesh/App/Core/Grid.h b/src/Mod/Mesh/App/Core/Grid.h index ab9ebd5be9..631b3f8c30 100644 --- a/src/Mod/Mesh/App/Core/Grid.h +++ b/src/Mod/Mesh/App/Core/Grid.h @@ -61,6 +61,10 @@ protected: explicit MeshGrid(const MeshKernel& rclM); /// Construction MeshGrid(); + MeshGrid(const MeshGrid&) = default; + MeshGrid(MeshGrid&&) = default; + MeshGrid& operator=(const MeshGrid&) = default; + MeshGrid& operator=(MeshGrid&&) = default; //@} public: @@ -195,6 +199,7 @@ protected: virtual unsigned long HasElements() const = 0; protected: + // NOLINTBEGIN std::vector>>> _aulGrid; /**< Grid data structure. */ const MeshKernel* _pclMesh; /**< The mesh kernel. */ @@ -208,6 +213,7 @@ protected: float _fMinX; /**< Grid null position in x. */ float _fMinY; /**< Grid null position in y. */ float _fMinZ; /**< Grid null position in z. */ + // NOLINTEND // friends friend class MeshGridIterator; @@ -234,8 +240,12 @@ public: MeshFacetGrid(const MeshKernel& rclM, int iCtGridPerAxis); /// Construction MeshFacetGrid(const MeshKernel& rclM, float fGridLen); + MeshFacetGrid(const MeshFacetGrid&) = default; + MeshFacetGrid(MeshFacetGrid&&) = default; /// Destruction ~MeshFacetGrid() override = default; + MeshFacetGrid& operator=(const MeshFacetGrid&) = default; + MeshFacetGrid& operator=(MeshFacetGrid&&) = default; //@} /** @name Search */ @@ -314,8 +324,12 @@ public: MeshPointGrid(const MeshKernel& rclM, float fGridLen); /// Construction MeshPointGrid(const MeshKernel& rclM, unsigned long ulX, unsigned long ulY, unsigned long ulZ); + MeshPointGrid(const MeshPointGrid&) = default; + MeshPointGrid(MeshPointGrid&&) = default; /// Destruction ~MeshPointGrid() override = default; + MeshPointGrid& operator=(const MeshPointGrid&) = default; + MeshPointGrid& operator=(MeshPointGrid&&) = default; //@} /** Finds all points that lie in the same grid as the point \a rclPoint. */ @@ -427,6 +441,12 @@ public: } protected: + const MeshGrid& GetGrid() const + { + return _rclGrid; + } + +private: const MeshGrid& _rclGrid; /**< The mesh kernel. */ unsigned long _ulX {0}; /**< Number of grids in x. */ unsigned long _ulY {0}; /**< Number of grids in y. */ @@ -439,11 +459,10 @@ protected: struct GridElement { GridElement(unsigned long x, unsigned long y, unsigned long z) - { - this->x = x; - this->y = y; - this->z = z; - } + : x(x) + , y(y) + , z(z) + {} bool operator<(const GridElement& pos) const { if (x == pos.x) { @@ -470,7 +489,7 @@ protected: inline Base::BoundBox3f MeshGrid::GetBoundBox(unsigned long ulX, unsigned long ulY, unsigned long ulZ) const { - float fX, fY, fZ; + float fX {}, fY {}, fZ {}; fX = _fMinX + (float(ulX) * _fGridLenX); fY = _fMinY + (float(ulY) * _fGridLenY); @@ -558,9 +577,9 @@ inline void MeshFacetGrid::AddFacet(const MeshGeomFacet& rclFacet, ElementIndex ulFacetIndex, float /*fEpsilon*/) { - unsigned long ulX, ulY, ulZ; + unsigned long ulX {}, ulY {}, ulZ {}; - unsigned long ulX1, ulY1, ulZ1, ulX2, ulY2, ulZ2; + unsigned long ulX1 {}, ulY1 {}, ulZ1 {}, ulX2 {}, ulY2 {}, ulZ2 {}; Base::BoundBox3f clBB; diff --git a/src/Mod/Mesh/App/Core/Helpers.h b/src/Mod/Mesh/App/Core/Helpers.h index 0e7ab2f5bc..ac5e94c48e 100644 --- a/src/Mod/Mesh/App/Core/Helpers.h +++ b/src/Mod/Mesh/App/Core/Helpers.h @@ -50,7 +50,7 @@ struct MeshExport MeshHelpPoint } MeshPoint _clPt; - FacetIndex _ulInd; + FacetIndex _ulInd {FACET_INDEX_MAX}; }; /** @@ -170,7 +170,7 @@ inline bool MeshHelpBuilderEdge::operator!=(const MeshHelpBuilderEdge& rclObj) c inline void MeshEdgeBuilder::Add(PointIndex ulInd1, PointIndex ulInd2, FacetIndex ulSide, FacetIndex ulFInd) { - MeshHelpBuilderEdge clObj; + MeshHelpBuilderEdge clObj {}; clObj.Set(ulInd1, ulInd2, ulSide, ulFInd); push_back(clObj); } diff --git a/src/Mod/Mesh/App/Core/IO/ReaderOBJ.cpp b/src/Mod/Mesh/App/Core/IO/ReaderOBJ.cpp index 706442f87c..1cc2d45ef9 100644 --- a/src/Mod/Mesh/App/Core/IO/ReaderOBJ.cpp +++ b/src/Mod/Mesh/App/Core/IO/ReaderOBJ.cpp @@ -74,7 +74,7 @@ bool ReaderOBJ::Load(std::istream& str) MeshFacetArray meshFacets; std::string line; - float fX, fY, fZ; + float fX {}, fY {}, fZ {}; int i1 = 1, i2 = 1, i3 = 1, i4 = 1; MeshFacet item; diff --git a/src/Mod/Mesh/App/Core/IO/WriterOBJ.cpp b/src/Mod/Mesh/App/Core/IO/WriterOBJ.cpp index 6ae501772b..73908022bb 100644 --- a/src/Mod/Mesh/App/Core/IO/WriterOBJ.cpp +++ b/src/Mod/Mesh/App/Core/IO/WriterOBJ.cpp @@ -153,7 +153,7 @@ bool WriterOBJ::Save(std::ostream& out) } // Export normals MeshFacetIterator clIter(_kernel), clEnd(_kernel); - const MeshGeomFacet* pclFacet; + const MeshGeomFacet* pclFacet {}; clIter.Begin(); clEnd.End(); diff --git a/src/Mod/Mesh/App/Core/Info.cpp b/src/Mod/Mesh/App/Core/Info.cpp index 2269f567b5..1bde0af7a6 100644 --- a/src/Mod/Mesh/App/Core/Info.cpp +++ b/src/Mod/Mesh/App/Core/Info.cpp @@ -41,7 +41,7 @@ MeshInfo::MeshInfo(const MeshKernel& rclM) std::ostream& MeshInfo::GeneralInformation(std::ostream& rclStream) const { - unsigned long ulCtPt, ulCtEd, ulCtFc; + unsigned long ulCtPt {}, ulCtEd {}, ulCtFc {}; ulCtPt = _rclMesh.CountPoints(); ulCtFc = _rclMesh.CountFacets(); ulCtEd = _rclMesh.CountEdges(); @@ -126,7 +126,7 @@ std::ostream& MeshInfo::DetailedEdgeInfo(std::ostream& rclStream) const std::ostream& MeshInfo::DetailedFacetInfo(std::ostream& rclStream) const { // print facets - unsigned long i, j; + unsigned long i {}, j {}; rclStream << _rclMesh.CountFacets() << " Faces:" << std::endl; MeshFacetIterator pFIter(_rclMesh), pFEnd(_rclMesh); pFIter.Begin(); @@ -163,7 +163,7 @@ std::ostream& MeshInfo::DetailedInformation(std::ostream& rclStream) const std::ostream& MeshInfo::InternalPointInfo(std::ostream& rclStream) const { // print points - unsigned long i; + unsigned long i {}; rclStream << _rclMesh.CountPoints() << " Points:" << std::endl; MeshPointIterator pPIter(_rclMesh), pPEnd(_rclMesh); pPIter.Begin(); @@ -190,7 +190,7 @@ std::ostream& MeshInfo::InternalPointInfo(std::ostream& rclStream) const std::ostream& MeshInfo::InternalFacetInfo(std::ostream& rclStream) const { // print facets - unsigned long i; + unsigned long i {}; rclStream << _rclMesh.CountFacets() << " Faces:" << std::endl; const MeshFacetArray& rFacets = _rclMesh.GetFacets(); diff --git a/src/Mod/Mesh/App/Core/Info.h b/src/Mod/Mesh/App/Core/Info.h index 930c89a54e..9789596f8d 100644 --- a/src/Mod/Mesh/App/Core/Info.h +++ b/src/Mod/Mesh/App/Core/Info.h @@ -79,11 +79,15 @@ protected: std::ostream& InternalFacetInfo(std::ostream& rclStream) const; -protected: +private: const MeshKernel& _rclMesh; // const reference to mesh data structure public: MeshInfo() = delete; // not accessible default constructor + MeshInfo(const MeshInfo&) = delete; + MeshInfo(MeshInfo&&) = delete; + MeshInfo& operator=(const MeshInfo&) = delete; + MeshInfo& operator=(MeshInfo&&) = delete; }; diff --git a/src/Mod/Mesh/App/Core/Iterator.h b/src/Mod/Mesh/App/Core/Iterator.h index ec10a72bdd..607c861c6b 100644 --- a/src/Mod/Mesh/App/Core/Iterator.h +++ b/src/Mod/Mesh/App/Core/Iterator.h @@ -57,6 +57,8 @@ public: inline MeshFacetIterator(const MeshKernel& rclM, FacetIndex ulPos); /// construction inline MeshFacetIterator(const MeshFacetIterator& rclI); + inline MeshFacetIterator(MeshFacetIterator&& rclI); + ~MeshFacetIterator() = default; //@} /** @name Transformation */ @@ -105,6 +107,7 @@ public: } /// Assignment. inline MeshFacetIterator& operator=(const MeshFacetIterator& rpI); + inline MeshFacetIterator& operator=(MeshFacetIterator&& rpI); /// Compares if this iterator points to a lower element than the other one. bool operator<(const MeshFacetIterator& rclI) const { @@ -205,7 +208,7 @@ public: protected: inline const MeshGeomFacet& Dereference(); -protected: +private: const MeshKernel& _rclMesh; const MeshFacetArray& _rclFAry; const MeshPointArray& _rclPAry; @@ -230,6 +233,8 @@ public: inline explicit MeshPointIterator(const MeshKernel& rclM); inline MeshPointIterator(const MeshKernel& rclM, PointIndex ulPos); inline MeshPointIterator(const MeshPointIterator& rclI); + inline MeshPointIterator(MeshPointIterator&& rclI); + ~MeshPointIterator() = default; //@} /** @name Transformation */ @@ -266,6 +271,7 @@ public: } /// Assignment. inline MeshPointIterator& operator=(const MeshPointIterator& rpI); + inline MeshPointIterator& operator=(MeshPointIterator&& rpI); /// Compares if this iterator points to a lower element than the other one. bool operator<(const MeshPointIterator& rclI) const { @@ -345,10 +351,10 @@ public: } //@} -protected: +private: inline const MeshPoint& Dereference() const; -protected: +private: const MeshKernel& _rclMesh; const MeshPointArray& _rclPAry; mutable MeshPoint _clPoint; @@ -376,22 +382,22 @@ public: return _clIter != _rclFAry.end(); } - Base::Vector3f _afPoints[3]; + Base::Vector3f _afPoints[3]; // NOLINT -protected: - const MeshKernel& _rclMesh; +private: const MeshFacetArray& _rclFAry; const MeshPointArray& _rclPAry; MeshFacetArray::_TConstIterator _clIter; public: MeshFastFacetIterator(const MeshFastFacetIterator&) = delete; + MeshFastFacetIterator(MeshFastFacetIterator&&) = delete; void operator=(const MeshFastFacetIterator&) = delete; + void operator=(MeshFastFacetIterator&&) = delete; }; inline MeshFastFacetIterator::MeshFastFacetIterator(const MeshKernel& rclM) - : _rclMesh(rclM) - , _rclFAry(rclM._aclFacetArray) + : _rclFAry(rclM._aclFacetArray) , _rclPAry(rclM._aclPointArray) , _clIter(_rclFAry.begin()) {} @@ -430,6 +436,15 @@ inline MeshFacetIterator::MeshFacetIterator(const MeshFacetIterator& rclI) , _clTrf(rclI._clTrf) {} +inline MeshFacetIterator::MeshFacetIterator(MeshFacetIterator&& rclI) + : _rclMesh(rclI._rclMesh) + , _rclFAry(rclI._rclFAry) + , _rclPAry(rclI._rclPAry) + , _clIter(rclI._clIter) + , _bApply(rclI._bApply) + , _clTrf(rclI._clTrf) +{} + inline void MeshFacetIterator::Transform(const Base::Matrix4D& rclTrf) { _clTrf = rclTrf; @@ -477,6 +492,14 @@ inline MeshFacetIterator& MeshFacetIterator::operator=(const MeshFacetIterator& return *this; } +inline MeshFacetIterator& MeshFacetIterator::operator=(MeshFacetIterator&& rpI) +{ + _clIter = rpI._clIter; + _bApply = rpI._bApply; + _clTrf = rpI._clTrf; + return *this; +} + inline unsigned long MeshFacetIterator::GetProperty() const { return _clIter->_ulProp; @@ -542,6 +565,14 @@ inline MeshPointIterator::MeshPointIterator(const MeshPointIterator& rclI) , _clTrf(rclI._clTrf) {} +inline MeshPointIterator::MeshPointIterator(MeshPointIterator&& rclI) + : _rclMesh(rclI._rclMesh) + , _rclPAry(rclI._rclPAry) + , _clIter(rclI._clIter) + , _bApply(rclI._bApply) + , _clTrf(rclI._clTrf) +{} + inline void MeshPointIterator::Transform(const Base::Matrix4D& rclTrf) { _clTrf = rclTrf; @@ -580,6 +611,14 @@ inline MeshPointIterator& MeshPointIterator::operator=(const MeshPointIterator& return *this; } +inline MeshPointIterator& MeshPointIterator::operator=(MeshPointIterator&& rpI) +{ + _clIter = rpI._clIter; + _bApply = rpI._bApply; + _clTrf = rpI._clTrf; + return *this; +} + } // namespace MeshCore diff --git a/src/Mod/Mesh/App/Core/KDTree.h b/src/Mod/Mesh/App/Core/KDTree.h index 4116cf6915..41dec24dd9 100644 --- a/src/Mod/Mesh/App/Core/KDTree.h +++ b/src/Mod/Mesh/App/Core/KDTree.h @@ -51,13 +51,14 @@ public: PointIndex FindExact(const Base::Vector3f& p) const; void FindInRange(const Base::Vector3f&, float, std::vector&) const; + MeshKDTree(const MeshKDTree&) = delete; + MeshKDTree(MeshKDTree&&) = delete; + void operator=(const MeshKDTree&) = delete; + void operator=(MeshKDTree&&) = delete; + private: class Private; Private* d; - -public: - MeshKDTree(const MeshKDTree&) = delete; - void operator=(const MeshKDTree&) = delete; }; } // namespace MeshCore diff --git a/src/Mod/Mesh/App/Core/MeshIO.cpp b/src/Mod/Mesh/App/Core/MeshIO.cpp index 9f3319e2ad..81eb43b674 100644 --- a/src/Mod/Mesh/App/Core/MeshIO.cpp +++ b/src/Mod/Mesh/App/Core/MeshIO.cpp @@ -297,7 +297,7 @@ bool MeshInput::LoadSTL(std::istream& rstrIn) return false; } buf->pubseekoff(80, std::ios::beg, std::ios::in); - uint32_t ulCt, ulBytes = 50; + uint32_t ulCt {}, ulBytes = 50; rstrIn.read((char*)&ulCt, sizeof(ulCt)); // if we have a binary STL with a single triangle we can only read-in 50 bytes if (ulCt > 1) { @@ -393,7 +393,7 @@ bool MeshInput::LoadSMF(std::istream& rstrIn) MeshFacetArray meshFacets; std::string line; - float fX, fY, fZ; + float fX {}, fY {}, fZ {}; int i1 = 1, i2 = 1, i3 = 1; MeshFacet item; @@ -510,7 +510,7 @@ bool MeshInput::LoadOFF(std::istream& rstrIn) continue; // empty line } - float fX, fY, fZ; + float fX {}, fY {}, fZ {}; str >> fX >> std::ws >> fY >> std::ws >> fZ; if (str) { meshPoints.push_back(MeshPoint(Base::Vector3f(fX, fY, fZ))); @@ -519,7 +519,7 @@ bool MeshInput::LoadOFF(std::istream& rstrIn) if (colorPerVertex) { std::size_t pos = std::size_t(str.tellg()); if (line.size() > pos) { - float r, g, b, a; + float r {}, g {}, b {}, a {}; str >> std::ws >> r >> std::ws >> g >> std::ws >> b; if (str) { str >> std::ws >> a; @@ -552,7 +552,7 @@ bool MeshInput::LoadOFF(std::istream& rstrIn) if (str.eof()) { continue; // empty line } - int count, index; + int count {}, index {}; str >> count; if (count >= 3) { std::vector faces; @@ -572,7 +572,7 @@ bool MeshInput::LoadOFF(std::istream& rstrIn) std::size_t pos = std::size_t(str.tellg()); if (line.size() > pos) { - float r, g, b, a; + float r {}, g {}, b {}, a {}; str >> std::ws >> r >> std::ws >> g >> std::ws >> b; if (str) { str >> std::ws >> a; @@ -704,7 +704,7 @@ bool MeshInput::LoadPLY(std::istream& inp) str >> kw; if (kw == "format") { std::string format_string, version; - char space_format_string, space_format_version; + char space_format_string {}, space_format_version {}; str >> space_format_string >> std::ws >> format_string >> space_format_version >> std::ws >> version; if (/*!str || !str.eof() ||*/ @@ -731,8 +731,8 @@ bool MeshInput::LoadPLY(std::istream& inp) } else if (kw == "element") { std::string name; - std::size_t count; - char space_element_name, space_name_count; + std::size_t count {}; + char space_element_name {}, space_name_count {}; str >> space_element_name >> std::ws >> name >> space_name_count >> std::ws >> count; if (/*!str || !str.eof() ||*/ !std::isspace(space_element_name) || !std::isspace(space_name_count)) { @@ -754,11 +754,11 @@ bool MeshInput::LoadPLY(std::istream& inp) } else if (kw == "property") { std::string type, name; - char space; + char space {}; if (element == "vertex") { str >> space >> std::ws >> type >> space >> std::ws >> name >> std::ws; - Ply::Number number; + Ply::Number number {}; if (type == "char" || type == "int8") { number = int8; } @@ -803,7 +803,7 @@ bool MeshInput::LoadPLY(std::istream& inp) str >> name; } if (name != "vertex_indices" && name != "vertex_index") { - Number number; + Number number {}; if (type == "char" || type == "int8") { number = int8; } @@ -930,7 +930,7 @@ bool MeshInput::LoadPLY(std::istream& inp) case int16: case int32: { if (boost::regex_search(line, what, rx_s)) { - int v; + int v {}; v = boost::lexical_cast(what[1]); prop_values[it.first] = static_cast(v); line = line.substr(what[0].length()); @@ -943,7 +943,7 @@ bool MeshInput::LoadPLY(std::istream& inp) case uint16: case uint32: { if (boost::regex_search(line, what, rx_u)) { - int v; + int v {}; v = boost::lexical_cast(what[1]); prop_values[it.first] = static_cast(v); line = line.substr(what[0].length()); @@ -955,7 +955,7 @@ bool MeshInput::LoadPLY(std::istream& inp) case float32: case float64: { if (boost::regex_search(line, what, rx_d)) { - double v; + double v {}; v = boost::lexical_cast(what[1]); prop_values[it.first] = static_cast(v); line = line.substr(what[0].length()); @@ -983,7 +983,7 @@ bool MeshInput::LoadPLY(std::istream& inp) } } - int f1, f2, f3; + int f1 {}, f2 {}, f3 {}; for (std::size_t i = 0; i < f_count && std::getline(inp, line); i++) { if (boost::regex_search(line, what, rx_f)) { f1 = boost::lexical_cast(what[1]); @@ -1009,42 +1009,42 @@ bool MeshInput::LoadPLY(std::istream& inp) for (const auto& it : vertex_props) { switch (it.second) { case int8: { - int8_t v; + int8_t v {}; is >> v; prop_values[it.first] = static_cast(v); } break; case uint8: { - uint8_t v; + uint8_t v {}; is >> v; prop_values[it.first] = static_cast(v); } break; case int16: { - int16_t v; + int16_t v {}; is >> v; prop_values[it.first] = static_cast(v); } break; case uint16: { - uint16_t v; + uint16_t v {}; is >> v; prop_values[it.first] = static_cast(v); } break; case int32: { - int32_t v; + int32_t v {}; is >> v; prop_values[it.first] = static_cast(v); } break; case uint32: { - uint32_t v; + uint32_t v {}; is >> v; prop_values[it.first] = static_cast(v); } break; case float32: { - float v; + float v {}; is >> v; prop_values[it.first] = v; } break; case float64: { - double v; + double v {}; is >> v; prop_values[it.first] = static_cast(v); } break; @@ -1067,8 +1067,8 @@ bool MeshInput::LoadPLY(std::istream& inp) } } - unsigned char n; - uint32_t f1, f2, f3; + unsigned char n {}; + uint32_t f1 {}, f2 {}, f3 {}; for (std::size_t i = 0; i < f_count; i++) { is >> n; if (n == 3) { @@ -1079,39 +1079,39 @@ bool MeshInput::LoadPLY(std::istream& inp) for (auto it : face_props) { switch (it) { case int8: { - int8_t v; + int8_t v {}; is >> v; } break; case uint8: { - uint8_t v; + uint8_t v {}; is >> v; } break; case int16: { - int16_t v; + int16_t v {}; is >> v; } break; case uint16: { - uint16_t v; + uint16_t v {}; is >> v; } break; case int32: { - int32_t v; + int32_t v {}; is >> v; } break; case uint32: { - uint32_t v; + uint32_t v {}; is >> v; } break; case float32: { is >> n; - float v; + float v {}; for (unsigned char j = 0; j < n; j++) { is >> v; } } break; case float64: { is >> n; - double v; + double v {}; for (unsigned char j = 0; j < n; j++) { is >> v; } @@ -1151,7 +1151,7 @@ bool MeshInput::LoadMeshNode(std::istream& rstrIn) MeshFacetArray meshFacets; std::string line; - float fX, fY, fZ; + float fX {}, fY {}, fZ {}; unsigned int i1 = 1, i2 = 1, i3 = 1; MeshGeomFacet clFacet; @@ -1206,8 +1206,8 @@ bool MeshInput::LoadAsciiSTL(std::istream& rstrIn) boost::cmatch what; std::string line; - float fX, fY, fZ; - unsigned long ulVertexCt, ulFacetCt = 0; + float fX {}, fY {}, fZ {}; + unsigned long ulVertexCt {}, ulFacetCt {}; MeshGeomFacet clFacet; if (!rstrIn || rstrIn.bad()) { @@ -1296,7 +1296,7 @@ bool MeshInput::LoadBinarySTL(std::istream& rstrIn) std::streamoff ulSize = 0; std::streambuf* buf = rstrIn.rdbuf(); if (buf) { - std::streamoff ulCurr; + std::streamoff ulCurr {}; ulCurr = buf->pubseekoff(0, std::ios::cur, std::ios::in); ulSize = buf->pubseekoff(0, std::ios::end, std::ios::in); buf->pubseekoff(ulCurr, std::ios::beg, std::ios::in); @@ -1461,7 +1461,7 @@ bool MeshInput::LoadNastran(std::istream& rstrIn) MeshPointArray vVertices; MeshFacetArray vTriangle; - int index; + int index {}; std::map mNode; std::map mTria; std::map mQuad; @@ -2055,7 +2055,7 @@ bool MeshOutput::SaveAsciiSTL(std::ostream& rstrOut) const { MeshFacetIterator clIter(_rclMesh), clEnd(_rclMesh); clIter.Transform(this->_transform); - const MeshGeomFacet* pclFacet; + const MeshGeomFacet* pclFacet {}; if (!rstrOut || rstrOut.bad() || _rclMesh.CountFacets() == 0) { return false; @@ -2104,9 +2104,9 @@ bool MeshOutput::SaveBinarySTL(std::ostream& rstrOut) const { MeshFacetIterator clIter(_rclMesh), clEnd(_rclMesh); clIter.Transform(this->_transform); - const MeshGeomFacet* pclFacet; - uint32_t i; - uint16_t usAtt; + const MeshGeomFacet* pclFacet {}; + uint32_t i {}; + uint16_t usAtt {}; char szInfo[81]; if (!rstrOut || rstrOut.bad() /*|| _rclMesh.CountFacets() == 0*/) { @@ -2290,7 +2290,7 @@ bool MeshOutput::SaveAsymptote(std::ostream& out) const } std::size_t index = 0; - const MeshGeomFacet* pclFacet; + const MeshGeomFacet* pclFacet {}; while (clIter < clEnd) { pclFacet = &(*clIter); @@ -2468,7 +2468,7 @@ bool MeshOutput::SaveBinaryPLY(std::ostream& out) const } } unsigned char n = 3; - int f1, f2, f3; + int f1 {}, f2 {}, f3 {}; for (std::size_t i = 0; i < f_count; i++) { const MeshFacet& f = rFacets[i]; f1 = (int)f._aulPoints[0]; @@ -2543,7 +2543,7 @@ bool MeshOutput::SaveAsciiPLY(std::ostream& out) const } unsigned int n = 3; - int f1, f2, f3; + int f1 {}, f2 {}, f3 {}; for (std::size_t i = 0; i < f_count; i++) { const MeshFacet& f = rFacets[i]; f1 = (int)f._aulPoints[0]; @@ -2923,7 +2923,7 @@ bool MeshOutput::SaveX3DContent(std::ostream& out, bool exportViewpoints) const const Base::Vector3d& v = p.getPosition(); const Base::Rotation& r = p.getRotation(); Base::Vector3d axis; - double angle; + double angle {}; r.getValue(axis, angle); out << " supportedMeshFormats(); static MeshIO::Format getFormat(const char* FileName); -protected: +private: MeshKernel& _rclMesh; /**< reference to mesh data structure */ Material* _material; std::vector _groupNames; @@ -256,7 +256,7 @@ protected: /** Writes an X3D file. */ bool SaveX3DContent(std::ostream& rstrOut, bool exportViewpoints) const; -protected: +private: const MeshKernel& _rclMesh; /**< reference to mesh data structure */ const Material* _material; Base::Matrix4D _transform; diff --git a/src/Mod/Mesh/App/Core/MeshKernel.cpp b/src/Mod/Mesh/App/Core/MeshKernel.cpp index f760c75ad0..312cadca0d 100644 --- a/src/Mod/Mesh/App/Core/MeshKernel.cpp +++ b/src/Mod/Mesh/App/Core/MeshKernel.cpp @@ -54,6 +54,11 @@ MeshKernel::MeshKernel(const MeshKernel& rclMesh) *this = rclMesh; } +MeshKernel::MeshKernel(MeshKernel&& rclMesh) +{ + *this = rclMesh; +} + MeshKernel& MeshKernel::operator=(const MeshKernel& rclMesh) { if (this != &rclMesh) { // must be a different instance @@ -65,6 +70,17 @@ MeshKernel& MeshKernel::operator=(const MeshKernel& rclMesh) return *this; } +MeshKernel& MeshKernel::operator=(MeshKernel&& rclMesh) +{ + if (this != &rclMesh) { // must be a different instance + this->_aclPointArray = std::move(rclMesh._aclPointArray); + this->_aclFacetArray = std::move(rclMesh._aclFacetArray); + this->_clBoundBox = rclMesh._clBoundBox; + this->_bValid = rclMesh._bValid; + } + return *this; +} + MeshKernel& MeshKernel::operator=(const std::vector& rclFAry) { MeshBuilder builder(*this); @@ -441,7 +457,7 @@ void MeshKernel::Clear() bool MeshKernel::DeleteFacet(const MeshFacetIterator& rclIter) { - FacetIndex ulNFacet, ulInd; + FacetIndex ulNFacet {}, ulInd {}; if (rclIter._clIter >= _aclFacetArray.end()) { return false; @@ -539,7 +555,7 @@ bool MeshKernel::DeletePoint(const MeshPointIterator& rclIter) { MeshFacetIterator pFIter(*this), pFEnd(*this); std::vector clToDel; - PointIndex ulInd; + PointIndex ulInd {}; // index of the point to delete ulInd = rclIter._clIter - _aclPointArray.begin(); @@ -657,7 +673,7 @@ void MeshKernel::RemoveInvalids() { std::vector aulDecrements; std::vector::iterator pDIter; - unsigned long ulDec; + unsigned long ulDec {}; MeshPointArray::_TIterator pPIter, pPEnd; MeshFacetArray::_TIterator pFIter, pFEnd; @@ -784,7 +800,7 @@ std::vector MeshKernel::GetFacetPoints(const std::vector { std::vector points; for (FacetIndex it : facets) { - PointIndex p0, p1, p2; + PointIndex p0 {}, p1 {}, p2 {}; GetFacetPoints(it, p0, p1, p2); points.push_back(p0); points.push_back(p1); @@ -913,7 +929,7 @@ void MeshKernel::Read(std::istream& rclIn) Base::InputStream str(rclIn); // Read the header with a "magic number" and a version - uint32_t magic, version, swap_magic, swap_version; + uint32_t magic {}, version {}, swap_magic {}, swap_version {}; str >> magic >> version; swap_magic = magic; Base::SwapEndian(swap_magic); @@ -950,7 +966,7 @@ void MeshKernel::Read(std::istream& rclIn) MeshFacetArray facetArray; facetArray.resize(uCtFts); - uint32_t v1, v2, v3; + uint32_t v1 {}, v2 {}, v3 {}; for (auto& it : facetArray) { str >> v1 >> v2 >> v3; @@ -1048,11 +1064,11 @@ void MeshKernel::Read(std::istream& rclIn) for (auto& it : pointArray) { str >> it.x >> it.y >> it.z; } - uint32_t dummy; + uint32_t dummy {}; for (unsigned long i = 0; i < uCtEdges; i++) { str >> dummy; } - uint32_t v1, v2, v3; + uint32_t v1 {}, v2 {}, v3 {}; facetArray.resize(uCtFts); for (auto& it : facetArray) { str >> v1 >> v2 >> v3; @@ -1124,7 +1140,7 @@ std::vector MeshKernel::CalcVertexNormals() const normals.resize(CountPoints()); - PointIndex p1, p2, p3; + PointIndex p1 {}, p2 {}, p3 {}; unsigned int ct = CountFacets(); for (unsigned int pFIter = 0; pFIter < ct; pFIter++) { GetFacetPoints(pFIter, p1, p2, p3); diff --git a/src/Mod/Mesh/App/Core/MeshKernel.h b/src/Mod/Mesh/App/Core/MeshKernel.h index 390a1cf01d..003ee2a0e4 100644 --- a/src/Mod/Mesh/App/Core/MeshKernel.h +++ b/src/Mod/Mesh/App/Core/MeshKernel.h @@ -68,6 +68,7 @@ public: MeshKernel(); /// Construction MeshKernel(const MeshKernel& rclMesh); + MeshKernel(MeshKernel&& rclMesh); /// Destruction ~MeshKernel() { @@ -411,6 +412,7 @@ public: MeshKernel& operator=(const std::vector& rclFAry); /** Assignment operator. */ MeshKernel& operator=(const MeshKernel& rclMesh); + MeshKernel& operator=(MeshKernel&& rclMesh); /** This allows to assign the mesh structure directly. The caller must make sure that the point * indices are correctly set but the neighbourhood gets checked and corrected if \a * checkNeighbourHood is true. @@ -479,6 +481,7 @@ protected: /** Calculates the gravity point to the given facet. */ inline Base::Vector3f GetGravityPoint(const MeshFacet& rclFacet) const; +private: MeshPointArray _aclPointArray; /**< Holds the array of geometric points. */ MeshFacetArray _aclFacetArray; /**< Holds the array of facets. */ mutable Base::BoundBox3f _clBoundBox; /**< The current calculated bounding box. */ diff --git a/src/Mod/Mesh/App/Core/Segmentation.cpp b/src/Mod/Mesh/App/Core/Segmentation.cpp index dd4bde4e3b..9e30640d9f 100644 --- a/src/Mod/Mesh/App/Core/Segmentation.cpp +++ b/src/Mod/Mesh/App/Core/Segmentation.cpp @@ -203,10 +203,10 @@ std::vector PlaneSurfaceFit::Parameters() const // -------------------------------------------------------- CylinderSurfaceFit::CylinderSurfaceFit() - : fitter(new CylinderFit) + : radius(FLOAT_MAX) + , fitter(new CylinderFit) { axis.Set(0, 0, 0); - radius = FLOAT_MAX; } /*! @@ -311,10 +311,10 @@ std::vector CylinderSurfaceFit::Parameters() const // -------------------------------------------------------- SphereSurfaceFit::SphereSurfaceFit() - : fitter(new SphereFit) + : radius(FLOAT_MAX) + , fitter(new SphereFit) { center.Set(0, 0, 0); - radius = FLOAT_MAX; } SphereSurfaceFit::SphereSurfaceFit(const Base::Vector3f& c, float r) @@ -462,7 +462,7 @@ std::vector MeshDistanceGenericSurfaceFitSegment::Parameters() const bool MeshCurvaturePlanarSegment::TestFacet(const MeshFacet& rclFacet) const { for (PointIndex ptIndex : rclFacet._aulPoints) { - const CurvatureInfo& ci = info[ptIndex]; + const CurvatureInfo& ci = GetInfo(ptIndex); if (fabs(ci.fMinCurvature) > tolerance) { return false; } @@ -477,7 +477,7 @@ bool MeshCurvaturePlanarSegment::TestFacet(const MeshFacet& rclFacet) const bool MeshCurvatureCylindricalSegment::TestFacet(const MeshFacet& rclFacet) const { for (PointIndex ptIndex : rclFacet._aulPoints) { - const CurvatureInfo& ci = info[ptIndex]; + const CurvatureInfo& ci = GetInfo(ptIndex); float fMax = std::max(fabs(ci.fMaxCurvature), fabs(ci.fMinCurvature)); float fMin = std::min(fabs(ci.fMaxCurvature), fabs(ci.fMinCurvature)); if (fMin > toleranceMin) { @@ -494,11 +494,11 @@ bool MeshCurvatureCylindricalSegment::TestFacet(const MeshFacet& rclFacet) const bool MeshCurvatureSphericalSegment::TestFacet(const MeshFacet& rclFacet) const { for (PointIndex ptIndex : rclFacet._aulPoints) { - const CurvatureInfo& ci = info[ptIndex]; + const CurvatureInfo& ci = GetInfo(ptIndex); if (ci.fMaxCurvature * ci.fMinCurvature < 0) { return false; } - float diff; + float diff {}; diff = fabs(ci.fMinCurvature) - curvature; if (fabs(diff) > tolerance) { return false; @@ -515,7 +515,7 @@ bool MeshCurvatureSphericalSegment::TestFacet(const MeshFacet& rclFacet) const bool MeshCurvatureFreeformSegment::TestFacet(const MeshFacet& rclFacet) const { for (PointIndex ptIndex : rclFacet._aulPoints) { - const CurvatureInfo& ci = info[ptIndex]; + const CurvatureInfo& ci = GetInfo(ptIndex); if (fabs(ci.fMinCurvature - c2) > toleranceMin) { return false; } @@ -558,7 +558,7 @@ bool MeshSurfaceVisitor::Visit(const MeshFacet& face, void MeshSegmentAlgorithm::FindSegments(std::vector& segm) { // reset VISIT flags - FacetIndex startFacet; + FacetIndex startFacet {}; MeshCore::MeshAlgorithm cAlgo(myKernel); cAlgo.ResetFacetFlag(MeshCore::MeshFacet::VISIT); diff --git a/src/Mod/Mesh/App/Core/Segmentation.h b/src/Mod/Mesh/App/Core/Segmentation.h index ad7fe653e2..f02dc0eae5 100644 --- a/src/Mod/Mesh/App/Core/Segmentation.h +++ b/src/Mod/Mesh/App/Core/Segmentation.h @@ -47,6 +47,12 @@ public: : minFacets(minFacets) {} virtual ~MeshSurfaceSegment() = default; + + MeshSurfaceSegment(const MeshSurfaceSegment&) = delete; + MeshSurfaceSegment(MeshSurfaceSegment&&) = delete; + MeshSurfaceSegment& operator=(const MeshSurfaceSegment&) = delete; + MeshSurfaceSegment& operator=(MeshSurfaceSegment&&) = delete; + virtual bool TestFacet(const MeshFacet& rclFacet) const = 0; virtual const char* GetType() const = 0; virtual void Initialize(FacetIndex); @@ -59,7 +65,7 @@ public: } MeshSegment FindSegment(FacetIndex) const; -protected: +private: std::vector segments; unsigned long minFacets; }; @@ -77,8 +83,10 @@ public: {} protected: + // NOLINTBEGIN const MeshKernel& kernel; float tolerance; + // NOLINTEND }; class MeshExport MeshDistancePlanarSegment: public MeshDistanceSurfaceSegment @@ -86,6 +94,12 @@ class MeshExport MeshDistancePlanarSegment: public MeshDistanceSurfaceSegment public: MeshDistancePlanarSegment(const MeshKernel& mesh, unsigned long minFacets, float tol); ~MeshDistancePlanarSegment() override; + + MeshDistancePlanarSegment(const MeshDistancePlanarSegment&) = delete; + MeshDistancePlanarSegment(MeshDistancePlanarSegment&&) = delete; + MeshDistancePlanarSegment& operator=(const MeshDistancePlanarSegment&) = delete; + MeshDistancePlanarSegment& operator=(MeshDistancePlanarSegment&&) = delete; + bool TestFacet(const MeshFacet& rclFacet) const override; const char* GetType() const override { @@ -94,7 +108,7 @@ public: void Initialize(FacetIndex) override; void AddFacet(const MeshFacet& rclFacet) override; -protected: +private: Base::Vector3f basepoint; Base::Vector3f normal; PlaneFit* fitter; @@ -105,6 +119,12 @@ class MeshExport AbstractSurfaceFit public: AbstractSurfaceFit() = default; virtual ~AbstractSurfaceFit() = default; + + AbstractSurfaceFit(const AbstractSurfaceFit&) = delete; + AbstractSurfaceFit(AbstractSurfaceFit&&) = delete; + AbstractSurfaceFit& operator=(const AbstractSurfaceFit&) = delete; + AbstractSurfaceFit& operator=(AbstractSurfaceFit&&) = delete; + virtual const char* GetType() const = 0; virtual void Initialize(const MeshGeomFacet&) = 0; virtual bool TestTriangle(const MeshGeomFacet&) const = 0; @@ -121,6 +141,12 @@ public: PlaneSurfaceFit(); PlaneSurfaceFit(const Base::Vector3f& b, const Base::Vector3f& n); ~PlaneSurfaceFit() override; + + PlaneSurfaceFit(const PlaneSurfaceFit&) = delete; + PlaneSurfaceFit(PlaneSurfaceFit&&) = delete; + PlaneSurfaceFit& operator=(const PlaneSurfaceFit&) = delete; + PlaneSurfaceFit& operator=(PlaneSurfaceFit&&) = delete; + const char* GetType() const override { return "Plane"; @@ -145,6 +171,12 @@ public: CylinderSurfaceFit(); CylinderSurfaceFit(const Base::Vector3f& b, const Base::Vector3f& a, float r); ~CylinderSurfaceFit() override; + + CylinderSurfaceFit(const CylinderSurfaceFit&) = delete; + CylinderSurfaceFit(CylinderSurfaceFit&&) = delete; + CylinderSurfaceFit& operator=(const CylinderSurfaceFit&) = delete; + CylinderSurfaceFit& operator=(CylinderSurfaceFit&&) = delete; + const char* GetType() const override { return "Cylinder"; @@ -170,6 +202,12 @@ public: SphereSurfaceFit(); SphereSurfaceFit(const Base::Vector3f& c, float r); ~SphereSurfaceFit() override; + + SphereSurfaceFit(const SphereSurfaceFit&) = delete; + SphereSurfaceFit(SphereSurfaceFit&&) = delete; + SphereSurfaceFit& operator=(const SphereSurfaceFit&) = delete; + SphereSurfaceFit& operator=(SphereSurfaceFit&&) = delete; + const char* GetType() const override { return "Sphere"; @@ -196,6 +234,14 @@ public: unsigned long minFacets, float tol); ~MeshDistanceGenericSurfaceFitSegment() override; + + MeshDistanceGenericSurfaceFitSegment(const MeshDistanceGenericSurfaceFitSegment&) = delete; + MeshDistanceGenericSurfaceFitSegment(MeshDistanceGenericSurfaceFitSegment&&) = delete; + MeshDistanceGenericSurfaceFitSegment& + operator=(const MeshDistanceGenericSurfaceFitSegment&) = delete; + MeshDistanceGenericSurfaceFitSegment& + operator=(MeshDistanceGenericSurfaceFitSegment&&) = delete; + bool TestFacet(const MeshFacet& rclFacet) const override; const char* GetType() const override { @@ -206,7 +252,7 @@ public: void AddFacet(const MeshFacet& rclFacet) override; std::vector Parameters() const; -protected: +private: AbstractSurfaceFit* fitter; }; @@ -220,7 +266,12 @@ public: , info(ci) {} -protected: + const CurvatureInfo& GetInfo(std::size_t pos) const + { + return info.at(pos); + } + +private: const std::vector& info; }; @@ -252,11 +303,10 @@ public: float tolMax, float curv) : MeshCurvatureSurfaceSegment(ci, minFacets) + , curvature(curv) , toleranceMin(tolMin) , toleranceMax(tolMax) - { - curvature = curv; - } + {} bool TestFacet(const MeshFacet& rclFacet) const override; const char* GetType() const override { @@ -277,10 +327,9 @@ public: float tol, float curv) : MeshCurvatureSurfaceSegment(ci, minFacets) + , curvature(curv) , tolerance(tol) - { - curvature = curv; - } + {} bool TestFacet(const MeshFacet& rclFacet) const override; const char* GetType() const override { @@ -330,7 +379,7 @@ public: unsigned short neighbourIndex) override; bool Visit(const MeshFacet& face, const MeshFacet&, FacetIndex ulFInd, unsigned long) override; -protected: +private: std::vector& indices; MeshSurfaceSegment& segm; }; diff --git a/src/Mod/Mesh/App/Core/SetOperations.cpp b/src/Mod/Mesh/App/Core/SetOperations.cpp index 2819b18b81..064b4409e4 100644 --- a/src/Mod/Mesh/App/Core/SetOperations.cpp +++ b/src/Mod/Mesh/App/Core/SetOperations.cpp @@ -96,14 +96,13 @@ void SetOperations::Do() return; } - unsigned long i; - for (i = 0; i < _cutMesh0.CountFacets(); i++) { + for (auto i = 0UL; i < _cutMesh0.CountFacets(); i++) { if (facetsCuttingEdge0.find(i) == facetsCuttingEdge0.end()) { _newMeshFacets[0].push_back(_cutMesh0.GetFacet(i)); } } - for (i = 0; i < _cutMesh1.CountFacets(); i++) { + for (auto i = 0UL; i < _cutMesh1.CountFacets(); i++) { if (facetsCuttingEdge1.find(i) == facetsCuttingEdge1.end()) { _newMeshFacets[1].push_back(_cutMesh1.GetFacet(i)); } @@ -115,7 +114,7 @@ void SetOperations::Do() // Base::Sequencer().next(); TriangulateMesh(_cutMesh1, 1); - float mult0, mult1; + float mult0 {}, mult1 {}; switch (_operationType) { case Union: mult0 = -1.0f; @@ -178,15 +177,12 @@ void SetOperations::Cut(std::set& facetsCuttingEdge0, MeshFacetGrid grid1(_cutMesh0, 20); MeshFacetGrid grid2(_cutMesh1, 20); - unsigned long ctGx1, ctGy1, ctGz1; + unsigned long ctGx1 {}, ctGy1 {}, ctGz1 {}; grid1.GetCtGrids(ctGx1, ctGy1, ctGz1); - unsigned long gx1; - for (gx1 = 0; gx1 < ctGx1; gx1++) { - unsigned long gy1; - for (gy1 = 0; gy1 < ctGy1; gy1++) { - unsigned long gz1; - for (gz1 = 0; gz1 < ctGz1; gz1++) { + for (auto gx1 = 0UL; gx1 < ctGx1; gx1++) { + for (auto gy1 = 0UL; gy1 < ctGy1; gy1++) { + for (auto gz1 = 0UL; gz1 < ctGz1; gz1++) { if (grid1.GetCtElements(gx1, gy1, gz1) > 0) { std::vector vecFacets2; grid2.Inside(grid1.GetBoundBox(gx1, gy1, gz1), vecFacets2); @@ -213,8 +209,8 @@ void SetOperations::Cut(std::set& facetsCuttingEdge0, float minDist1 = _minDistanceToPoint, minDist2 = _minDistanceToPoint; MeshPoint np0 = p0, np1 = p1; - int i; - for (i = 0; i < 3; i++) { + for (int i = 0; i < 3; i++) // NOLINT + { float d1 = (f1._aclPoints[i] - p0).Length(); float d2 = (f1._aclPoints[i] - p1).Length(); if (d1 < minDist1) { @@ -228,7 +224,8 @@ void SetOperations::Cut(std::set& facetsCuttingEdge0, } // for (int i = 0; i < 3; i++) // optimize cut line if distance to nearest point is too small - for (i = 0; i < 3; i++) { + for (int i = 0; i < 3; i++) // NOLINT + { float d1 = (f2._aclPoints[i] - p0).Length(); float d2 = (f2._aclPoints[i] - p1).Length(); if (d1 < minDist1) { @@ -310,8 +307,8 @@ void SetOperations::TriangulateMesh(const MeshKernel& cutMesh, int side) // facet corner points // const MeshFacet& mf = cutMesh._aclFacetArray[fidx]; - int i; - for (i = 0; i < 3; i++) { + for (int i = 0; i < 3; i++) // NOLINT + { pointsSet.insert(f._aclPoints[i]); points.push_back(f._aclPoints[i]); } @@ -396,8 +393,7 @@ void SetOperations::TriangulateMesh(const MeshKernel& cutMesh, int side) } - int j; - for (j = 0; j < 3; j++) { + for (int j = 0; j < 3; j++) { std::map::iterator eit = _edges.find(Edge(facet._aclPoints[j], facet._aclPoints[(j + 1) % 3])); @@ -766,7 +762,7 @@ void MeshIntersection::connectLines(bool onlyclosed, // search for the next line on the begin/end of the polyline and add it std::list::iterator pFront, pEnd; - bool bFoundLine; + bool bFoundLine {}; do { float fFrontMin = fMinEps, fEndMin = fMinEps; bool bFrontFirst = false, bEndFirst = false; diff --git a/src/Mod/Mesh/App/Core/SetOperations.h b/src/Mod/Mesh/App/Core/SetOperations.h index bd7054fe4f..4c31f8cba5 100644 --- a/src/Mod/Mesh/App/Core/SetOperations.h +++ b/src/Mod/Mesh/App/Core/SetOperations.h @@ -76,7 +76,7 @@ public: */ void Do(); -protected: +private: const MeshKernel& _cutMesh0; /** Mesh for set operations source 1 */ const MeshKernel& _cutMesh1; /** Mesh for set operations source 2 */ MeshKernel& _resultMesh; /** Result mesh */ @@ -118,17 +118,9 @@ private: class EdgeInfo { public: - int fcounter[2]; // counter of facets attacted to the edge + int fcounter[2] {}; // counter of facets attacted to the edge MeshGeomFacet facets[2][2]; // Geom-Facets attached to the edge - FacetIndex facet[2]; // underlying Facet-Index - - EdgeInfo() - { - fcounter[0] = 0; - fcounter[1] = 0; - facet[0] = 0; - facet[1] = 0; - } + FacetIndex facet[2] {}; // underlying Facet-Index }; // class CollectFacetVisitor : public MeshFacetVisitor diff --git a/src/Mod/Mesh/App/Core/Smoothing.cpp b/src/Mod/Mesh/App/Core/Smoothing.cpp index ffeb67d757..9c6672e1ed 100644 --- a/src/Mod/Mesh/App/Core/Smoothing.cpp +++ b/src/Mod/Mesh/App/Core/Smoothing.cpp @@ -185,7 +185,7 @@ void LaplaceSmoothing::Umbrella(const MeshRefPointToPoints& vv_it, } size_t n_count = cv.size(); - double w; + double w {}; w = 1.0 / double(n_count); double delx = 0.0, dely = 0.0, delz = 0.0; @@ -222,7 +222,7 @@ void LaplaceSmoothing::Umbrella(const MeshRefPointToPoints& vv_it, } size_t n_count = cv.size(); - double w; + double w {}; w = 1.0 / double(n_count); double delx = 0.0, dely = 0.0, delz = 0.0; @@ -273,8 +273,8 @@ void TaubinSmoothing::Smooth(unsigned int iterations) // Theoretically Taubin does not shrink the surface iterations = (iterations + 1) / 2; // two steps per iteration for (unsigned int i = 0; i < iterations; i++) { - Umbrella(vv_it, vf_it, lambda); - Umbrella(vv_it, vf_it, -(lambda + micro)); + Umbrella(vv_it, vf_it, GetLambda()); + Umbrella(vv_it, vf_it, -(GetLambda() + micro)); } } @@ -287,8 +287,8 @@ void TaubinSmoothing::SmoothPoints(unsigned int iterations, // Theoretically Taubin does not shrink the surface iterations = (iterations + 1) / 2; // two steps per iteration for (unsigned int i = 0; i < iterations; i++) { - Umbrella(vv_it, vf_it, lambda, point_indices); - Umbrella(vv_it, vf_it, -(lambda + micro), point_indices); + Umbrella(vv_it, vf_it, GetLambda(), point_indices); + Umbrella(vv_it, vf_it, -(GetLambda() + micro), point_indices); } } diff --git a/src/Mod/Mesh/App/Core/Smoothing.h b/src/Mod/Mesh/App/Core/Smoothing.h index 05e60cc807..6f15ffad2a 100644 --- a/src/Mod/Mesh/App/Core/Smoothing.h +++ b/src/Mod/Mesh/App/Core/Smoothing.h @@ -56,6 +56,11 @@ public: explicit AbstractSmoothing(MeshKernel&); virtual ~AbstractSmoothing(); + AbstractSmoothing(const AbstractSmoothing&) = delete; + AbstractSmoothing(AbstractSmoothing&&) = delete; + AbstractSmoothing& operator=(const AbstractSmoothing&) = delete; + AbstractSmoothing& operator=(AbstractSmoothing&&) = delete; + void initialize(Component comp, Continuity cont); /** Smooth the triangle mesh. */ @@ -63,10 +68,12 @@ public: virtual void SmoothPoints(unsigned int, const std::vector&) = 0; protected: + // NOLINTBEGIN MeshKernel& kernel; Component component {Normal}; Continuity continuity {C0}; + // NOLINTEND }; class MeshExport PlaneFitSmoothing: public AbstractSmoothing @@ -94,6 +101,10 @@ public: { lambda = l; } + double GetLambda() const + { + return lambda; + } protected: void Umbrella(const MeshRefPointToPoints&, const MeshRefPointToFacets&, double); @@ -102,7 +113,7 @@ protected: double, const std::vector&); -protected: +private: double lambda {0.6307}; }; @@ -117,7 +128,7 @@ public: micro = m; } -protected: +private: double micro {0.0424}; }; diff --git a/src/Mod/Mesh/App/Core/SphereFit.cpp b/src/Mod/Mesh/App/Core/SphereFit.cpp index 310f1cca0c..c455192958 100644 --- a/src/Mod/Mesh/App/Core/SphereFit.cpp +++ b/src/Mod/Mesh/App/Core/SphereFit.cpp @@ -204,7 +204,7 @@ float SphereFit::Fit() Eigen::VectorXd atpl(4); // Iteration loop... - double sigma0; + double sigma0 {}; bool cont = true; while (cont && (_numIter < _maxIter)) { ++_numIter; @@ -228,7 +228,7 @@ float SphereFit::Fit() // Before updating the unknowns, compute the residuals and sigma0 and check the residual // convergence - bool vConverged; + bool vConverged {}; if (!computeResiduals(x, residuals, sigma0, _vConvLimit, vConverged)) { return FLOAT_MAX; } @@ -267,8 +267,8 @@ void SphereFit::setupNormalEquationMatrices(const std::vector& r // For each point, setup the observation equation coefficients and add their // contribution into the normal equation matrices - double a[4], b[3]; - double f0, qw; + double a[4] {}, b[3] {}; + double f0 {}, qw {}; std::vector::const_iterator vIt = residuals.begin(); std::list::const_iterator cIt; for (cIt = _vPoints.begin(); cIt != _vPoints.end(); ++cIt, ++vIt) { @@ -377,8 +377,8 @@ bool SphereFit::computeResiduals(const Eigen::VectorXd& x, vConverged = true; int nPtsUsed = 0; sigma0 = 0.0; - double a[4], b[3]; - double f0, qw; + double a[4] {}, b[3] {}; + double f0 {}, qw {}; // double maxdVx = 0.0; // double maxdVy = 0.0; // double maxdVz = 0.0; diff --git a/src/Mod/Mesh/App/Core/SphereFit.h b/src/Mod/Mesh/App/Core/SphereFit.h index f392c66226..5b44156789 100644 --- a/src/Mod/Mesh/App/Core/SphereFit.h +++ b/src/Mod/Mesh/App/Core/SphereFit.h @@ -128,7 +128,7 @@ protected: double vConvLimit, bool& vConverged) const; -protected: +private: Base::Vector3d _vCenter; /**< Center of sphere. */ double _dRadius {0}; /**< Radius of the sphere. */ int _numIter {0}; /**< Number of iterations for solution to converge. */ diff --git a/src/Mod/Mesh/App/Core/Tools.h b/src/Mod/Mesh/App/Core/Tools.h index 84eb95bbcc..17f6d790c2 100644 --- a/src/Mod/Mesh/App/Core/Tools.h +++ b/src/Mod/Mesh/App/Core/Tools.h @@ -89,7 +89,7 @@ protected: Base::Vector3f _clCenter; }; -protected: +private: const MeshKernel& _rclMesh; const MeshFacetArray& _rclFAry; const MeshPointArray& _rclPAry; @@ -102,11 +102,12 @@ protected: std::vector> _aclSampledFacets; // sample points from each facet float _fSampleDistance; // distance between two sampled points Wm4::Sphere3 _akSphere; - bool _bTooFewPoints {false}; public: MeshSearchNeighbours(const MeshSearchNeighbours&) = delete; + MeshSearchNeighbours(MeshSearchNeighbours&&) = delete; void operator=(const MeshSearchNeighbours&) = delete; + void operator=(MeshSearchNeighbours&&) = delete; }; inline bool MeshSearchNeighbours::CheckDistToFacet(const MeshFacet& rclF) @@ -177,7 +178,7 @@ public: Base::Vector3f operator()(PointIndex index) { it.Set(index); - return *it; + return Base::Vector3f(it->x, it->y, it->z); } private: @@ -206,8 +207,10 @@ public: } } + // NOLINTBEGIN Index nearest_index; float nearest_dist {FLOAT_MAX}; + // NOLINTEND private: T it; diff --git a/src/Mod/Mesh/App/Core/TopoAlgorithm.cpp b/src/Mod/Mesh/App/Core/TopoAlgorithm.cpp index f09ad7c596..8985138aa2 100644 --- a/src/Mod/Mesh/App/Core/TopoAlgorithm.cpp +++ b/src/Mod/Mesh/App/Core/TopoAlgorithm.cpp @@ -381,7 +381,7 @@ void MeshTopoAlgorithm::DelaunayFlip(float fMaxAngle) const MeshFacet& face_1 = _rclMesh._aclFacetArray[edge.first]; const MeshFacet& face_2 = _rclMesh._aclFacetArray[edge.second]; unsigned short side = face_2.Side(edge.first); - Base::Vector3f vertex = _rclMesh.GetPoint(face_2._aulPoints[(side + 1) % 3]); + MeshPoint vertex = _rclMesh.GetPoint(face_2._aulPoints[(side + 1) % 3]); if (Base::DistanceP2(center, vertex) < radius) { SwapEdge(edge.first, edge.second); for (int i = 0; i < 3; i++) { @@ -504,14 +504,14 @@ void MeshTopoAlgorithm::AdjustEdgesToCurvatureDirection() continue; } - PointIndex uPt3, uPt4; + PointIndex uPt3 {}, uPt4 {}; unsigned short side = rFace1.Side(uPt1, uPt2); uPt3 = rFace1._aulPoints[(side + 2) % 3]; side = rFace2.Side(uPt1, uPt2); uPt4 = rFace2._aulPoints[(side + 2) % 3]; Wm4::Vector3 dir; - float fActCurvature; + float fActCurvature {}; if (fabs(aMinCurv[uPt1]) > fabs(aMaxCurv[uPt1])) { fActCurvature = aMinCurv[uPt1]; dir = aMaxCurvDir[uPt1]; @@ -1838,7 +1838,7 @@ void MeshComponents::SearchForComponents(TMode tMode, const std::vector& aSegment, std::vector>& aclT) const { - FacetIndex ulStartFacet; + FacetIndex ulStartFacet {}; if (_rclMesh.CountFacets() == 0) { return; diff --git a/src/Mod/Mesh/App/Core/TopoAlgorithm.h b/src/Mod/Mesh/App/Core/TopoAlgorithm.h index 02d140ac23..108ff01917 100644 --- a/src/Mod/Mesh/App/Core/TopoAlgorithm.h +++ b/src/Mod/Mesh/App/Core/TopoAlgorithm.h @@ -50,6 +50,11 @@ public: explicit MeshTopoAlgorithm(MeshKernel& rclM); ~MeshTopoAlgorithm(); + MeshTopoAlgorithm(const MeshTopoAlgorithm&) = delete; + MeshTopoAlgorithm(MeshTopoAlgorithm&&) = delete; + MeshTopoAlgorithm& operator=(const MeshTopoAlgorithm&) = delete; + MeshTopoAlgorithm& operator=(MeshTopoAlgorithm&&) = delete; + public: /** @name Topological Operations */ //@{ @@ -360,7 +365,7 @@ protected: } }; -protected: +private: const MeshKernel& _rclMesh; }; diff --git a/src/Mod/Mesh/App/Core/Triangulation.cpp b/src/Mod/Mesh/App/Core/Triangulation.cpp index 20049971b3..11c6c144ca 100644 --- a/src/Mod/Mesh/App/Core/Triangulation.cpp +++ b/src/Mod/Mesh/App/Core/Triangulation.cpp @@ -74,10 +74,9 @@ bool TriangulationVerifierV2::MustFlip(const Base::Vector3f& n1, const Base::Vec // ---------------------------------------------------------------------------- AbstractPolygonTriangulator::AbstractPolygonTriangulator() -{ - _discard = false; - _verifier = new TriangulationVerifier(); -} + : _discard {false} + , _verifier {new TriangulationVerifier()} +{} AbstractPolygonTriangulator::~AbstractPolygonTriangulator() { @@ -358,8 +357,8 @@ bool EarClippingTriangulator::Triangulate::InsideTriangle(float Ax, float Px, float Py) { - float ax, ay, bx, by, cx, cy, apx, apy, bpx, bpy, cpx, cpy; - float cCROSSap, bCROSScp, aCROSSbp; + float ax {}, ay {}, bx {}, by {}, cx {}, cy {}, apx {}, apy {}, bpx {}, bpy {}, cpx {}, cpy {}; + float cCROSSap {}, bCROSScp {}, aCROSSbp {}; ax = Cx - Bx; ay = Cy - By; @@ -388,8 +387,8 @@ bool EarClippingTriangulator::Triangulate::Snip(const std::vector& raclPoints); void SetIndices(const std::vector& d) @@ -139,6 +149,7 @@ protected: void Done(); protected: + // NOLINTBEGIN bool _discard; Base::Matrix4D _inverse; std::vector _indices; @@ -148,6 +159,7 @@ protected: std::vector _facets; std::vector _info; TriangulationVerifier* _verifier; + // NOLINTEND }; /** diff --git a/src/Mod/Mesh/App/Core/Trim.cpp b/src/Mod/Mesh/App/Core/Trim.cpp index 00c1b58a4f..f48aa64bf0 100644 --- a/src/Mod/Mesh/App/Core/Trim.cpp +++ b/src/Mod/Mesh/App/Core/Trim.cpp @@ -165,7 +165,7 @@ bool MeshTrimming::PolygonContainsCompleteFacet(bool bInner, FacetIndex ulIndex) bool MeshTrimming::IsPolygonPointInFacet(FacetIndex ulIndex, Base::Vector3f& clPoint) { Base::Vector2d A, B, C, P; - float u, v, w, fDetPAC, fDetPBC, fDetPAB, fDetABC; + float u {}, v {}, w {}, fDetPAC {}, fDetPBC {}, fDetPAB {}, fDetABC {}; Base::Polygon2d clFacPoly; const MeshGeomFacet& rclFacet = myMesh.GetFacet(ulIndex); @@ -346,7 +346,7 @@ bool MeshTrimming::GetIntersectionPointsOfPolygonAndFacet( void MeshTrimming::AdjustFacet(MeshFacet& facet, int iInd) { - unsigned long tmp; + unsigned long tmp {}; if (iInd == 1) { tmp = facet._aulPoints[0]; @@ -774,7 +774,7 @@ void MeshTrimming::TrimFacets(const std::vector& raulFacets, { Base::Vector3f clP; std::vector clIntsct; - int iSide; + int iSide {}; Base::SequencerLauncher seq("trimming facets...", raulFacets.size()); for (FacetIndex index : raulFacets) { diff --git a/src/Mod/Mesh/App/Core/Visitor.cpp b/src/Mod/Mesh/App/Core/Visitor.cpp index 77927794fd..2c9992d3d1 100644 --- a/src/Mod/Mesh/App/Core/Visitor.cpp +++ b/src/Mod/Mesh/App/Core/Visitor.cpp @@ -34,7 +34,7 @@ using namespace MeshCore; unsigned long MeshKernel::VisitNeighbourFacets(MeshFacetVisitor& rclFVisitor, FacetIndex ulStartFacet) const { - unsigned long ulVisited = 0, j, ulLevel = 0; + unsigned long ulVisited = 0, ulLevel = 0; unsigned long ulCount = _aclFacetArray.size(); std::vector clCurrentLevel, clNextLevel; std::vector::iterator clCurrIter; @@ -52,7 +52,7 @@ unsigned long MeshKernel::VisitNeighbourFacets(MeshFacetVisitor& rclFVisitor, // visit all neighbours of the current level if not yet done for (unsigned short i = 0; i < 3; i++) { - j = clCurrFacet->_aulNeighbours[i]; // index to neighbour facet + auto j = clCurrFacet->_aulNeighbours[i]; // index to neighbour facet if (j == FACET_INDEX_MAX) { continue; // no neighbour facet } diff --git a/src/Mod/Mesh/App/Core/tritritest.h b/src/Mod/Mesh/App/Core/tritritest.h index ce65c67553..f92379a600 100644 --- a/src/Mod/Mesh/App/Core/tritritest.h +++ b/src/Mod/Mesh/App/Core/tritritest.h @@ -41,7 +41,7 @@ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHE OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - +//NOLINTBEGIN #include #define FABS(x) ((float)fabs(x)) /* implement as is fastest on your machine */ @@ -722,5 +722,5 @@ int tri_tri_intersect_with_isectline(float V0[3],float V1[3],float V2[3], } return 1; } - +//NOLINTEND // clang-format on diff --git a/src/Mod/Mesh/App/Edge.cpp b/src/Mod/Mesh/App/Edge.cpp index 1fa3ff4d75..35deaaf83d 100644 --- a/src/Mod/Mesh/App/Edge.cpp +++ b/src/Mod/Mesh/App/Edge.cpp @@ -40,7 +40,18 @@ Edge::Edge() // NOLINT } } -Edge::Edge(const Edge& e) +Edge::Edge(const Edge& e) // NOLINT + : MeshCore::MeshGeomEdge(e) + , Index(e.Index) + , Mesh(e.Mesh) +{ + for (int i = 0; i < 2; i++) { + PIndex[i] = e.PIndex[i]; + NIndex[i] = e.NIndex[i]; + } +} + +Edge::Edge(Edge&& e) // NOLINT : MeshCore::MeshGeomEdge(e) , Index(e.Index) , Mesh(e.Mesh) @@ -53,7 +64,7 @@ Edge::Edge(const Edge& e) Edge::~Edge() = default; -void Edge::operator=(const Edge& e) +Edge& Edge::operator=(const Edge& e) { MeshCore::MeshGeomEdge::operator=(e); Mesh = e.Mesh; @@ -62,6 +73,21 @@ void Edge::operator=(const Edge& e) PIndex[i] = e.PIndex[i]; NIndex[i] = e.NIndex[i]; } + + return *this; +} + +Edge& Edge::operator=(Edge&& e) +{ + MeshCore::MeshGeomEdge::operator=(e); + Mesh = e.Mesh; + Index = e.Index; + for (int i = 0; i < 2; i++) { + PIndex[i] = e.PIndex[i]; + NIndex[i] = e.NIndex[i]; + } + + return *this; } void Edge::unbound() diff --git a/src/Mod/Mesh/App/Edge.h b/src/Mod/Mesh/App/Edge.h index 27e7167160..dfc2cf8c33 100644 --- a/src/Mod/Mesh/App/Edge.h +++ b/src/Mod/Mesh/App/Edge.h @@ -43,6 +43,7 @@ class MeshExport Edge: public MeshCore::MeshGeomEdge public: Edge(); Edge(const Edge& f); + Edge(Edge&& f); ~Edge(); bool isBound() const @@ -50,7 +51,8 @@ public: return Index != -1; } void unbound(); - void operator=(const Edge& f); + Edge& operator=(const Edge& f); + Edge& operator=(Edge&& f); int Index {-1}; MeshCore::PointIndex PIndex[2]; diff --git a/src/Mod/Mesh/App/EdgePyImp.cpp b/src/Mod/Mesh/App/EdgePyImp.cpp index bfed97e7b6..a2bfd60669 100644 --- a/src/Mod/Mesh/App/EdgePyImp.cpp +++ b/src/Mod/Mesh/App/EdgePyImp.cpp @@ -26,11 +26,9 @@ #include #include -// clang-format off #include "Edge.h" #include "EdgePy.h" #include "EdgePy.cpp" -// clang-format on using namespace Mesh; @@ -125,7 +123,7 @@ PyObject* EdgePy::intersectWithEdge(PyObject* args) PyObject* EdgePy::isParallel(PyObject* args) { - PyObject* object; + PyObject* object {}; if (!PyArg_ParseTuple(args, "O!", &EdgePy::Type, &object)) { return nullptr; } @@ -138,7 +136,7 @@ PyObject* EdgePy::isParallel(PyObject* args) PyObject* EdgePy::isCollinear(PyObject* args) { - PyObject* object; + PyObject* object {}; if (!PyArg_ParseTuple(args, "O!", &EdgePy::Type, &object)) { return nullptr; } diff --git a/src/Mod/Mesh/App/Exporter.cpp b/src/Mod/Mesh/App/Exporter.cpp index 00f9a8f57a..f59c6395c8 100644 --- a/src/Mod/Mesh/App/Exporter.cpp +++ b/src/Mod/Mesh/App/Exporter.cpp @@ -28,8 +28,6 @@ #include #endif -#include "Core/IO/Writer3MF.h" -#include "Core/Iterator.h" #include #include #include @@ -40,6 +38,8 @@ #include #include #include +#include "Core/Iterator.h" +#include "Core/IO/Writer3MF.h" #include #include "Exporter.h" @@ -159,7 +159,7 @@ void Exporter::throwIfNoPermission(const std::string& filename) // ---------------------------------------------------------------------------- MergeExporter::MergeExporter(std::string fileName, MeshIO::Format) - : fName(fileName) + : fName(std::move(fileName)) {} MergeExporter::~MergeExporter() @@ -281,9 +281,9 @@ std::vector Extension3MFFactory::producer; class Exporter3MF::Private { public: - explicit Private(const std::string& filename, const std::vector& ext) + explicit Private(const std::string& filename, std::vector ext) : writer3mf(filename) - , ext(ext) + , ext(std::move(ext)) {} MeshCore::Writer3MF writer3mf; std::vector ext; @@ -428,7 +428,7 @@ bool ExporterAMF::addMesh(const char* name, const MeshObject& mesh) *outputStreamPtr << "\t\t\n" << "\t\t\t\n"; - const MeshCore::MeshGeomFacet* facet; + const MeshCore::MeshGeomFacet* facet {}; // Iterate through all facets of the mesh, and construct a: // * Cache (map) of used vertices, outputting each new unique vertex to diff --git a/src/Mod/Mesh/App/Exporter.h b/src/Mod/Mesh/App/Exporter.h index ad49921d2c..005fc5ed5b 100644 --- a/src/Mod/Mesh/App/Exporter.h +++ b/src/Mod/Mesh/App/Exporter.h @@ -27,9 +27,9 @@ #include #include -#include "Core/IO/Writer3MF.h" -#include "Core/MeshIO.h" #include "MeshFeature.h" +#include "Core/MeshIO.h" +#include "Core/IO/Writer3MF.h" namespace Mesh @@ -61,6 +61,11 @@ public: virtual bool addMesh(const char* name, const MeshObject& mesh) = 0; + Exporter(const Exporter&) = delete; + Exporter(Exporter&&) = delete; + Exporter& operator=(const Exporter&) = delete; + Exporter& operator=(Exporter&&) = delete; + protected: /// Does some simple escaping of characters for XML-type exports static std::string xmlEscape(const std::string& input); @@ -77,6 +82,11 @@ public: MergeExporter(std::string fileName, MeshCore::MeshIO::Format fmt); ~MergeExporter() override; + MergeExporter(const MergeExporter&) = delete; + MergeExporter(MergeExporter&&) = delete; + MergeExporter& operator=(const MergeExporter&) = delete; + MergeExporter& operator=(MergeExporter&&) = delete; + bool addMesh(const char* name, const MeshObject& mesh) override; private: @@ -84,8 +94,10 @@ private: void write(); protected: + // NOLINTBEGIN MeshObject mergingMesh; std::string fName; + // NOLINTEND }; // ------------------------------------------------------------------------------------------------ @@ -101,6 +113,11 @@ protected: public: virtual ~AbstractFormatExtension() = default; + + AbstractFormatExtension(const AbstractFormatExtension&) = delete; + AbstractFormatExtension(AbstractFormatExtension&&) = delete; + AbstractFormatExtension& operator=(const AbstractFormatExtension&) = delete; + AbstractFormatExtension& operator=(AbstractFormatExtension&&) = delete; }; using AbstractFormatExtensionPtr = std::shared_ptr; @@ -129,6 +146,11 @@ public: AbstractExtensionProducer() = default; virtual ~AbstractExtensionProducer() = default; virtual AbstractFormatExtensionPtr create() const = 0; + + AbstractExtensionProducer(const AbstractExtensionProducer&) = delete; + AbstractExtensionProducer(AbstractExtensionProducer&&) = delete; + AbstractExtensionProducer& operator=(const AbstractExtensionProducer&) = delete; + AbstractExtensionProducer& operator=(AbstractExtensionProducer&&) = delete; }; using AbstractExtensionProducerPtr = std::shared_ptr; @@ -186,6 +208,11 @@ public: Exporter3MF(std::string fileName, const std::vector& = {}); ~Exporter3MF() override; + Exporter3MF(const Exporter3MF&) = delete; + Exporter3MF(Exporter3MF&&) = delete; + Exporter3MF& operator=(const Exporter3MF&) = delete; + Exporter3MF& operator=(Exporter3MF&&) = delete; + bool addMesh(const char* name, const MeshObject& mesh) override; /*! * \brief SetForceModel @@ -222,6 +249,11 @@ public: /// Writes AMF footer ~ExporterAMF() override; + ExporterAMF(const ExporterAMF&) = delete; + ExporterAMF(ExporterAMF&&) = delete; + ExporterAMF& operator=(const ExporterAMF&) = delete; + ExporterAMF& operator=(ExporterAMF&&) = delete; + bool addMesh(const char* name, const MeshObject& mesh) override; private: diff --git a/src/Mod/Mesh/App/Facet.cpp b/src/Mod/Mesh/App/Facet.cpp index c4535f1edc..bcbf6f8c49 100644 --- a/src/Mod/Mesh/App/Facet.cpp +++ b/src/Mod/Mesh/App/Facet.cpp @@ -31,7 +31,9 @@ using namespace Mesh; -Facet::Facet(const MeshCore::MeshFacet& face, const MeshObject* obj, MeshCore::FacetIndex index) +Facet::Facet(const MeshCore::MeshFacet& face, // NOLINT + const MeshObject* obj, + MeshCore::FacetIndex index) : Index(index) , Mesh(obj) { @@ -47,7 +49,18 @@ Facet::Facet(const MeshCore::MeshFacet& face, const MeshObject* obj, MeshCore::F } } -Facet::Facet(const Facet& f) +Facet::Facet(const Facet& f) // NOLINT + : MeshCore::MeshGeomFacet(f) + , Index(f.Index) + , Mesh(f.Mesh) +{ + for (int i = 0; i < 3; i++) { + PIndex[i] = f.PIndex[i]; + NIndex[i] = f.NIndex[i]; + } +} + +Facet::Facet(Facet&& f) // NOLINT : MeshCore::MeshGeomFacet(f) , Index(f.Index) , Mesh(f.Mesh) @@ -60,7 +73,7 @@ Facet::Facet(const Facet& f) Facet::~Facet() = default; -void Facet::operator=(const Facet& f) +Facet& Facet::operator=(const Facet& f) { MeshCore::MeshGeomFacet::operator=(f); Mesh = f.Mesh; @@ -69,6 +82,21 @@ void Facet::operator=(const Facet& f) PIndex[i] = f.PIndex[i]; NIndex[i] = f.NIndex[i]; } + + return *this; +} + +Facet& Facet::operator=(Facet&& f) +{ + MeshCore::MeshGeomFacet::operator=(f); + Mesh = f.Mesh; + Index = f.Index; + for (int i = 0; i < 3; i++) { + PIndex[i] = f.PIndex[i]; + NIndex[i] = f.NIndex[i]; + } + + return *this; } Edge Facet::getEdge(int index) const diff --git a/src/Mod/Mesh/App/Facet.h b/src/Mod/Mesh/App/Facet.h index 2ca4ca038a..fd850fe0f8 100644 --- a/src/Mod/Mesh/App/Facet.h +++ b/src/Mod/Mesh/App/Facet.h @@ -43,13 +43,15 @@ public: const MeshObject* obj = nullptr, MeshCore::FacetIndex index = MeshCore::FACET_INDEX_MAX); Facet(const Facet& f); + Facet(Facet&& f); ~Facet(); bool isBound() const { return Index != MeshCore::FACET_INDEX_MAX; } - void operator=(const Facet& f); + Facet& operator=(const Facet& f); + Facet& operator=(Facet&& f); Edge getEdge(int) const; MeshCore::FacetIndex Index; diff --git a/src/Mod/Mesh/App/FacetPyImp.cpp b/src/Mod/Mesh/App/FacetPyImp.cpp index eb8ca46032..61d85a6e65 100644 --- a/src/Mod/Mesh/App/FacetPyImp.cpp +++ b/src/Mod/Mesh/App/FacetPyImp.cpp @@ -25,13 +25,11 @@ #include #include -// clang-format off #include "Facet.h" #include "FacetPy.h" #include "FacetPy.cpp" #include "EdgePy.h" #include "Mesh.h" -// clang-format on using namespace Mesh; diff --git a/src/Mod/Mesh/App/FeatureMeshSetOperations.cpp b/src/Mod/Mesh/App/FeatureMeshSetOperations.cpp index 7ba08f5c84..a764763d0c 100644 --- a/src/Mod/Mesh/App/FeatureMeshSetOperations.cpp +++ b/src/Mod/Mesh/App/FeatureMeshSetOperations.cpp @@ -69,7 +69,7 @@ App::DocumentObjectExecReturn* SetOperations::execute() std::unique_ptr pcKernel(new MeshObject()); // Result Meshkernel - MeshCore::SetOperations::OperationType type; + MeshCore::SetOperations::OperationType type {}; string ot(OperationType.getValue()); if (ot == "union") { type = MeshCore::SetOperations::Union; diff --git a/src/Mod/Mesh/App/Mesh.cpp b/src/Mod/Mesh/App/Mesh.cpp index 65e65dd4aa..6c3df65f05 100644 --- a/src/Mod/Mesh/App/Mesh.cpp +++ b/src/Mod/Mesh/App/Mesh.cpp @@ -63,13 +63,13 @@ TYPESYSTEM_SOURCE(Mesh::MeshSegment, Data::Segment) MeshObject::MeshObject() = default; -MeshObject::MeshObject(const MeshCore::MeshKernel& Kernel) +MeshObject::MeshObject(const MeshCore::MeshKernel& Kernel) // NOLINT : _kernel(Kernel) { // copy the mesh structure } -MeshObject::MeshObject(const MeshCore::MeshKernel& Kernel, const Base::Matrix4D& Mtrx) +MeshObject::MeshObject(const MeshCore::MeshKernel& Kernel, const Base::Matrix4D& Mtrx) // NOLINT : _Mtrx(Mtrx) , _kernel(Kernel) { @@ -84,6 +84,14 @@ MeshObject::MeshObject(const MeshObject& mesh) copySegments(mesh); } +MeshObject::MeshObject(MeshObject&& mesh) + : _Mtrx(mesh._Mtrx) + , _kernel(mesh._kernel) +{ + // copy the mesh structure + copySegments(mesh); +} + MeshObject::~MeshObject() = default; std::vector MeshObject::getElementTypes() const @@ -207,7 +215,7 @@ void MeshObject::swapSegments(MeshObject& mesh) }); } -void MeshObject::operator=(const MeshObject& mesh) +MeshObject& MeshObject::operator=(const MeshObject& mesh) { if (this != &mesh) { // copy the mesh structure @@ -215,6 +223,20 @@ void MeshObject::operator=(const MeshObject& mesh) this->_kernel = mesh._kernel; copySegments(mesh); } + + return *this; +} + +MeshObject& MeshObject::operator=(MeshObject&& mesh) +{ + if (this != &mesh) { + // copy the mesh structure + setTransform(mesh._Mtrx); + this->_kernel = mesh._kernel; + copySegments(mesh); + } + + return *this; } void MeshObject::setKernel(const MeshCore::MeshKernel& m) @@ -294,7 +316,7 @@ double MeshObject::getVolume() const Base::Vector3d MeshObject::getPoint(PointIndex index) const { - Base::Vector3f vertf = _kernel.GetPoint(index); + MeshCore::MeshPoint vertf = _kernel.GetPoint(index); Base::Vector3d vertd(vertf.x, vertf.y, vertf.z); vertd = _Mtrx * vertd; return vertd; @@ -337,7 +359,7 @@ void MeshObject::getFaces(std::vector& Points, const MeshCore::MeshFacetArray& ary = _kernel.GetFacets(); Topo.reserve(ctfacets); for (unsigned long i = 0; i < ctfacets; i++) { - Facet face; + Facet face {}; face.I1 = (unsigned int)ary[i]._aulPoints[0]; face.I2 = (unsigned int)ary[i]._aulPoints[1]; face.I3 = (unsigned int)ary[i]._aulPoints[2]; @@ -1002,7 +1024,7 @@ void MeshObject::offsetSpecial(float fSize, float zmax, float zmin) // go through all the vertex normals for (std::vector::iterator It = normals.begin(); It != normals.end(); ++It, i++) { - Base::Vector3f Pnt = _kernel.GetPoint(i); + auto Pnt = _kernel.GetPoint(i); if (Pnt.z < zmax && Pnt.z > zmin) { Pnt.z = 0; _kernel.MovePoint(i, Pnt.Normalize() * fSize); @@ -1116,7 +1138,7 @@ void MeshObject::cut(const Base::Polygon2d& polygon2d, MeshCore::MeshAlgorithm meshAlg(kernel); std::vector check; - bool inner; + bool inner {}; switch (type) { case INNER: inner = true; @@ -2124,11 +2146,17 @@ MeshObject::const_point_iterator::const_point_iterator(const MeshObject* mesh, P MeshObject::const_point_iterator::const_point_iterator(const MeshObject::const_point_iterator& fi) = default; +MeshObject::const_point_iterator::const_point_iterator(MeshObject::const_point_iterator&& fi) = + default; + MeshObject::const_point_iterator::~const_point_iterator() = default; MeshObject::const_point_iterator& MeshObject::const_point_iterator::operator=(const MeshObject::const_point_iterator& pi) = default; +MeshObject::const_point_iterator& +MeshObject::const_point_iterator::operator=(MeshObject::const_point_iterator&& pi) = default; + void MeshObject::const_point_iterator::dereference() { this->_point.x = _p_it->x; @@ -2185,11 +2213,17 @@ MeshObject::const_facet_iterator::const_facet_iterator(const MeshObject* mesh, F MeshObject::const_facet_iterator::const_facet_iterator(const MeshObject::const_facet_iterator& fi) = default; +MeshObject::const_facet_iterator::const_facet_iterator(MeshObject::const_facet_iterator&& fi) = + default; + MeshObject::const_facet_iterator::~const_facet_iterator() = default; MeshObject::const_facet_iterator& MeshObject::const_facet_iterator::operator=(const MeshObject::const_facet_iterator& fi) = default; +MeshObject::const_facet_iterator& +MeshObject::const_facet_iterator::operator=(MeshObject::const_facet_iterator&& fi) = default; + void MeshObject::const_facet_iterator::dereference() { this->_facet.MeshCore::MeshGeomFacet::operator=(*_f_it); diff --git a/src/Mod/Mesh/App/Mesh.h b/src/Mod/Mesh/App/Mesh.h index 3e68073de8..66bbb678c3 100644 --- a/src/Mod/Mesh/App/Mesh.h +++ b/src/Mod/Mesh/App/Mesh.h @@ -114,9 +114,11 @@ public: explicit MeshObject(const MeshCore::MeshKernel& Kernel); explicit MeshObject(const MeshCore::MeshKernel& Kernel, const Base::Matrix4D& Mtrx); MeshObject(const MeshObject&); + MeshObject(MeshObject&&); ~MeshObject() override; - void operator=(const MeshObject&); + MeshObject& operator=(const MeshObject&); + MeshObject& operator=(MeshObject&&); /** @name Subelement management */ //@{ @@ -380,9 +382,11 @@ public: public: const_point_iterator(const MeshObject*, PointIndex index); const_point_iterator(const const_point_iterator& pi); + const_point_iterator(const_point_iterator&& pi); ~const_point_iterator(); const_point_iterator& operator=(const const_point_iterator& fi); + const_point_iterator& operator=(const_point_iterator&& fi); const MeshPoint& operator*(); const MeshPoint* operator->(); bool operator==(const const_point_iterator& fi) const; @@ -402,9 +406,11 @@ public: public: const_facet_iterator(const MeshObject*, FacetIndex index); const_facet_iterator(const const_facet_iterator& fi); + const_facet_iterator(const_facet_iterator&& fi); ~const_facet_iterator(); const_facet_iterator& operator=(const const_facet_iterator& fi); + const_facet_iterator& operator=(const_facet_iterator&& fi); Mesh::Facet& operator*(); Mesh::Facet* operator->(); bool operator==(const const_facet_iterator& fi) const; diff --git a/src/Mod/Mesh/App/MeshPointPyImp.cpp b/src/Mod/Mesh/App/MeshPointPyImp.cpp index 966483c7f3..00f0509655 100644 --- a/src/Mod/Mesh/App/MeshPointPyImp.cpp +++ b/src/Mod/Mesh/App/MeshPointPyImp.cpp @@ -41,7 +41,7 @@ using namespace Mesh; std::string MeshPointPy::representation() const { MeshPointPy::PointerType ptr = getMeshPointPtr(); - Base::Vector3d vec = *ptr; + Base::Vector3d vec = *ptr; // NOLINT std::stringstream str; str << "MeshPoint ("; diff --git a/src/Mod/Mesh/App/MeshProperties.cpp b/src/Mod/Mesh/App/MeshProperties.cpp index 761827f579..bcfa6cbb87 100644 --- a/src/Mod/Mesh/App/MeshProperties.cpp +++ b/src/Mod/Mesh/App/MeshProperties.cpp @@ -30,11 +30,11 @@ #include #include "Core/Iterator.h" -#include "Core/MeshIO.h" #include "Core/MeshKernel.h" +#include "Core/MeshIO.h" -#include "Mesh.h" #include "MeshProperties.h" +#include "Mesh.h" #include "MeshPy.h" @@ -645,7 +645,7 @@ void PropertyMaterial::RestoreDocFile(Base::Reader& reader) str >> count; color.resize(count); for (auto& it : color) { - uint32_t value; // must be 32 bit long + uint32_t value {}; // must be 32 bit long str >> value; it.setPackedValue(value); } @@ -656,7 +656,7 @@ void PropertyMaterial::RestoreDocFile(Base::Reader& reader) str >> count; value.resize(count); for (auto& it : value) { - float valueF; + float valueF {}; str >> valueF; it = valueF; } diff --git a/src/Mod/Mesh/App/MeshProperties.h b/src/Mod/Mesh/App/MeshProperties.h index 123312e8e7..d30048f24f 100644 --- a/src/Mod/Mesh/App/MeshProperties.h +++ b/src/Mod/Mesh/App/MeshProperties.h @@ -100,8 +100,10 @@ private: /** Curvature information. */ struct MeshExport CurvatureInfo { - float fMaxCurvature, fMinCurvature; - Base::Vector3f cMaxCurvDir, cMinCurvDir; + float fMaxCurvature {0.0F}; + float fMinCurvature {0.0F}; + Base::Vector3f cMaxCurvDir; + Base::Vector3f cMinCurvDir; }; /** The Curvature property class. @@ -236,6 +238,11 @@ public: PropertyMeshKernel(); ~PropertyMeshKernel() override; + PropertyMeshKernel(const PropertyMeshKernel&) = delete; + PropertyMeshKernel(PropertyMeshKernel&&) = delete; + PropertyMeshKernel& operator=(const PropertyMeshKernel&) = delete; + PropertyMeshKernel& operator=(PropertyMeshKernel&&) = delete; + /** @name Getter/setter */ //@{ /** This method references the passed mesh object and takes possession of it, diff --git a/src/Mod/Mesh/App/MeshPyImp.cpp b/src/Mod/Mesh/App/MeshPyImp.cpp index 7fb3bfdae0..7082c2ef30 100644 --- a/src/Mod/Mesh/App/MeshPyImp.cpp +++ b/src/Mod/Mesh/App/MeshPyImp.cpp @@ -37,14 +37,12 @@ #include "Core/Smoothing.h" #include "Core/Triangulation.h" -// clang-format off #include "Mesh.h" #include "MeshPy.h" #include "MeshPointPy.h" #include "FacetPy.h" #include "MeshPy.cpp" #include "MeshProperties.h" -// clang-format on using namespace Mesh; @@ -150,7 +148,7 @@ PyObject* MeshPy::copy(PyObject* args) PyObject* MeshPy::read(PyObject* args, PyObject* kwds) { - char* Name; + char* Name {}; static const std::array keywords_path {"Filename", nullptr}; if (Base::Wrapped_ParseTupleAndKeywords(args, kwds, "et", keywords_path, "utf-8", &Name)) { getMeshObjectPtr()->load(Name); @@ -180,8 +178,8 @@ PyObject* MeshPy::read(PyObject* args, PyObject* kwds) ext["APLY"] = MeshCore::MeshIO::APLY; ext["PY"] = MeshCore::MeshIO::PY; - PyObject* input; - char* Ext; + PyObject* input {}; + char* Ext {}; static const std::array keywords_stream {"Stream", "Format", nullptr}; if (Base::Wrapped_ParseTupleAndKeywords(args, kwds, "Os", keywords_stream, &input, &Ext)) { std::string fmt(Ext); @@ -205,7 +203,7 @@ PyObject* MeshPy::read(PyObject* args, PyObject* kwds) PyObject* MeshPy::write(PyObject* args, PyObject* kwds) { - char* Name; + char* Name = nullptr; char* Ext = nullptr; char* ObjName = nullptr; PyObject* List = nullptr; @@ -360,7 +358,7 @@ PyObject* MeshPy::writeInventor(PyObject* args) PyObject* MeshPy::offset(PyObject* args) { - float Float; + float Float {}; if (!PyArg_ParseTuple(args, "f", &Float)) { return nullptr; } @@ -376,7 +374,7 @@ PyObject* MeshPy::offset(PyObject* args) PyObject* MeshPy::offsetSpecial(PyObject* args) { - float Float, zmin, zmax; + float Float {}, zmin {}, zmax {}; if (!PyArg_ParseTuple(args, "fff", &Float, &zmin, &zmax)) { return nullptr; } @@ -392,7 +390,7 @@ PyObject* MeshPy::offsetSpecial(PyObject* args) PyObject* MeshPy::crossSections(PyObject* args) { - PyObject* obj; + PyObject* obj {}; PyObject* poly = Py_False; float min_eps = 1.0e-2f; if (!PyArg_ParseTuple(args, "O|fO!", &obj, &min_eps, &PyBool_Type, &poly)) { @@ -454,8 +452,8 @@ PyObject* MeshPy::crossSections(PyObject* args) PyObject* MeshPy::unite(PyObject* args) { - MeshPy* pcObject; - PyObject* pcObj; + MeshPy* pcObject {}; + PyObject* pcObj {}; if (!PyArg_ParseTuple(args, "O!", &(MeshPy::Type), &pcObj)) { return nullptr; } @@ -474,8 +472,8 @@ PyObject* MeshPy::unite(PyObject* args) PyObject* MeshPy::intersect(PyObject* args) { - MeshPy* pcObject; - PyObject* pcObj; + MeshPy* pcObject {}; + PyObject* pcObj {}; if (!PyArg_ParseTuple(args, "O!", &(MeshPy::Type), &pcObj)) { return nullptr; } @@ -494,8 +492,8 @@ PyObject* MeshPy::intersect(PyObject* args) PyObject* MeshPy::difference(PyObject* args) { - MeshPy* pcObject; - PyObject* pcObj; + MeshPy* pcObject {}; + PyObject* pcObj {}; if (!PyArg_ParseTuple(args, "O!", &(MeshPy::Type), &pcObj)) { return nullptr; } @@ -514,8 +512,8 @@ PyObject* MeshPy::difference(PyObject* args) PyObject* MeshPy::inner(PyObject* args) { - MeshPy* pcObject; - PyObject* pcObj; + MeshPy* pcObject {}; + PyObject* pcObj {}; if (!PyArg_ParseTuple(args, "O!", &(MeshPy::Type), &pcObj)) { return nullptr; } @@ -534,8 +532,8 @@ PyObject* MeshPy::inner(PyObject* args) PyObject* MeshPy::outer(PyObject* args) { - MeshPy* pcObject; - PyObject* pcObj; + MeshPy* pcObject {}; + PyObject* pcObj {}; if (!PyArg_ParseTuple(args, "O!", &(MeshPy::Type), &pcObj)) { return nullptr; } @@ -554,7 +552,7 @@ PyObject* MeshPy::outer(PyObject* args) PyObject* MeshPy::section(PyObject* args, PyObject* kwds) { - PyObject* pcObj; + PyObject* pcObj {}; PyObject* connectLines = Py_True; float fMinDist = 0.0001f; @@ -603,7 +601,7 @@ PyObject* MeshPy::coarsen(PyObject* args) PyObject* MeshPy::translate(PyObject* args) { - float x, y, z; + float x {}, y {}, z {}; if (!PyArg_ParseTuple(args, "fff", &x, &y, &z)) { return nullptr; } @@ -621,7 +619,7 @@ PyObject* MeshPy::translate(PyObject* args) PyObject* MeshPy::rotate(PyObject* args) { - double x, y, z; + double x {}, y {}, z {}; if (!PyArg_ParseTuple(args, "ddd", &x, &y, &z)) { return nullptr; } @@ -641,7 +639,7 @@ PyObject* MeshPy::rotate(PyObject* args) PyObject* MeshPy::transform(PyObject* args) { - PyObject* mat; + PyObject* mat {}; if (!PyArg_ParseTuple(args, "O!", &(Base::MatrixPy::Type), &mat)) { return nullptr; } @@ -679,7 +677,7 @@ PyObject* MeshPy::getEigenSystem(PyObject* args) PyObject* MeshPy::addFacet(PyObject* args) { - double x1, y1, z1, x2, y2, z2, x3, y3, z3; + double x1 {}, y1 {}, z1 {}, x2 {}, y2 {}, z2 {}, x3 {}, y3 {}, z3 {}; if (PyArg_ParseTuple(args, "ddddddddd", &x1, &y1, &z1, &x2, &y2, &z2, &x3, &y3, &z3)) { getMeshObjectPtr()->addFacet( MeshCore::MeshGeomFacet(Base::Vector3f((float)x1, (float)y1, (float)z1), @@ -689,7 +687,7 @@ PyObject* MeshPy::addFacet(PyObject* args) } PyErr_Clear(); - PyObject *v1, *v2, *v3; + PyObject *v1 {}, *v2 {}, *v3 {}; if (PyArg_ParseTuple(args, "O!O!O!", &(Base::VectorPy::Type), @@ -709,7 +707,7 @@ PyObject* MeshPy::addFacet(PyObject* args) } PyErr_Clear(); - PyObject* f; + PyObject* f {}; if (PyArg_ParseTuple(args, "O!", &(Mesh::FacetPy::Type), &f)) { Mesh::FacetPy* face = static_cast(f); getMeshObjectPtr()->addFacet(*face->getFacetPtr()); @@ -722,7 +720,7 @@ PyObject* MeshPy::addFacet(PyObject* args) PyObject* MeshPy::addFacets(PyObject* args) { - PyObject* list; + PyObject* list {}; if (PyArg_ParseTuple(args, "O!", &PyList_Type, &list)) { Py::List list_f(list); Py::Type vVType(Base::getTypeAsObject(&Base::VectorPy::Type)); @@ -824,7 +822,7 @@ PyObject* MeshPy::addFacets(PyObject* args) PyObject* MeshPy::removeFacets(PyObject* args) { - PyObject* list; + PyObject* list {}; if (!PyArg_ParseTuple(args, "O", &list)) { return nullptr; } @@ -873,7 +871,7 @@ PyObject* MeshPy::rebuildNeighbourHood(PyObject* args) PyObject* MeshPy::addMesh(PyObject* args) { - PyObject* mesh; + PyObject* mesh {}; if (!PyArg_ParseTuple(args, "O!", &(MeshPy::Type), &mesh)) { return nullptr; } @@ -889,8 +887,8 @@ PyObject* MeshPy::addMesh(PyObject* args) PyObject* MeshPy::setPoint(PyObject* args) { - unsigned long index; - PyObject* pnt; + unsigned long index {}; + PyObject* pnt {}; if (!PyArg_ParseTuple(args, "kO!", &index, &(Base::VectorPy::Type), &pnt)) { return nullptr; } @@ -906,7 +904,7 @@ PyObject* MeshPy::setPoint(PyObject* args) PyObject* MeshPy::movePoint(PyObject* args) { - unsigned long index; + unsigned long index {}; Base::Vector3d vec; do { @@ -917,7 +915,7 @@ PyObject* MeshPy::movePoint(PyObject* args) } PyErr_Clear(); // set by PyArg_ParseTuple() - PyObject* object; + PyObject* object {}; if (PyArg_ParseTuple(args, "kO!", &index, &(Base::VectorPy::Type), &object)) { vec = *(static_cast(object)->getVectorPtr()); break; @@ -952,7 +950,7 @@ PyObject* MeshPy::getPointNormals(PyObject* args) PyObject* MeshPy::addSegment(PyObject* args) { - PyObject* pylist; + PyObject* pylist {}; if (!PyArg_ParseTuple(args, "O", &pylist)) { return nullptr; } @@ -985,7 +983,7 @@ PyObject* MeshPy::countSegments(PyObject* args) PyObject* MeshPy::getSegment(PyObject* args) { - unsigned long index; + unsigned long index {}; if (!PyArg_ParseTuple(args, "k", &index)) { return nullptr; } @@ -1055,7 +1053,7 @@ PyObject* MeshPy::getPointSelection(PyObject* args) PyObject* MeshPy::meshFromSegment(PyObject* args) { - PyObject* list; + PyObject* list {}; if (!PyArg_ParseTuple(args, "O", &list)) { return nullptr; } @@ -1353,7 +1351,7 @@ PyObject* MeshPy::countComponents(PyObject* args) PyObject* MeshPy::removeComponents(PyObject* args) { - unsigned long count; + unsigned long count {}; if (!PyArg_ParseTuple(args, "k", &count)) { return nullptr; } @@ -1371,7 +1369,7 @@ PyObject* MeshPy::removeComponents(PyObject* args) PyObject* MeshPy::fillupHoles(PyObject* args) { - unsigned long len; + unsigned long len {}; int level = 0; float max_area = 0.0f; if (!PyArg_ParseTuple(args, "k|if", &len, &level, &max_area)) { @@ -1434,7 +1432,7 @@ PyObject* MeshPy::fixCaps(PyObject* args) PyObject* MeshPy::fixDeformations(PyObject* args) { - float fMaxAngle; + float fMaxAngle {}; float fEpsilon = MeshCore::MeshDefinitions::_fMinPointDistanceP2; if (!PyArg_ParseTuple(args, "f|f", &fMaxAngle, &fEpsilon)) { return nullptr; @@ -1512,7 +1510,7 @@ PyObject* MeshPy::refine(PyObject* args) PyObject* MeshPy::removeNeedles(PyObject* args) { - float length; + float length {}; if (!PyArg_ParseTuple(args, "f", &length)) { return nullptr; } @@ -1609,8 +1607,8 @@ PyObject* MeshPy::splitEdges(PyObject* args) PyObject* MeshPy::splitEdge(PyObject* args) { - unsigned long facet, neighbour; - PyObject* vertex; + unsigned long facet {}, neighbour {}; + PyObject* vertex {}; if (!PyArg_ParseTuple(args, "kkO!", &facet, &neighbour, &Base::VectorPy::Type, &vertex)) { return nullptr; } @@ -1647,9 +1645,9 @@ PyObject* MeshPy::splitEdge(PyObject* args) PyObject* MeshPy::splitFacet(PyObject* args) { - unsigned long facet; - PyObject* vertex1; - PyObject* vertex2; + unsigned long facet {}; + PyObject* vertex1 {}; + PyObject* vertex2 {}; if (!PyArg_ParseTuple(args, "kO!O!", &facet, @@ -1685,7 +1683,7 @@ PyObject* MeshPy::splitFacet(PyObject* args) PyObject* MeshPy::swapEdge(PyObject* args) { - unsigned long facet, neighbour; + unsigned long facet {}, neighbour {}; if (!PyArg_ParseTuple(args, "kk", &facet, &neighbour)) { return nullptr; } @@ -1718,7 +1716,7 @@ PyObject* MeshPy::swapEdge(PyObject* args) PyObject* MeshPy::collapseEdge(PyObject* args) { - unsigned long facet, neighbour; + unsigned long facet {}, neighbour {}; if (!PyArg_ParseTuple(args, "kk", &facet, &neighbour)) { return nullptr; } @@ -1751,7 +1749,7 @@ PyObject* MeshPy::collapseEdge(PyObject* args) PyObject* MeshPy::collapseFacet(PyObject* args) { - unsigned long facet; + unsigned long facet {}; if (!PyArg_ParseTuple(args, "k", &facet)) { return nullptr; } @@ -1772,8 +1770,8 @@ PyObject* MeshPy::collapseFacet(PyObject* args) PyObject* MeshPy::insertVertex(PyObject* args) { - unsigned long facet; - PyObject* vertex; + unsigned long facet {}; + PyObject* vertex {}; if (!PyArg_ParseTuple(args, "kO!", &facet, &Base::VectorPy::Type, &vertex)) { return nullptr; } @@ -1798,8 +1796,8 @@ PyObject* MeshPy::insertVertex(PyObject* args) PyObject* MeshPy::snapVertex(PyObject* args) { - unsigned long facet; - PyObject* vertex; + unsigned long facet {}; + PyObject* vertex {}; if (!PyArg_ParseTuple(args, "kO!", &facet, &Base::VectorPy::Type, &vertex)) { return nullptr; } @@ -1858,8 +1856,8 @@ PyObject* MeshPy::collapseFacets(PyObject* args) PyObject* MeshPy::foraminate(PyObject* args) { - PyObject* pnt_p; - PyObject* dir_p; + PyObject* pnt_p {}; + PyObject* dir_p {}; double maxAngle = MeshCore::Mathd::PI; if (!PyArg_ParseTuple(args, "OO|d", &pnt_p, &dir_p, &maxAngle)) { return nullptr; @@ -1890,8 +1888,8 @@ PyObject* MeshPy::foraminate(PyObject* args) PyObject* MeshPy::cut(PyObject* args) { - PyObject* poly; - int mode; + PyObject* poly {}; + int mode {}; if (!PyArg_ParseTuple(args, "Oi", &poly, &mode)) { return nullptr; } @@ -1926,8 +1924,8 @@ PyObject* MeshPy::cut(PyObject* args) PyObject* MeshPy::trim(PyObject* args) { - PyObject* poly; - int mode; + PyObject* poly {}; + int mode {}; if (!PyArg_ParseTuple(args, "Oi", &poly, &mode)) { return nullptr; } @@ -1962,7 +1960,7 @@ PyObject* MeshPy::trim(PyObject* args) PyObject* MeshPy::trimByPlane(PyObject* args) { - PyObject *base, *norm; + PyObject *base {}, *norm {}; if (!PyArg_ParseTuple(args, "O!O!", &Base::VectorPy::Type, @@ -2046,7 +2044,7 @@ PyObject* MeshPy::smooth(PyObject* args, PyObject* kwds) PyObject* MeshPy::decimate(PyObject* args) { - float fTol, fRed; + float fTol {}, fRed {}; if (PyArg_ParseTuple(args, "ff", &fTol, &fRed)) { PY_TRY { @@ -2058,7 +2056,7 @@ PyObject* MeshPy::decimate(PyObject* args) } PyErr_Clear(); - int targetSize; + int targetSize {}; if (PyArg_ParseTuple(args, "i", &targetSize)) { PY_TRY { @@ -2076,8 +2074,8 @@ PyObject* MeshPy::decimate(PyObject* args) PyObject* MeshPy::nearestFacetOnRay(PyObject* args) { - PyObject* pnt_p; - PyObject* dir_p; + PyObject* pnt_p {}; + PyObject* dir_p {}; double maxAngle = MeshCore::Mathd::PI; if (!PyArg_ParseTuple(args, "OO|d", &pnt_p, &dir_p, &maxAngle)) { return nullptr; @@ -2107,7 +2105,7 @@ PyObject* MeshPy::nearestFacetOnRay(PyObject* args) PyObject* MeshPy::getPlanarSegments(PyObject* args) { - float dev; + float dev {}; unsigned long minFacets = 0; if (!PyArg_ParseTuple(args, "f|k", &dev, &minFacets)) { return nullptr; @@ -2132,14 +2130,14 @@ PyObject* MeshPy::getPlanarSegments(PyObject* args) PyObject* MeshPy::getSegmentsOfType(PyObject* args) { - char* type; - float dev; + char* type {}; + float dev {}; unsigned long minFacets = 0; if (!PyArg_ParseTuple(args, "sf|k", &type, &dev, &minFacets)) { return nullptr; } - Mesh::MeshObject::GeometryType geoType; + Mesh::MeshObject::GeometryType geoType {}; if (strcmp(type, "Plane") == 0) { geoType = Mesh::MeshObject::PLANE; } @@ -2172,7 +2170,7 @@ PyObject* MeshPy::getSegmentsOfType(PyObject* args) PyObject* MeshPy::getSegmentsByCurvature(PyObject* args) { - PyObject* l; + PyObject* l {}; if (!PyArg_ParseTuple(args, "O", &l)) { return nullptr; } diff --git a/src/Mod/Mesh/App/MeshTexture.cpp b/src/Mod/Mesh/App/MeshTexture.cpp index 3e657388c9..607131613f 100644 --- a/src/Mod/Mesh/App/MeshTexture.cpp +++ b/src/Mod/Mesh/App/MeshTexture.cpp @@ -29,8 +29,8 @@ using namespace Mesh; MeshTexture::MeshTexture(const Mesh::MeshObject& mesh, const MeshCore::Material& material) : materialRefMesh(material) + , countPointsRefMesh {mesh.countPoints()} { - countPointsRefMesh = mesh.countPoints(); unsigned long countFacets = mesh.countFacets(); if (material.binding == MeshCore::MeshIO::PER_VERTEX diff --git a/src/Mod/Mesh/App/MeshTexture.h b/src/Mod/Mesh/App/MeshTexture.h index bcc5dfc35b..88ebd0374f 100644 --- a/src/Mod/Mesh/App/MeshTexture.h +++ b/src/Mod/Mesh/App/MeshTexture.h @@ -90,7 +90,7 @@ private: } else { Base::Vector3f n; - float dist; + float dist {}; return kdTree->FindNearest(p, max_dist, n, dist); } } diff --git a/src/Mod/Mesh/Gui/AppMeshGui.cpp b/src/Mod/Mesh/Gui/AppMeshGui.cpp index c871bde735..1f338f8ae0 100644 --- a/src/Mod/Mesh/Gui/AppMeshGui.cpp +++ b/src/Mod/Mesh/Gui/AppMeshGui.cpp @@ -83,8 +83,8 @@ public: private: Py::Object convertToSTL(const Py::Tuple& args) { - char* inname; - char* outname; + char* inname {}; + char* outname {}; if (!PyArg_ParseTuple(args.ptr(), "etet", "utf-8", &inname, "utf-8", &outname)) { throw Py::Exception(); } @@ -108,7 +108,7 @@ private: } } - return Py::Boolean(ok); + return Py::Boolean(ok); // NOLINT } }; @@ -147,6 +147,7 @@ PyMOD_INIT_FUNC(MeshGui) (void)new MeshGui::CleanupHandler; } + // NOLINTBEGIN // try to instantiate flat-mesh commands try { Base::Interpreter().runString("import MeshFlatteningCommand"); @@ -162,6 +163,7 @@ PyMOD_INIT_FUNC(MeshGui) QT_TRANSLATE_NOOP("QObject", "Import-Export")); Mesh::Extension3MFFactory::addProducer(new MeshGui::ThumbnailExtensionProducer); + // NOLINTEND // clang-format off MeshGui::SoFCMeshObjectElement ::initClass(); diff --git a/src/Mod/Mesh/Gui/Command.cpp b/src/Mod/Mesh/Gui/Command.cpp index cb188c68cc..87a8d4f19b 100644 --- a/src/Mod/Mesh/Gui/Command.cpp +++ b/src/Mod/Mesh/Gui/Command.cpp @@ -465,7 +465,7 @@ CmdMeshFromGeometry::CmdMeshFromGeometry() void CmdMeshFromGeometry::activated(int) { - bool ok; + bool ok {}; double tol = QInputDialog::getDouble(Gui::getMainWindow(), QObject::tr("Meshing Tolerance"), QObject::tr("Enter tolerance for meshing geometry:"), @@ -1532,7 +1532,7 @@ void CmdMeshFillupHoles::activated(int) { std::vector meshes = getSelection().getObjectsOfType(Mesh::Feature::getClassTypeId()); - bool ok; + bool ok {}; int FillupHolesOfLength = QInputDialog::getInt(Gui::getMainWindow(), QObject::tr("Fill holes"), @@ -1797,7 +1797,7 @@ void CmdMeshScale::activated(int) return; } - bool ok; + bool ok {}; double factor = QInputDialog::getDouble(Gui::getMainWindow(), QObject::tr("Scaling"), QObject::tr("Enter scaling factor:"), diff --git a/src/Mod/Mesh/Gui/DlgDecimating.cpp b/src/Mod/Mesh/Gui/DlgDecimating.cpp index f5a5020df7..1cbf2d8f96 100644 --- a/src/Mod/Mesh/Gui/DlgDecimating.cpp +++ b/src/Mod/Mesh/Gui/DlgDecimating.cpp @@ -37,7 +37,6 @@ using namespace MeshGui; DlgDecimating::DlgDecimating(QWidget* parent, Qt::WindowFlags fl) : QWidget(parent, fl) - , numberOfTriangles(0) , ui(new Ui_DlgDecimating) { ui->setupUi(this); @@ -135,7 +134,7 @@ double DlgDecimating::reduction() const TaskDecimating::TaskDecimating() { - widget = new DlgDecimating(); + widget = new DlgDecimating(); // NOLINT Gui::TaskView::TaskBox* taskbox = new Gui::TaskView::TaskBox(QPixmap(), widget->windowTitle(), false, nullptr); taskbox->groupLayout()->addWidget(widget); diff --git a/src/Mod/Mesh/Gui/DlgDecimating.h b/src/Mod/Mesh/Gui/DlgDecimating.h index 94616ae5e6..58efb56f42 100644 --- a/src/Mod/Mesh/Gui/DlgDecimating.h +++ b/src/Mod/Mesh/Gui/DlgDecimating.h @@ -24,9 +24,9 @@ #ifndef MESHGUI_DLGDECIMATING_H #define MESHGUI_DLGDECIMATING_H +#include #include #include -#include #include namespace MeshGui @@ -49,7 +49,7 @@ private: void onCheckAbsoluteNumberToggled(bool); private: - int numberOfTriangles; + int numberOfTriangles {0}; std::unique_ptr ui; }; diff --git a/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp b/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp index 5439943b03..24ef560230 100644 --- a/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp +++ b/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp @@ -30,20 +30,20 @@ #include #include -#include #include +#include #include +#include #include #include -#include -#include -#include #include +#include +#include #include "DlgEvaluateMeshImp.h" +#include "ui_DlgEvaluateMesh.h" #include "DlgEvaluateSettings.h" #include "ViewProviderDefects.h" -#include "ui_DlgEvaluateMesh.h" using namespace MeshCore; @@ -551,7 +551,7 @@ void DlgEvaluateMeshImp::onRepairOrientationButtonClicked() doc->openCommand(QT_TRANSLATE_NOOP("Command", "Harmonize normals")); try { Gui::Command::doCommand(Gui::Command::App, - "App.getDocument(\"%s\").getObject(\"%s\").harmonizeNormals()", + R"(App.getDocument("%s").getObject("%s").harmonizeNormals())", docName, objName); } @@ -661,16 +661,15 @@ void DlgEvaluateMeshImp::onRepairNonmanifoldsButtonClicked() Gui::Document* doc = Gui::Application::Instance->getDocument(docName); doc->openCommand(QT_TRANSLATE_NOOP("Command", "Remove non-manifolds")); try { - Gui::Command::doCommand( - Gui::Command::App, - "App.getDocument(\"%s\").getObject(\"%s\").removeNonManifolds()", - docName, - objName); + Gui::Command::doCommand(Gui::Command::App, + R"(App.getDocument("%s").getObject("%s").removeNonManifolds())", + docName, + objName); if (d->checkNonManfoldPoints) { Gui::Command::doCommand( Gui::Command::App, - "App.getDocument(\"%s\").getObject(\"%s\").removeNonManifoldPoints()", + R"(App.getDocument("%s").getObject("%s").removeNonManifoldPoints())", docName, objName); } @@ -768,7 +767,7 @@ void DlgEvaluateMeshImp::onRepairIndicesButtonClicked() doc->openCommand(QT_TRANSLATE_NOOP("Command", "Fix indices")); try { Gui::Command::doCommand(Gui::Command::App, - "App.getDocument(\"%s\").getObject(\"%s\").fixIndices()", + R"(App.getDocument("%s").getObject("%s").fixIndices())", docName, objName); } @@ -837,12 +836,11 @@ void DlgEvaluateMeshImp::onRepairDegeneratedButtonClicked() Gui::Document* doc = Gui::Application::Instance->getDocument(docName); doc->openCommand(QT_TRANSLATE_NOOP("Command", "Remove degenerated faces")); try { - Gui::Command::doCommand( - Gui::Command::App, - "App.getDocument(\"%s\").getObject(\"%s\").fixDegenerations(%f)", - docName, - objName, - d->epsilonDegenerated); + Gui::Command::doCommand(Gui::Command::App, + R"(App.getDocument("%s").getObject("%s").fixDegenerations(%f))", + docName, + objName, + d->epsilonDegenerated); } catch (const Base::Exception& e) { QMessageBox::warning(this, tr("Degenerations"), QString::fromLatin1(e.what())); @@ -912,7 +910,7 @@ void DlgEvaluateMeshImp::onRepairDuplicatedFacesButtonClicked() try { Gui::Command::doCommand( Gui::Command::App, - "App.getDocument(\"%s\").getObject(\"%s\").removeDuplicatedFacets()", + R"(App.getDocument("%s").getObject("%s").removeDuplicatedFacets())", docName, objName); } @@ -982,7 +980,7 @@ void DlgEvaluateMeshImp::onRepairDuplicatedPointsButtonClicked() try { Gui::Command::doCommand( Gui::Command::App, - "App.getDocument(\"%s\").getObject(\"%s\").removeDuplicatedPoints()", + R"(App.getDocument("%s").getObject("%s").removeDuplicatedPoints())", docName, objName); } @@ -1147,7 +1145,7 @@ void DlgEvaluateMeshImp::onRepairFoldsButtonClicked() try { Gui::Command::doCommand( Gui::Command::App, - "App.getDocument(\"%s\").getObject(\"%s\").removeFoldsOnSurface()", + R"(App.getDocument("%s").getObject("%s").removeFoldsOnSurface())", docName, objName); } @@ -1191,7 +1189,7 @@ void DlgEvaluateMeshImp::onRepairAllTogetherClicked() bool run = false; bool self = true; - int max_iter=10; + int max_iter = 10; const MeshKernel& rMesh = d->meshFeature->Mesh.getValue().getKernel(); try { do { @@ -1373,7 +1371,7 @@ bool DockEvaluateMeshImp::hasInstance() DockEvaluateMeshImp::DockEvaluateMeshImp(QWidget* parent, Qt::WindowFlags fl) : DlgEvaluateMeshImp(parent, fl) { - scrollArea = new QScrollArea(); + scrollArea = new QScrollArea(); // NOLINT scrollArea->setObjectName(QLatin1String("scrollArea")); scrollArea->setFrameShape(QFrame::NoFrame); scrollArea->setFrameShadow(QFrame::Plain); diff --git a/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.h b/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.h index 02b99d07fc..fb43bdf3f1 100644 --- a/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.h +++ b/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.h @@ -146,7 +146,7 @@ private: * The DockEvaluateMeshImp class creates a single instance and embeds it into a dock window. * \author Werner Mayer */ -class DockEvaluateMeshImp: public DlgEvaluateMeshImp +class DockEvaluateMeshImp: public DlgEvaluateMeshImp // NOLINT { Q_OBJECT diff --git a/src/Mod/Mesh/Gui/DlgRegularSolidImp.cpp b/src/Mod/Mesh/Gui/DlgRegularSolidImp.cpp index 3ffcabc003..a250b46b4f 100644 --- a/src/Mod/Mesh/Gui/DlgRegularSolidImp.cpp +++ b/src/Mod/Mesh/Gui/DlgRegularSolidImp.cpp @@ -46,8 +46,8 @@ using namespace MeshGui; // clang-format off DlgRegularSolidImp::DlgRegularSolidImp(QWidget* parent, Qt::WindowFlags fl) - : QDialog( parent, fl ) - , ui(new Ui_DlgRegularSolid) + : QDialog(parent, fl) + , ui(new Ui_DlgRegularSolid) { ui->setupUi(this); connect(ui->createSolidButton, &QPushButton::clicked, diff --git a/src/Mod/Mesh/Gui/DlgSmoothing.cpp b/src/Mod/Mesh/Gui/DlgSmoothing.cpp index ae3f4f8252..70422e8ba2 100644 --- a/src/Mod/Mesh/Gui/DlgSmoothing.cpp +++ b/src/Mod/Mesh/Gui/DlgSmoothing.cpp @@ -29,12 +29,12 @@ #include #include #include -#include #include +#include #include "DlgSmoothing.h" -#include "Selection.h" #include "ui_DlgSmoothing.h" +#include "Selection.h" using namespace MeshGui; @@ -47,7 +47,7 @@ DlgSmoothing::DlgSmoothing(QWidget* parent) { // clang-format off ui->setupUi(this); - bg = new QButtonGroup(this); + bg = new QButtonGroup(this); //NOLINT bg->addButton(ui->radioButtonTaubin, 0); bg->addButton(ui->radioButtonLaplace, 1); @@ -151,13 +151,13 @@ SmoothingDialog::~SmoothingDialog() = default; TaskSmoothing::TaskSmoothing() { - widget = new DlgSmoothing(); + widget = new DlgSmoothing(); // NOLINT Gui::TaskView::TaskBox* taskbox = new Gui::TaskView::TaskBox(QPixmap(), widget->windowTitle(), false, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); - selection = new Selection(); + selection = new Selection(); // NOLINT selection->setObjects( Gui::Selection().getSelectionEx(nullptr, Mesh::Feature::getClassTypeId())); Gui::Selection().clearSelection(); diff --git a/src/Mod/Mesh/Gui/DlgSmoothing.h b/src/Mod/Mesh/Gui/DlgSmoothing.h index a1051e997f..371173f60e 100644 --- a/src/Mod/Mesh/Gui/DlgSmoothing.h +++ b/src/Mod/Mesh/Gui/DlgSmoothing.h @@ -24,9 +24,9 @@ #ifndef MESHGUI_DLGSMOOTHING_H #define MESHGUI_DLGSMOOTHING_H +#include #include #include -#include #ifndef MESH_GLOBAL_H #include #endif diff --git a/src/Mod/Mesh/Gui/MeshEditor.cpp b/src/Mod/Mesh/Gui/MeshEditor.cpp index d91771439b..4393961d42 100644 --- a/src/Mod/Mesh/Gui/MeshEditor.cpp +++ b/src/Mod/Mesh/Gui/MeshEditor.cpp @@ -23,10 +23,10 @@ #include "PreCompiled.h" #ifndef _PreComp_ -#include -#include #include #include +#include +#include #include #include @@ -51,8 +51,8 @@ #include #include #include -#include #include +#include #include "MeshEditor.h" #include "SoFCMeshObject.h" @@ -65,9 +65,8 @@ namespace sp = std::placeholders; PROPERTY_SOURCE(MeshGui::ViewProviderFace, Gui::ViewProviderDocumentObject) ViewProviderFace::ViewProviderFace() - : mesh(nullptr) - , current_index(-1) { + // NOLINTBEGIN pcCoords = new SoCoordinate3(); pcCoords->ref(); pcCoords->point.setNum(0); @@ -75,6 +74,7 @@ ViewProviderFace::ViewProviderFace() pcFaces->ref(); pcMeshPick = new SoFCMeshPickNode(); pcMeshPick->ref(); + // NOLINTEND } ViewProviderFace::~ViewProviderFace() @@ -448,12 +448,9 @@ struct NofFacetsCompare MeshFillHole::MeshFillHole(MeshHoleFiller& hf, Gui::View3DInventor* parent) : QObject(parent) - , myMesh(nullptr) - , myNumPoints(0) - , myVertex1(0) - , myVertex2(0) , myHoleFiller(hf) { + // NOLINTBEGIN myBoundariesRoot = new SoSeparator; myBoundariesRoot->ref(); myBoundaryRoot = new SoSeparator; @@ -475,6 +472,7 @@ MeshFillHole::MeshFillHole(MeshHoleFiller& hf, Gui::View3DInventor* parent) myVertex = new SoCoordinate3(); myBridgeRoot->addChild(myVertex); myBridgeRoot->addChild(new SoPointSet); + // NOLINTEND } MeshFillHole::~MeshFillHole() @@ -699,7 +697,7 @@ void MeshFillHole::fileHoleCallback(void* ud, SoEventCallback* n) std::map::iterator it = self->myPolygons.find(node); if (it != self->myPolygons.end()) { // now check which vertex of the polygon is closest to the ray - Mesh::PointIndex vertex_index; + Mesh::PointIndex vertex_index {}; SbVec3f closestPoint; float minDist = self->findClosestPoint(rp.getLine(), it->second, vertex_index, closestPoint); @@ -736,7 +734,7 @@ void MeshFillHole::fileHoleCallback(void* ud, SoEventCallback* n) std::map::iterator it = self->myPolygons.find(node); if (it != self->myPolygons.end()) { // now check which vertex of the polygon is closest to the ray - Mesh::PointIndex vertex_index; + Mesh::PointIndex vertex_index {}; SbVec3f closestPoint; float minDist = self->findClosestPoint(rp.getLine(), it->second, diff --git a/src/Mod/Mesh/Gui/MeshEditor.h b/src/Mod/Mesh/Gui/MeshEditor.h index a7a6ee4c62..aa06a010e2 100644 --- a/src/Mod/Mesh/Gui/MeshEditor.h +++ b/src/Mod/Mesh/Gui/MeshEditor.h @@ -74,9 +74,9 @@ public: SoPickedPoint* getPickedPoint(const SbVec2s& pos, const Gui::View3DInventorViewer* viewer) const; - ViewProviderMesh* mesh; + ViewProviderMesh* mesh {nullptr}; std::vector index; - int current_index; + int current_index {-1}; SoCoordinate3* pcCoords; SoFaceSet* pcFaces; @@ -172,10 +172,10 @@ private: SoSeparator* myBridgeRoot; SoCoordinate3* myVertex; std::map myPolygons; - Mesh::Feature* myMesh; - int myNumPoints; - Mesh::PointIndex myVertex1; - Mesh::PointIndex myVertex2; + Mesh::Feature* myMesh {nullptr}; + int myNumPoints {0}; + Mesh::PointIndex myVertex1 {0}; + Mesh::PointIndex myVertex2 {0}; TBoundary myPolygon; MeshHoleFiller& myHoleFiller; Connection myConnection; diff --git a/src/Mod/Mesh/Gui/MeshSelection.cpp b/src/Mod/Mesh/Gui/MeshSelection.cpp index 7368e3fd77..ee54fc9eb6 100644 --- a/src/Mod/Mesh/Gui/MeshSelection.cpp +++ b/src/Mod/Mesh/Gui/MeshSelection.cpp @@ -22,9 +22,9 @@ #include "PreCompiled.h" #ifndef _PreComp_ -#include #include #include +#include #include #include @@ -44,10 +44,10 @@ #include #include #include -#include -#include -#include #include +#include +#include +#include #include "MeshSelection.h" #include "ViewProvider.h" @@ -491,7 +491,7 @@ void MeshSelection::selectGLCallback(void* ud, SoEventCallback* n) if (self->onlyVisibleTriangles) { const SbVec2s& sz = view->getSoRenderManager()->getViewportRegion().getWindowSize(); - short width, height; + short width {}, height {}; sz.getValue(width, height); std::vector pixelPoly = view->getPolygon(); SbBox2s rect; diff --git a/src/Mod/Mesh/Gui/MeshSelection.h b/src/Mod/Mesh/Gui/MeshSelection.h index a8703a4406..8ef2ad677a 100644 --- a/src/Mod/Mesh/Gui/MeshSelection.h +++ b/src/Mod/Mesh/Gui/MeshSelection.h @@ -23,8 +23,8 @@ #ifndef MESHGUI_MESHSELECTION_H #define MESHGUI_MESHSELECTION_H -#include #include +#include #include #include @@ -49,6 +49,11 @@ public: MeshSelection(); ~MeshSelection(); + MeshSelection(const MeshSelection&) = delete; + MeshSelection(MeshSelection&&) = delete; + MeshSelection& operator=(const MeshSelection&) = delete; + MeshSelection& operator=(MeshSelection&&) = delete; + void setEnabledViewerSelection(bool); void startSelection(); diff --git a/src/Mod/Mesh/Gui/PropertyEditorMesh.cpp b/src/Mod/Mesh/Gui/PropertyEditorMesh.cpp index 11dffcf3f1..9d0e4198c4 100644 --- a/src/Mod/Mesh/Gui/PropertyEditorMesh.cpp +++ b/src/Mod/Mesh/Gui/PropertyEditorMesh.cpp @@ -35,6 +35,7 @@ PROPERTYITEM_SOURCE(MeshGui::PropertyMeshKernelItem) PropertyMeshKernelItem::PropertyMeshKernelItem() { + // NOLINTBEGIN m_p = static_cast( Gui::PropertyEditor::PropertyIntegerItem::create()); m_p->setParent(this); @@ -50,6 +51,7 @@ PropertyMeshKernelItem::PropertyMeshKernelItem() m_f->setParent(this); m_f->setPropertyName(QLatin1String("Faces")); this->appendChild(m_f); + // NOLINTEND } void PropertyMeshKernelItem::initialize() diff --git a/src/Mod/Mesh/Gui/RemeshGmsh.cpp b/src/Mod/Mesh/Gui/RemeshGmsh.cpp index 7632035553..21144686e2 100644 --- a/src/Mod/Mesh/Gui/RemeshGmsh.cpp +++ b/src/Mod/Mesh/Gui/RemeshGmsh.cpp @@ -65,7 +65,7 @@ public: } public: - Ui_RemeshGmsh ui; + Ui_RemeshGmsh ui {}; QPointer label; QPointer syntax; QProcess gmsh; @@ -176,19 +176,25 @@ void GmshWidget::accept() return; } + // clang-format off QString inpFile; QString outFile; if (writeProject(inpFile, outFile)) { // ./gmsh - -bin -2 /tmp/mesh.geo -o /tmp/best.stl QString proc = d->ui.fileChooser->fileName(); QStringList args; - args << QLatin1String("-") << QLatin1String("-bin") << QLatin1String("-2") << inpFile - << QLatin1String("-o") << outFile; + args << QLatin1String("-") + << QLatin1String("-bin") + << QLatin1String("-2") + << inpFile + << QLatin1String("-o") + << outFile; d->gmsh.start(proc, args); d->time.start(); d->ui.labelTime->setText(tr("Time:")); } + // clang-format on } void GmshWidget::readyReadStandardError() diff --git a/src/Mod/Mesh/Gui/RemeshGmsh.h b/src/Mod/Mesh/Gui/RemeshGmsh.h index c00c7fc833..be1f9d8e17 100644 --- a/src/Mod/Mesh/Gui/RemeshGmsh.h +++ b/src/Mod/Mesh/Gui/RemeshGmsh.h @@ -23,9 +23,9 @@ #ifndef MESHGUI_REMESHGMSH_H #define MESHGUI_REMESHGMSH_H +#include #include #include -#include #include #include diff --git a/src/Mod/Mesh/Gui/RemoveComponents.cpp b/src/Mod/Mesh/Gui/RemoveComponents.cpp index 3857897640..685715e2f3 100644 --- a/src/Mod/Mesh/Gui/RemoveComponents.cpp +++ b/src/Mod/Mesh/Gui/RemoveComponents.cpp @@ -37,8 +37,8 @@ using namespace MeshGui; RemoveComponents::RemoveComponents(QWidget* parent, Qt::WindowFlags fl) : QWidget(parent, fl) + , ui(new Ui_RemoveComponents) { - ui = new Ui_RemoveComponents; ui->setupUi(this); setupConnections(); ui->spSelectComp->setRange(1, INT_MAX); @@ -198,7 +198,7 @@ void RemoveComponents::reject() RemoveComponentsDialog::RemoveComponentsDialog(QWidget* parent, Qt::WindowFlags fl) : QDialog(parent, fl) { - widget = new RemoveComponents(this); + widget = new RemoveComponents(this); // NOLINT this->setWindowTitle(widget->windowTitle()); QVBoxLayout* hboxLayout = new QVBoxLayout(this); @@ -243,7 +243,7 @@ void RemoveComponentsDialog::clicked(QAbstractButton* btn) TaskRemoveComponents::TaskRemoveComponents() { - widget = new RemoveComponents(); + widget = new RemoveComponents(); // NOLINT taskbox = new Gui::TaskView::TaskBox(QPixmap(), widget->windowTitle(), false, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); diff --git a/src/Mod/Mesh/Gui/RemoveComponents.h b/src/Mod/Mesh/Gui/RemoveComponents.h index f71c52ef31..58635b5bc4 100644 --- a/src/Mod/Mesh/Gui/RemoveComponents.h +++ b/src/Mod/Mesh/Gui/RemoveComponents.h @@ -24,11 +24,11 @@ #ifndef MESHGUI_REMOVECOMPONENTS_H #define MESHGUI_REMOVECOMPONENTS_H -#include "MeshSelection.h" +#include #include #include #include -#include +#include "MeshSelection.h" namespace MeshGui { diff --git a/src/Mod/Mesh/Gui/Segmentation.cpp b/src/Mod/Mesh/Gui/Segmentation.cpp index 434a294f53..081e09932a 100644 --- a/src/Mod/Mesh/Gui/Segmentation.cpp +++ b/src/Mod/Mesh/Gui/Segmentation.cpp @@ -41,9 +41,9 @@ using namespace MeshGui; Segmentation::Segmentation(Mesh::Feature* mesh, QWidget* parent, Qt::WindowFlags fl) : QWidget(parent, fl) + , ui(new Ui_Segmentation) , myMesh(mesh) { - ui = new Ui_Segmentation; ui->setupUi(this); ui->numPln->setRange(1, INT_MAX); ui->numPln->setValue(100); @@ -158,7 +158,7 @@ void Segmentation::changeEvent(QEvent* e) TaskSegmentation::TaskSegmentation(Mesh::Feature* mesh) { - widget = new Segmentation(mesh); + widget = new Segmentation(mesh); // NOLINT taskbox = new Gui::TaskView::TaskBox(QPixmap(), widget->windowTitle(), false, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); diff --git a/src/Mod/Mesh/Gui/Selection.h b/src/Mod/Mesh/Gui/Selection.h index 9df6f396a5..0e14d3f1db 100644 --- a/src/Mod/Mesh/Gui/Selection.h +++ b/src/Mod/Mesh/Gui/Selection.h @@ -23,8 +23,8 @@ #ifndef MESHGUI_SELECTION_H #define MESHGUI_SELECTION_H -#include #include +#include #include diff --git a/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp b/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp index f29e59f20f..5b8fd7ce23 100644 --- a/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp +++ b/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp @@ -564,14 +564,14 @@ void SoFCIndexedFaceSet::drawFaces(SoGLRenderAction* action) SoMaterialBindingElement::Binding matbind = SoMaterialBindingElement::get(state); int32_t binding = (int32_t)(matbind); - const SoCoordinateElement* coords; - const SbVec3f* normals; - const int32_t* cindices; - int numindices; - const int32_t* nindices; - const int32_t* tindices; - const int32_t* mindices; - SbBool normalCacheUsed; + const SoCoordinateElement* coords = nullptr; + const SbVec3f* normals = nullptr; + const int32_t* cindices = nullptr; + int numindices = 0; + const int32_t* nindices = nullptr; + const int32_t* tindices = nullptr; + const int32_t* mindices = nullptr; + SbBool normalCacheUsed {}; SoMaterialBundle mb(action); @@ -648,7 +648,7 @@ void SoFCIndexedFaceSet::drawCoords(const SoGLCoordinateElement* const vertexlis int ct = 0; const int32_t* viptr = vertexindices; - int32_t v1, v2, v3; + int32_t v1 {}, v2 {}, v3 {}; SbVec3f dummynormal(0, 0, 1); const SbVec3f* currnormal = &dummynormal; if (normals) { @@ -720,16 +720,16 @@ void SoFCIndexedFaceSet::invalidate() void SoFCIndexedFaceSet::generateGLArrays(SoGLRenderAction* action) { - const SoCoordinateElement* coords; - const SbVec3f* normals; - const int32_t* cindices; + const SoCoordinateElement* coords = nullptr; + const SbVec3f* normals = nullptr; + const int32_t* cindices = nullptr; const SbColor* pcolors = nullptr; const float* transp = nullptr; - int numindices, numcolors = 0, numtransp = 0; - const int32_t* nindices; - const int32_t* tindices; - const int32_t* mindices; - SbBool normalCacheUsed; + int numindices = 0, numcolors = 0, numtransp = 0; + const int32_t* nindices = nullptr; + const int32_t* tindices = nullptr; + const int32_t* mindices = nullptr; + SbBool normalCacheUsed {}; SbBool sendNormals = true; @@ -1062,7 +1062,7 @@ void SoFCIndexedFaceSet::renderSelectionGeometry(const SbVec3f* coords3d) const int32_t* cindices = this->coordIndex.getValues(0); int fcnt = 0; - int32_t v1, v2, v3; + int32_t v1 {}, v2 {}, v3 {}; for (int index = 0; index < numfaces; index++, cindices++) { glLoadName(fcnt); glBegin(GL_TRIANGLES); @@ -1116,10 +1116,10 @@ void SoFCIndexedFaceSet::renderVisibleFaces(const SbVec3f* coords3d) uint32_t numfaces = this->coordIndex.getNum() / 4; const int32_t* cindices = this->coordIndex.getValues(0); - int32_t v1, v2, v3; + int32_t v1 {}, v2 {}, v3 {}; for (uint32_t index = 0; index < numfaces; index++, cindices++) { glBegin(GL_TRIANGLES); - float t; + float t {}; SbColor c; c.setPackedValue(index << 8, t); glColor3f(c[0], c[1], c[2]); diff --git a/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.h b/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.h index 37e762e690..e05c3c9654 100644 --- a/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.h +++ b/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.h @@ -42,6 +42,7 @@ using GLfloat = float; namespace MeshGui { +// NOLINTBEGIN class MeshRenderer { public: @@ -142,6 +143,7 @@ private: MeshRenderer render; GLuint* selectBuf {nullptr}; }; +// NOLINTEND } // namespace MeshGui diff --git a/src/Mod/Mesh/Gui/SoFCMeshObject.cpp b/src/Mod/Mesh/Gui/SoFCMeshObject.cpp index f56cf1dd1e..426d89292e 100644 --- a/src/Mod/Mesh/Gui/SoFCMeshObject.cpp +++ b/src/Mod/Mesh/Gui/SoFCMeshObject.cpp @@ -38,9 +38,9 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -120,7 +120,7 @@ protected: return *gptr(); } - int numPutback; + int numPutback {}; numPutback = gptr() - eback(); if (numPutback > pbSize) { numPutback = pbSize; @@ -130,7 +130,7 @@ protected: int num = 0; for (int i = 0; i < bufSize; i++) { - char c; + char c {}; SbBool ok = inp->get(c); if (ok) { num++; @@ -152,7 +152,7 @@ protected: private: static const int pbSize = 4; static const int bufSize = 1024; - char buffer[bufSize + pbSize]; + char buffer[bufSize + pbSize] {}; SoInput* inp; }; @@ -166,6 +166,10 @@ public: this->rdbuf(&buf); } ~SoInputStream() override = default; + SoInputStream(const SoInputStream&) = delete; + SoInputStream(SoInputStream&&) = delete; + SoInputStream& operator=(const SoInputStream&) = delete; + SoInputStream& operator=(SoInputStream&&) = delete; private: SoInputStreambuf buf; @@ -203,7 +207,7 @@ SbBool SoSFMeshObject::readValue(SoInput* in) return true; } - int32_t countPt; + int32_t countPt {}; in->read(countPt); std::vector verts(countPt); in->readBinaryArray(&(verts[0]), countPt); @@ -221,7 +225,7 @@ SbBool SoSFMeshObject::readValue(SoInput* in) rPoints.push_back(p); } - int32_t countFt; + int32_t countFt {}; in->read(countFt); std::vector faces(countFt); in->readBinaryArray(&(faces[0]), countFt); @@ -396,7 +400,7 @@ void SoFCMeshPickNode::pick(SoPickAction* action) const SbVec3f& dir = line.getDirection(); Base::Vector3f pt(pos[0], pos[1], pos[2]); Base::Vector3f dr(dir[0], dir[1], dir[2]); - Mesh::FacetIndex index; + Mesh::FacetIndex index {}; if (alg.NearestFacetOnRay(pt, dr, *meshGrid, pt, index)) { SoPickedPoint* pp = raypick->addIntersection(SbVec3f(pt.x, pt.y, pt.z)); if (pp) { @@ -439,11 +443,11 @@ void SoFCMeshGridNode::GLRender(SoGLRenderAction* /*action*/) const SbVec3f& min = minGrid.getValue(); const SbVec3f& max = maxGrid.getValue(); const SbVec3s& len = lenGrid.getValue(); - short u, v, w; + short u {}, v {}, w {}; len.getValue(u, v, w); - float minX, minY, minZ; + float minX {}, minY {}, minZ {}; min.getValue(minX, minY, minZ); - float maxX, maxY, maxZ; + float maxX {}, maxY {}, maxZ {}; max.getValue(maxX, maxY, maxZ); float dx = (maxX - minX) / (float)u; float dy = (maxY - minY) / (float)v; @@ -1688,7 +1692,7 @@ void SoFCMeshObjectBoundary::drawLines(const Mesh::MeshObject* mesh) const const MeshCore::MeshFacetArray& rFacets = mesh->getKernel().GetFacets(); // When rendering open edges use the given line width * 3 - GLfloat lineWidth; + GLfloat lineWidth {}; glGetFloatv(GL_LINE_WIDTH, &lineWidth); glLineWidth(3.0f * lineWidth); diff --git a/src/Mod/Mesh/Gui/SoFCMeshObject.h b/src/Mod/Mesh/Gui/SoFCMeshObject.h index 8dd008c233..5ca888c3cd 100644 --- a/src/Mod/Mesh/Gui/SoFCMeshObject.h +++ b/src/Mod/Mesh/Gui/SoFCMeshObject.h @@ -44,6 +44,7 @@ class MeshFacetGrid; namespace MeshGui { +// NOLINTBEGIN(cppcoreguidelines-special-member-functions,cppcoreguidelines-virtual-class-destructor) class MeshGuiExport SoSFMeshObject: public SoSField { using inherited = SoSField; @@ -77,7 +78,9 @@ public: protected: ~SoFCMeshObjectElement() override; - const Mesh::MeshObject* mesh; + +private: + const Mesh::MeshObject* mesh {}; }; // ------------------------------------------------------- @@ -93,7 +96,7 @@ public: SoFCMeshPickNode(); void notify(SoNotList*) override; - SoSFMeshObject mesh; + SoSFMeshObject mesh; // NOLINT void rayPick(SoRayPickAction* action) override; void pick(SoPickAction* action) override; @@ -181,7 +184,7 @@ public: static void initClass(); SoFCMeshObjectShape(); - unsigned int renderTriangleLimit; + unsigned int renderTriangleLimit; // NOLINT protected: void doAction(SoAction* action) override; @@ -299,6 +302,7 @@ protected: private: void drawLines(const Mesh::MeshObject*) const; }; +// NOLINTEND(cppcoreguidelines-special-member-functions,cppcoreguidelines-virtual-class-destructor) } // namespace MeshGui diff --git a/src/Mod/Mesh/Gui/SoPolygon.h b/src/Mod/Mesh/Gui/SoPolygon.h index 0801d99ae2..95e9352c3a 100644 --- a/src/Mod/Mesh/Gui/SoPolygon.h +++ b/src/Mod/Mesh/Gui/SoPolygon.h @@ -35,6 +35,7 @@ namespace MeshGui { +// NOLINTBEGIN class MeshGuiExport SoPolygon: public SoShape { using inherited = SoShape; @@ -60,6 +61,7 @@ protected: private: void drawPolygon(const SbVec3f*, int32_t) const; }; +// NOLINTEND } // namespace MeshGui diff --git a/src/Mod/Mesh/Gui/ViewProvider.cpp b/src/Mod/Mesh/Gui/ViewProvider.cpp index a2dbc6c431..e1759373f3 100644 --- a/src/Mod/Mesh/Gui/ViewProvider.cpp +++ b/src/Mod/Mesh/Gui/ViewProvider.cpp @@ -22,32 +22,32 @@ #include "PreCompiled.h" #ifndef _PreComp_ +#include #include #include -#include #include #include #include #include -#include #include #include #include #include #include #include +#include #include #include -#include #include #include #include #include #include -#include #include +#include #include +#include #endif #include @@ -234,6 +234,7 @@ PROPERTY_SOURCE(MeshGui::ViewProviderMesh, Gui::ViewProviderGeometryObject) ViewProviderMesh::ViewProviderMesh() : highlightMode {HighlighMode::None} { + // NOLINTBEGIN static const char* osgroup = "Object Style"; ADD_PROPERTY_TYPE(LineTransparency, (0), osgroup, App::Prop_None, "Set line transparency."); @@ -334,6 +335,7 @@ ViewProviderMesh::ViewProviderMesh() } Coloring.setStatus(App::Property::Hidden, true); + // NOLINTEND } ViewProviderMesh::~ViewProviderMesh() @@ -850,7 +852,7 @@ bool ViewProviderMesh::createToolMesh(const std::vector& rclPoly, const Base::Vector3f& rcNormal, std::vector& aFaces) { - float fX, fY, fZ; + float fX {}, fY {}, fZ {}; SbVec3f pt1, pt2, pt3, pt4; MeshGeomFacet face; std::vector top, bottom, polygon; @@ -944,10 +946,10 @@ class MeshSplit { public: MeshSplit(ViewProviderMesh* mesh, - const std::vector& poly, + std::vector poly, const Gui::ViewVolumeProjection& proj) : mesh(mesh) - , poly(poly) + , poly(std::move(poly)) , proj(proj) {} void cutMesh() @@ -1001,7 +1003,7 @@ void ViewProviderMesh::clipMeshCallback(void* ud, SoEventCallback* n) view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), clipMeshCallback, ud); n->setHandled(); - Gui::SelectionRole role; + Gui::SelectionRole role {}; std::vector clPoly = view->getGLPolygon(&role); if (clPoly.size() < 3) { return; @@ -1071,7 +1073,7 @@ void ViewProviderMesh::trimMeshCallback(void* ud, SoEventCallback* n) view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), trimMeshCallback, ud); n->setHandled(); - Gui::SelectionRole role; + Gui::SelectionRole role {}; std::vector clPoly = view->getGLPolygon(&role); if (clPoly.size() < 3) { return; @@ -1141,7 +1143,7 @@ void ViewProviderMesh::partMeshCallback(void* ud, SoEventCallback* cb) view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), partMeshCallback, ud); cb->setHandled(); - Gui::SelectionRole role; + Gui::SelectionRole role {}; std::vector clPoly = view->getGLPolygon(&role); if (clPoly.size() < 3) { return; @@ -1214,7 +1216,7 @@ void ViewProviderMesh::segmMeshCallback(void* ud, SoEventCallback* cb) view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), segmMeshCallback, ud); cb->setHandled(); - Gui::SelectionRole role; + Gui::SelectionRole role {}; std::vector clPoly = view->getGLPolygon(&role); if (clPoly.size() < 3) { return; @@ -1291,7 +1293,7 @@ void ViewProviderMesh::selectGLCallback(void* ud, SoEventCallback* n) const SoEvent* ev = n->getEvent(); SbVec2f pos = clPoly[0]; - float pX, pY; + float pX {}, pY {}; pos.getValue(pX, pY); const SbVec2s& sz = view->getSoRenderManager()->getViewportRegion().getViewportSizePixels(); float fRatio = view->getSoRenderManager()->getViewportRegion().getViewportAspectRatio(); @@ -1423,7 +1425,7 @@ void ViewProviderMesh::boxZoom(const SbBox2s& box, const SbViewportRegion& vp, S { SbViewVolume vv = cam->getViewVolume(vp.getViewportAspectRatio()); - short sizeX, sizeY; + short sizeX {}, sizeY {}; box.getSize(sizeX, sizeY); SbVec2s size = vp.getViewportSizePixels(); @@ -1434,7 +1436,7 @@ void ViewProviderMesh::boxZoom(const SbBox2s& box, const SbViewportRegion& vp, S } // Get the new center in normalized pixel coordinates - short xmin, xmax, ymin, ymax; + short xmin {}, xmax {}, ymin {}, ymax {}; box.getBounds(xmin, ymin, xmax, ymax); const SbVec2f center((float)((xmin + xmax) / 2) / (float)std::max((int)(size[0] - 1), 1), (float)(size[1] - (ymin + ymax) / 2) @@ -1525,7 +1527,7 @@ std::vector ViewProviderMesh::getVisibleFacets(const SbViewpor mat->diffuseColor.setNum(count); SbColor* diffcol = mat->diffuseColor.startEditing(); for (uint32_t i = 0; i < count; i++) { - float t; + float t {}; diffcol[i].setPackedValue(i << 8, t); } @@ -2464,8 +2466,10 @@ PROPERTY_SOURCE(MeshGui::ViewProviderIndexedFaceSet, MeshGui::ViewProviderMesh) ViewProviderIndexedFaceSet::ViewProviderIndexedFaceSet() { + // NOLINTBEGIN pcMeshCoord = nullptr; pcMeshFaces = nullptr; + // NOLINTEND } ViewProviderIndexedFaceSet::~ViewProviderIndexedFaceSet() = default; @@ -2558,8 +2562,10 @@ PROPERTY_SOURCE(MeshGui::ViewProviderMeshObject, MeshGui::ViewProviderMesh) ViewProviderMeshObject::ViewProviderMeshObject() { + // NOLINTBEGIN pcMeshNode = nullptr; pcMeshShape = nullptr; + // NOLINTEND } ViewProviderMeshObject::~ViewProviderMeshObject() = default; diff --git a/src/Mod/Mesh/Gui/ViewProvider.h b/src/Mod/Mesh/Gui/ViewProvider.h index 1da1023638..30bda1c157 100644 --- a/src/Mod/Mesh/Gui/ViewProvider.h +++ b/src/Mod/Mesh/Gui/ViewProvider.h @@ -126,7 +126,8 @@ public: ViewProviderMesh(); ~ViewProviderMesh() override; - // Display properties + // NOLINTBEGIN + // Display properties App::PropertyPercent LineTransparency; App::PropertyFloatConstraint LineWidth; App::PropertyFloatConstraint PointSize; @@ -135,6 +136,7 @@ public: App::PropertyBool Coloring; App::PropertyEnumeration Lighting; App::PropertyColor LineColor; + // NOLINTEND void attach(App::DocumentObject*) override; void updateData(const App::Property*) override; diff --git a/src/Mod/Mesh/Gui/ViewProviderCurvature.cpp b/src/Mod/Mesh/Gui/ViewProviderCurvature.cpp index 985cd7ae87..6e1f35104d 100644 --- a/src/Mod/Mesh/Gui/ViewProviderCurvature.cpp +++ b/src/Mod/Mesh/Gui/ViewProviderCurvature.cpp @@ -22,16 +22,16 @@ #include "PreCompiled.h" #ifndef _PreComp_ -#include -#include #include #include #include #include +#include +#include #include -#include #include +#include #include #include #include @@ -73,6 +73,7 @@ PROPERTY_SOURCE(MeshGui::ViewProviderMeshCurvature, Gui::ViewProviderDocumentObj ViewProviderMeshCurvature::ViewProviderMeshCurvature() { + // NOLINTBEGIN pcColorRoot = new SoSeparator(); pcColorRoot->ref(); pcColorMat = new SoMaterial; @@ -86,9 +87,10 @@ ViewProviderMeshCurvature::ViewProviderMeshCurvature() pcColorBar->setRange(-0.5f, 0.5f, 3); pcLinkRoot = new SoGroup; pcLinkRoot->ref(); + // NOLINTEND App::Material mat; - const SbColor* cols; + const SbColor* cols {}; if (pcColorMat->ambientColor.getNum() == 1) { cols = pcColorMat->ambientColor.getValues(0); mat.ambientColor.setPackedValue(cols[0].getPackedValue()); diff --git a/src/Mod/Mesh/Gui/ViewProviderCurvature.h b/src/Mod/Mesh/Gui/ViewProviderCurvature.h index b1199d8949..483e8cf5dc 100644 --- a/src/Mod/Mesh/Gui/ViewProviderCurvature.h +++ b/src/Mod/Mesh/Gui/ViewProviderCurvature.h @@ -72,7 +72,9 @@ public: ViewProviderMeshCurvature(); ~ViewProviderMeshCurvature() override; + // NOLINTBEGIN App::PropertyMaterial TextureMaterial; + // NOLINTEND /// Extracts the mesh data from the feature \a pcFeature and creates an Inventor node \a SoNode /// with these data. @@ -115,7 +117,7 @@ private: void slotChangedObject(const App::DocumentObject& Obj, const App::Property& Prop) override; -protected: +private: SoMaterial* pcColorMat; SoGroup* pcLinkRoot; Gui::SoFCColorBar* pcColorBar; diff --git a/src/Mod/Mesh/Gui/ViewProviderDefects.cpp b/src/Mod/Mesh/Gui/ViewProviderDefects.cpp index 992ce876bd..41f89a5381 100644 --- a/src/Mod/Mesh/Gui/ViewProviderDefects.cpp +++ b/src/Mod/Mesh/Gui/ViewProviderDefects.cpp @@ -35,9 +35,9 @@ #include #include #include +#include #include #include -#include #include "ViewProviderDefects.h" @@ -95,8 +95,10 @@ void ViewProviderMeshDefects::onChanged(const App::Property* prop) ViewProviderMeshOrientation::ViewProviderMeshOrientation() { + // NOLINTBEGIN pcFaces = new SoFaceSet; pcFaces->ref(); + // NOLINTEND } ViewProviderMeshOrientation::~ViewProviderMeshOrientation() @@ -171,8 +173,10 @@ void ViewProviderMeshOrientation::showDefects(const std::vectorref(); + // NOLINTEND } ViewProviderMeshNonManifolds::~ViewProviderMeshNonManifolds() @@ -242,8 +246,10 @@ void ViewProviderMeshNonManifolds::showDefects(const std::vectorref(); + // NOLINTEND } ViewProviderMeshNonManifoldPoints::~ViewProviderMeshNonManifoldPoints() @@ -303,8 +309,10 @@ void ViewProviderMeshNonManifoldPoints::showDefects(const std::vectorref(); + // NOLINTEND } ViewProviderMeshDuplicatedFaces::~ViewProviderMeshDuplicatedFaces() @@ -378,8 +386,10 @@ void ViewProviderMeshDuplicatedFaces::showDefects(const std::vectorref(); + // NOLINTEND } ViewProviderMeshDuplicatedPoints::~ViewProviderMeshDuplicatedPoints() @@ -439,8 +449,10 @@ void ViewProviderMeshDuplicatedPoints::showDefects(const std::vectorref(); + // NOLINTEND } ViewProviderMeshDegenerations::~ViewProviderMeshDegenerations() @@ -548,8 +560,10 @@ void ViewProviderMeshDegenerations::showDefects(const std::vectorref(); + // NOLINTEND } ViewProviderMeshIndices::~ViewProviderMeshIndices() @@ -625,8 +639,10 @@ void ViewProviderMeshIndices::showDefects(const std::vector& ViewProviderMeshSelfIntersections::ViewProviderMeshSelfIntersections() { + // NOLINTBEGIN pcLines = new SoLineSet; pcLines->ref(); + // NOLINTEND } ViewProviderMeshSelfIntersections::~ViewProviderMeshSelfIntersections() @@ -705,8 +721,10 @@ void ViewProviderMeshSelfIntersections::showDefects(const std::vectorref(); + // NOLINTEND } ViewProviderMeshFolds::~ViewProviderMeshFolds() diff --git a/src/Mod/Mesh/Gui/ViewProviderDefects.h b/src/Mod/Mesh/Gui/ViewProviderDefects.h index c94daf67f5..8a06a0a5e5 100644 --- a/src/Mod/Mesh/Gui/ViewProviderDefects.h +++ b/src/Mod/Mesh/Gui/ViewProviderDefects.h @@ -46,8 +46,10 @@ public: ViewProviderMeshDefects(); ~ViewProviderMeshDefects() override; + // NOLINTBEGIN // Display properties App::PropertyFloat LineWidth; + // NOLINTEND // Build up the initial Inventor node void attach(App::DocumentObject* pcFeature) override = 0; @@ -58,8 +60,11 @@ protected: /// get called by the container whenever a property has been changed void onChanged(const App::Property* prop) override; +protected: + // NOLINTBEGIN SoCoordinate3* pcCoords; SoDrawStyle* pcDrawStyle; + // NOLINTEND }; /** The ViewProviderMeshOrientation class displays wrong oriented facets (i.e. flipped normals) in @@ -77,7 +82,7 @@ public: void attach(App::DocumentObject* pcFeature) override; void showDefects(const std::vector&) override; -protected: +private: SoFaceSet* pcFaces; }; @@ -95,7 +100,7 @@ public: void attach(App::DocumentObject* pcFeature) override; void showDefects(const std::vector&) override; -protected: +private: SoLineSet* pcLines; }; @@ -113,7 +118,7 @@ public: void attach(App::DocumentObject* pcFeature) override; void showDefects(const std::vector&) override; -protected: +private: SoPointSet* pcPoints; }; @@ -131,7 +136,7 @@ public: void attach(App::DocumentObject* pcFeature) override; void showDefects(const std::vector&) override; -protected: +private: SoFaceSet* pcFaces; }; @@ -150,7 +155,7 @@ public: void attach(App::DocumentObject* pcFeature) override; void showDefects(const std::vector&) override; -protected: +private: SoLineSet* pcLines; }; @@ -165,7 +170,7 @@ public: void attach(App::DocumentObject* pcFeature) override; void showDefects(const std::vector&) override; -protected: +private: SoPointSet* pcPoints; }; @@ -180,7 +185,7 @@ public: void attach(App::DocumentObject* pcFeature) override; void showDefects(const std::vector&) override; -protected: +private: SoFaceSet* pcFaces; }; @@ -198,7 +203,7 @@ public: void attach(App::DocumentObject* pcFeature) override; void showDefects(const std::vector&) override; -protected: +private: SoLineSet* pcLines; }; @@ -213,7 +218,7 @@ public: void attach(App::DocumentObject* pcFeature) override; void showDefects(const std::vector&) override; -protected: +private: SoFaceSet* pcFaces; }; diff --git a/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.cpp b/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.cpp index 53e62186e5..7ddb233844 100644 --- a/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.cpp +++ b/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.cpp @@ -35,13 +35,13 @@ #include #include #include +#include #include #include -#include +#include "ViewProviderMeshFaceSet.h" #include "SoFCIndexedFaceSet.h" #include "SoFCMeshObject.h" -#include "ViewProviderMeshFaceSet.h" using namespace MeshGui; @@ -50,6 +50,7 @@ PROPERTY_SOURCE(MeshGui::ViewProviderMeshFaceSet, MeshGui::ViewProviderMesh) ViewProviderMeshFaceSet::ViewProviderMeshFaceSet() { + // NOLINTBEGIN directRendering = false; triangleCount = 2500000; @@ -67,6 +68,7 @@ ViewProviderMeshFaceSet::ViewProviderMeshFaceSet() SoFCMaterialEngine* engine = new SoFCMaterialEngine(); engine->diffuseColor.connectFrom(&pcShapeMaterial->diffuseColor); pcMeshFaces->updateGLArray.connectFrom(&engine->trigger); + // NOLINTEND } ViewProviderMeshFaceSet::~ViewProviderMeshFaceSet() diff --git a/src/Mod/Mesh/Gui/ViewProviderMeshPyImp.cpp b/src/Mod/Mesh/Gui/ViewProviderMeshPyImp.cpp index 3e5d4c9344..44f5efc025 100644 --- a/src/Mod/Mesh/Gui/ViewProviderMeshPyImp.cpp +++ b/src/Mod/Mesh/Gui/ViewProviderMeshPyImp.cpp @@ -25,12 +25,10 @@ #include #endif -// clang-format off #include "ViewProvider.h" // inclusion of the generated files (generated out of ViewProviderMeshPy.xml) #include "ViewProviderMeshPy.h" #include "ViewProviderMeshPy.cpp" -// clang-format on using namespace MeshGui; @@ -46,7 +44,7 @@ std::string ViewProviderMeshPy::representation() const PyObject* ViewProviderMeshPy::setSelection(PyObject* args) { - PyObject* obj; + PyObject* obj {}; if (!PyArg_ParseTuple(args, "O", &obj)) { return nullptr; } @@ -67,7 +65,7 @@ PyObject* ViewProviderMeshPy::setSelection(PyObject* args) PyObject* ViewProviderMeshPy::addSelection(PyObject* args) { - PyObject* obj; + PyObject* obj {}; if (!PyArg_ParseTuple(args, "O", &obj)) { return nullptr; } @@ -88,7 +86,7 @@ PyObject* ViewProviderMeshPy::addSelection(PyObject* args) PyObject* ViewProviderMeshPy::removeSelection(PyObject* args) { - PyObject* obj; + PyObject* obj {}; if (!PyArg_ParseTuple(args, "O", &obj)) { return nullptr; } @@ -131,7 +129,7 @@ PyObject* ViewProviderMeshPy::clearSelection(PyObject* args) PyObject* ViewProviderMeshPy::highlightSegments(PyObject* args) { - PyObject* list; + PyObject* list {}; if (!PyArg_ParseTuple(args, "O", &list)) { return nullptr; } diff --git a/src/Mod/Mesh/Gui/ViewProviderTransform.cpp b/src/Mod/Mesh/Gui/ViewProviderTransform.cpp index 7c8e21b035..a451c2a26d 100644 --- a/src/Mod/Mesh/Gui/ViewProviderTransform.cpp +++ b/src/Mod/Mesh/Gui/ViewProviderTransform.cpp @@ -42,8 +42,10 @@ PROPERTY_SOURCE(MeshGui::ViewProviderMeshTransform, MeshGui::ViewProviderMesh) ViewProviderMeshTransform::ViewProviderMeshTransform() { + // NOLINTBEGIN pcTransformerDragger = new SoTransformerManip(); pcTransformerDragger->ref(); + // NOLINTEND } ViewProviderMeshTransform::~ViewProviderMeshTransform() diff --git a/src/Mod/Mesh/Gui/ViewProviderTransform.h b/src/Mod/Mesh/Gui/ViewProviderTransform.h index 29032671bc..746fdcc716 100644 --- a/src/Mod/Mesh/Gui/ViewProviderTransform.h +++ b/src/Mod/Mesh/Gui/ViewProviderTransform.h @@ -70,7 +70,7 @@ public: /// Update the Mesh representation void updateData(const App::Property*) override; -protected: +private: SoTransformerManip* pcTransformerDragger; }; diff --git a/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.cpp b/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.cpp index dd37366bff..99025b5df0 100644 --- a/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.cpp +++ b/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.cpp @@ -54,10 +54,12 @@ PROPERTY_SOURCE(MeshGui::ViewProviderMeshTransformDemolding, MeshGui::ViewProvid ViewProviderMeshTransformDemolding::ViewProviderMeshTransformDemolding() { + // NOLINTBEGIN pcTrackballDragger = new SoTrackballDragger; pcTrackballDragger->ref(); pcTransformDrag = nullptr; pcColorMat = nullptr; + // NOLINTEND } ViewProviderMeshTransformDemolding::~ViewProviderMeshTransformDemolding() diff --git a/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.h b/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.h index b2f47ee312..f8c7dac8c0 100644 --- a/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.h +++ b/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.h @@ -82,6 +82,7 @@ protected: static void sDragEndCallback(void*, SoDragger*); void DragEndCallback(); +private: SoTrackballDragger* pcTrackballDragger; SoTransform* pcTransformDrag; SoMaterial* pcColorMat; diff --git a/src/Mod/Mesh/Gui/Workbench.cpp b/src/Mod/Mesh/Gui/Workbench.cpp index 06fd6cf689..b98251efba 100644 --- a/src/Mod/Mesh/Gui/Workbench.cpp +++ b/src/Mod/Mesh/Gui/Workbench.cpp @@ -63,6 +63,7 @@ public: MeshInfoWatcher() : TaskWatcher(nullptr) { + // NOLINTBEGIN labelPoints = new QLabel(); labelPoints->setText(tr("Number of points:")); @@ -80,6 +81,7 @@ public: numMin = new QLabel(); numMax = new QLabel(); + // NOLINTEND QGroupBox* box = new QGroupBox(); box->setTitle(tr("Mesh info box"));