From 7eb30ca5c73f25afaba97c0a20ed14832235bdfd Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 29 Aug 2022 18:36:52 +0200 Subject: [PATCH] MeshPart: modernize C++: replace 'typedef' with 'using' --- src/Mod/MeshPart/App/CurveProjector.cpp | 8 ++++---- src/Mod/MeshPart/App/CurveProjector.h | 2 +- src/Mod/MeshPart/App/MeshFlattening.h | 8 ++++---- src/Mod/MeshPart/App/MeshFlatteningLscmRelax.cpp | 4 ++-- src/Mod/MeshPart/App/MeshFlatteningLscmRelax.h | 14 +++++++------- src/Mod/MeshPart/App/MeshFlatteningNurbs.h | 8 ++++---- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/Mod/MeshPart/App/CurveProjector.cpp b/src/Mod/MeshPart/App/CurveProjector.cpp index c295d92ced..85a9e5366f 100644 --- a/src/Mod/MeshPart/App/CurveProjector.cpp +++ b/src/Mod/MeshPart/App/CurveProjector.cpp @@ -932,9 +932,9 @@ void MeshProjection::projectParallelToMesh (const TopoDS_Shape &aShape, const Ba std::vector points; discretize(aEdge, points, 5); - typedef std::pair HitPoint; + using HitPoint = std::pair; std::vector hitPoints; - typedef std::pair HitPoints; + using HitPoints = std::pair; std::vector hitPointPairs; for (auto it : points) { Base::Vector3f result; @@ -977,9 +977,9 @@ void MeshProjection::projectParallelToMesh (const std::vector &aEdges, for (const auto& it : aEdges) { std::vector points = it.points; - typedef std::pair HitPoint; + using HitPoint = std::pair; std::vector hitPoints; - typedef std::pair HitPoints; + using HitPoints = std::pair; std::vector hitPointPairs; for (auto it : points) { Base::Vector3f result; diff --git a/src/Mod/MeshPart/App/CurveProjector.h b/src/Mod/MeshPart/App/CurveProjector.h index d460bd904a..886b34b33e 100644 --- a/src/Mod/MeshPart/App/CurveProjector.h +++ b/src/Mod/MeshPart/App/CurveProjector.h @@ -69,7 +69,7 @@ public: } }; - typedef std::map,TopoDSLess > result_type; + using result_type = std::map,TopoDSLess >; result_type &result() {return mvEdgeSplitPoints;} diff --git a/src/Mod/MeshPart/App/MeshFlattening.h b/src/Mod/MeshPart/App/MeshFlattening.h index ebc24b0e14..dbbc331f12 100644 --- a/src/Mod/MeshPart/App/MeshFlattening.h +++ b/src/Mod/MeshPart/App/MeshFlattening.h @@ -42,8 +42,8 @@ #include -typedef Eigen::Vector3d Vector3; -typedef Eigen::Vector2d Vector2; +using Vector3 = Eigen::Vector3d; +using Vector2 = Eigen::Vector2d; template using ColMat = Eigen::Matrix; @@ -52,8 +52,8 @@ template using RowMat = Eigen::Matrix; -typedef Eigen::Triplet trip; -typedef Eigen::SparseMatrix spMat; +using trip = Eigen::Triplet; +using spMat = Eigen::SparseMatrix; std::vector> getBoundaries(ColMat vertices, ColMat tris); diff --git a/src/Mod/MeshPart/App/MeshFlatteningLscmRelax.cpp b/src/Mod/MeshPart/App/MeshFlatteningLscmRelax.cpp index b7240c3edd..ec627977dd 100644 --- a/src/Mod/MeshPart/App/MeshFlatteningLscmRelax.cpp +++ b/src/Mod/MeshPart/App/MeshFlatteningLscmRelax.cpp @@ -47,8 +47,8 @@ namespace lscmrelax { -typedef Eigen::Triplet trip; -typedef Eigen::SparseMatrix spMat; +using trip = Eigen::Triplet; +using spMat = Eigen::SparseMatrix; diff --git a/src/Mod/MeshPart/App/MeshFlatteningLscmRelax.h b/src/Mod/MeshPart/App/MeshFlatteningLscmRelax.h index 26ab4faee4..f277886141 100644 --- a/src/Mod/MeshPart/App/MeshFlatteningLscmRelax.h +++ b/src/Mod/MeshPart/App/MeshFlatteningLscmRelax.h @@ -44,7 +44,7 @@ #include #include -typedef Eigen::SparseMatrix spMat; +using spMat = Eigen::SparseMatrix; namespace lscmrelax { @@ -57,18 +57,18 @@ class NullSpaceProjector: public Eigen::IdentityPreconditioner template inline Rhs solve(Rhs& b) const { - return b - this->null_space_1 * (this->null_space_2 * b); + return b - this->null_space_1 * (this->null_space_2 * b); } void setNullSpace(Eigen::MatrixXd null_space) { - // normalize + orthogonalize the nullspace - this->null_space_1 = null_space * ((null_space.transpose() * null_space).inverse()); - this->null_space_2 = null_space.transpose(); + // normalize + orthogonalize the nullspace + this->null_space_1 = null_space * ((null_space.transpose() * null_space).inverse()); + this->null_space_2 = null_space.transpose(); } }; -typedef Eigen::Vector3d Vector3; -typedef Eigen::Vector2d Vector2; +using Vector3 = Eigen::Vector3d; +using Vector2 = Eigen::Vector2d; class LscmRelax{ private: diff --git a/src/Mod/MeshPart/App/MeshFlatteningNurbs.h b/src/Mod/MeshPart/App/MeshFlatteningNurbs.h index 2b5356f2f2..746dba3952 100644 --- a/src/Mod/MeshPart/App/MeshFlatteningNurbs.h +++ b/src/Mod/MeshPart/App/MeshFlatteningNurbs.h @@ -32,13 +32,13 @@ namespace nurbs{ -typedef Eigen::Triplet trip; -typedef Eigen::SparseMatrix spMat; +using trip = Eigen::Triplet; +using spMat = Eigen::SparseMatrix; struct NurbsBase2D { // - NurbsBase2D(){;}; + NurbsBase2D(){} NurbsBase2D(Eigen::VectorXd u_knots, Eigen::VectorXd v_knots, Eigen::VectorXd weights, int degree_u=3, int degree_v=3); @@ -83,7 +83,7 @@ struct NurbsBase2D struct NurbsBase1D { - NurbsBase1D(){;}; + NurbsBase1D(){} NurbsBase1D(Eigen::VectorXd u_knots, Eigen::VectorXd weights, int degree_u=3); int degree_u; Eigen::VectorXd u_knots;