From e6b02268d322a8ad0665dfdfa4ba82802c314faf Mon Sep 17 00:00:00 2001 From: Daniel Zint Date: Thu, 12 Oct 2023 11:35:28 -0400 Subject: [PATCH] Rename `EdgeSwap` to `EdgeSwapValence`. --- .../internal/IsotropicRemeshing.cpp | 6 +++--- src/wmtk/operations/tri_mesh/CMakeLists.txt | 4 ++-- .../{EdgeSwap.cpp => EdgeSwapValence.cpp} | 15 +++++++++------ .../{EdgeSwap.hpp => EdgeSwapValence.hpp} | 10 +++++----- .../test_component_isotropic_remeshing.cpp | 14 +++++++------- tests/test_2d_operations.cpp | 14 +++++++------- 6 files changed, 33 insertions(+), 30 deletions(-) rename src/wmtk/operations/tri_mesh/{EdgeSwap.cpp => EdgeSwapValence.cpp} (92%) rename src/wmtk/operations/tri_mesh/{EdgeSwap.hpp => EdgeSwapValence.hpp} (68%) diff --git a/components/wmtk_components/isotropic_remeshing/internal/IsotropicRemeshing.cpp b/components/wmtk_components/isotropic_remeshing/internal/IsotropicRemeshing.cpp index ab62facb06..bd41c28e28 100644 --- a/components/wmtk_components/isotropic_remeshing/internal/IsotropicRemeshing.cpp +++ b/components/wmtk_components/isotropic_remeshing/internal/IsotropicRemeshing.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include namespace wmtk::components::internal { @@ -46,10 +46,10 @@ IsotropicRemeshing::IsotropicRemeshing(TriMesh& mesh, const double length, const } // flip { - OperationSettings op_settings; + OperationSettings op_settings; op_settings.must_improve_valence = true; - m_scheduler.add_operation_type("swap", op_settings); + m_scheduler.add_operation_type("swap", op_settings); } // smooth { diff --git a/src/wmtk/operations/tri_mesh/CMakeLists.txt b/src/wmtk/operations/tri_mesh/CMakeLists.txt index b31f5c3020..14b76b54f9 100644 --- a/src/wmtk/operations/tri_mesh/CMakeLists.txt +++ b/src/wmtk/operations/tri_mesh/CMakeLists.txt @@ -9,8 +9,8 @@ set(SRC_FILES EdgeCollapse.cpp EdgeCollapseToMidpoint.hpp EdgeCollapseToMidpoint.cpp - EdgeSwap.hpp - EdgeSwap.cpp + EdgeSwapValence.hpp + EdgeSwapValence.cpp VertexAttributesUpdateBase.hpp VertexAttributesUpdateBase.cpp VertexLaplacianSmooth.hpp diff --git a/src/wmtk/operations/tri_mesh/EdgeSwap.cpp b/src/wmtk/operations/tri_mesh/EdgeSwapValence.cpp similarity index 92% rename from src/wmtk/operations/tri_mesh/EdgeSwap.cpp rename to src/wmtk/operations/tri_mesh/EdgeSwapValence.cpp index 9060beaa74..2f10ec53ec 100644 --- a/src/wmtk/operations/tri_mesh/EdgeSwap.cpp +++ b/src/wmtk/operations/tri_mesh/EdgeSwapValence.cpp @@ -1,21 +1,24 @@ -#include "EdgeSwap.hpp" +#include "EdgeSwapValence.hpp" #include #include #include "EdgeCollapse.hpp" #include "EdgeSplit.hpp" namespace wmtk::operations::tri_mesh { -EdgeSwap::EdgeSwap(Mesh& m, const Tuple& t, const OperationSettings& settings) +EdgeSwapValence::EdgeSwapValence( + Mesh& m, + const Tuple& t, + const OperationSettings& settings) : TriMeshOperation(m) , TupleOperation(settings.invariants, t) , m_settings{settings} {} -std::string EdgeSwap::name() const +std::string EdgeSwapValence::name() const { return "tri_mesh_edge_swap"; } -bool EdgeSwap::before() const +bool EdgeSwapValence::before() const { if (!mesh().is_valid_slow(input_tuple())) { return false; @@ -69,12 +72,12 @@ bool EdgeSwap::before() const return true; } -Tuple EdgeSwap::return_tuple() const +Tuple EdgeSwapValence::return_tuple() const { return m_output_tuple; } -bool EdgeSwap::execute() +bool EdgeSwapValence::execute() { // input // / \ diff --git a/src/wmtk/operations/tri_mesh/EdgeSwap.hpp b/src/wmtk/operations/tri_mesh/EdgeSwapValence.hpp similarity index 68% rename from src/wmtk/operations/tri_mesh/EdgeSwap.hpp rename to src/wmtk/operations/tri_mesh/EdgeSwapValence.hpp index d95396741e..f8e445eeeb 100644 --- a/src/wmtk/operations/tri_mesh/EdgeSwap.hpp +++ b/src/wmtk/operations/tri_mesh/EdgeSwapValence.hpp @@ -7,21 +7,21 @@ namespace wmtk::operations { namespace tri_mesh { -class EdgeSwap; +class EdgeSwapValence; } template <> -struct OperationSettings +struct OperationSettings { bool must_improve_valence = false; InvariantCollection invariants; }; namespace tri_mesh { -class EdgeSwap : public TriMeshOperation, private TupleOperation +class EdgeSwapValence : public TriMeshOperation, private TupleOperation { public: - EdgeSwap(Mesh& m, const Tuple& t, const OperationSettings& settings); + EdgeSwapValence(Mesh& m, const Tuple& t, const OperationSettings& settings); std::string name() const override; Tuple return_tuple() const; @@ -34,7 +34,7 @@ class EdgeSwap : public TriMeshOperation, private TupleOperation private: Tuple m_output_tuple; - const OperationSettings& m_settings; + const OperationSettings& m_settings; }; } // namespace tri_mesh diff --git a/tests/components/test_component_isotropic_remeshing.cpp b/tests/components/test_component_isotropic_remeshing.cpp index 3ee561e187..79acb25494 100644 --- a/tests/components/test_component_isotropic_remeshing.cpp +++ b/tests/components/test_component_isotropic_remeshing.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include @@ -503,9 +503,9 @@ TEST_CASE("swap_edge_for_valence", "[components][isotropic_remeshing][swap][2D]" // swap edge to create inbalence in valence { const Tuple e = mesh.edge_tuple_between_v1_v2(6, 7, 5); - OperationSettings settings; + OperationSettings settings; // settings.initialize_invariants(mesh); - tri_mesh::EdgeSwap op(mesh, e, settings); + tri_mesh::EdgeSwapValence op(mesh, e, settings); const bool success = op(); REQUIRE(success); } @@ -523,12 +523,12 @@ TEST_CASE("swap_edge_for_valence", "[components][isotropic_remeshing][swap][2D]" } - OperationSettings op_settings; + OperationSettings op_settings; op_settings.must_improve_valence = true; // op_settings.initialize_invariants(mesh); Scheduler scheduler(mesh); - scheduler.add_operation_type("TriMeshSwapEdgeOperation", op_settings); + scheduler.add_operation_type("TriMeshSwapEdgeOperation", op_settings); scheduler.run_operation_on_all(PrimitiveType::Edge, "TriMeshSwapEdgeOperation"); // check valence @@ -545,10 +545,10 @@ TEST_CASE("swap_edge_for_valence", "[components][isotropic_remeshing][swap][2D]" } SECTION("swap_fail") { - OperationSettings op_settings; + OperationSettings op_settings; op_settings.must_improve_valence = true; const Tuple e = mesh.edge_tuple_between_v1_v2(6, 7, 5); - EdgeSwap op(mesh, e, op_settings); + EdgeSwapValence op(mesh, e, op_settings); const bool success = op(); CHECK(!success); } diff --git a/tests/test_2d_operations.cpp b/tests/test_2d_operations.cpp index bc9d48dbb3..31c5f9fd75 100644 --- a/tests/test_2d_operations.cpp +++ b/tests/test_2d_operations.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include "tools/DEBUG_TriMesh.hpp" #include "tools/TriMesh_examples.hpp" @@ -1111,8 +1111,8 @@ TEST_CASE("swap_edge", "[operations][swap][2D]") REQUIRE(m.is_connectivity_valid()); const Tuple edge = m.edge_tuple_between_v1_v2(1, 2, 0); - OperationSettings settings; - tri_mesh::EdgeSwap op(m, edge, settings); + OperationSettings settings; + tri_mesh::EdgeSwapValence op(m, edge, settings); const bool success = op(); REQUIRE(success); const Tuple ret = op.return_tuple(); @@ -1137,8 +1137,8 @@ TEST_CASE("swap_edge", "[operations][swap][2D]") REQUIRE(m.is_connectivity_valid()); const Tuple edge = m.edge_tuple_between_v1_v2(1, 2, 2); - OperationSettings settings; - tri_mesh::EdgeSwap op(m, edge, settings); + OperationSettings settings; + tri_mesh::EdgeSwapValence op(m, edge, settings); const bool success = op(); REQUIRE(success); const Tuple ret = op.return_tuple(); @@ -1163,8 +1163,8 @@ TEST_CASE("swap_edge", "[operations][swap][2D]") REQUIRE(m.is_connectivity_valid()); const Tuple edge = m.edge_tuple_between_v1_v2(1, 2, 0); - OperationSettings settings; - tri_mesh::EdgeSwap op(m, edge, settings); + OperationSettings settings; + tri_mesh::EdgeSwapValence op(m, edge, settings); const bool success = op(); REQUIRE(!success); REQUIRE(m.is_connectivity_valid());