From bcfe4005a202b1defc8019af3ce8d54b47d107b7 Mon Sep 17 00:00:00 2001
From: Stephane Del Pino <stephane.delpino44@gmail.com>
Date: Fri, 7 Sep 2018 12:27:32 +0200
Subject: [PATCH] Rename ItemId to ItemTypeId

---
 src/mesh/Connectivity.cpp | 10 +++++-----
 src/mesh/Connectivity.hpp |  6 +++---
 src/mesh/ItemType.hpp     | 14 +++++++-------
 tests/test_ItemType.cpp   | 24 ++++++++++++------------
 4 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/src/mesh/Connectivity.cpp b/src/mesh/Connectivity.cpp
index 94733f347..6e19dcc6a 100644
--- a/src/mesh/Connectivity.cpp
+++ b/src/mesh/Connectivity.cpp
@@ -97,7 +97,7 @@ void Connectivity<3>::_computeCellFaceAndFaceNodeConnectivities()
 
   {
     auto& cell_to_face_matrix
-        = m_item_to_item_matrix[itemId(ItemType::cell)][itemId(ItemType::face)];
+        = m_item_to_item_matrix[itemTId(ItemType::cell)][itemTId(ItemType::face)];
     std::vector<std::vector<unsigned int>> cell_to_face_vector(this->numberOfCells());
     for (size_t j=0; j<cell_to_face_vector.size(); ++j) {
       cell_to_face_vector[j].resize(cell_nb_faces[j]);
@@ -129,7 +129,7 @@ void Connectivity<3>::_computeCellFaceAndFaceNodeConnectivities()
 
   {
     auto& face_to_node_matrix
-        = m_item_to_item_matrix[itemId(ItemType::face)][itemId(ItemType::node)];
+        = m_item_to_item_matrix[itemTId(ItemType::face)][itemTId(ItemType::node)];
 
     std::vector<std::vector<unsigned int>> face_to_node_vector(face_cells_map.size());
     int l=0;
@@ -192,7 +192,7 @@ void Connectivity<2>::_computeCellFaceAndFaceNodeConnectivities()
       ++l;
     }
     auto& face_to_node_matrix
-        = m_item_to_item_matrix[itemId(ItemType::face)][itemId(ItemType::node)];
+        = m_item_to_item_matrix[itemTId(ItemType::face)][itemTId(ItemType::node)];
     face_to_node_matrix = face_to_node_vector;
   }
 
@@ -207,7 +207,7 @@ void Connectivity<2>::_computeCellFaceAndFaceNodeConnectivities()
       ++l;
     }
     auto& face_to_cell_matrix
-        = m_item_to_item_matrix[itemId(ItemType::face)][itemId(ItemType::cell)];
+        = m_item_to_item_matrix[itemTId(ItemType::face)][itemTId(ItemType::cell)];
     face_to_cell_matrix = face_to_cell_vector;
   }
 }
@@ -221,7 +221,7 @@ Connectivity(const std::vector<std::vector<unsigned int>>& cell_by_node_vector,
   Assert(cell_by_node_vector.size() == cell_type_vector.size());
 
   auto& cell_to_node_matrix
-      = m_item_to_item_matrix[itemId(ItemType::cell)][itemId(ItemType::node)];
+      = m_item_to_item_matrix[itemTId(ItemType::cell)][itemTId(ItemType::node)];
   cell_to_node_matrix = cell_by_node_vector;
 
   Assert(this->numberOfCells()>0);
diff --git a/src/mesh/Connectivity.hpp b/src/mesh/Connectivity.hpp
index 964daeb26..0948f1bf1 100644
--- a/src/mesh/Connectivity.hpp
+++ b/src/mesh/Connectivity.hpp
@@ -228,7 +228,7 @@ class Connectivity final
     : public IConnectivity
 {
  private:
-  constexpr static auto& itemId = ItemId<Dimension>::itemId;
+  constexpr static auto& itemTId = ItemTypeId<Dimension>::itemTId;
 
  public:
   static constexpr size_t dimension = Dimension;
@@ -289,7 +289,7 @@ class Connectivity final
                                         const ItemType& item_type_1) const
   {
     const ConnectivityMatrix& connectivity_matrix
-        = m_item_to_item_matrix[itemId(item_type_0)][itemId(item_type_1)];
+        = m_item_to_item_matrix[itemTId(item_type_0)][itemTId(item_type_1)];
     return connectivity_matrix.isBuilt();
   }
 
@@ -298,7 +298,7 @@ class Connectivity final
                                       const ItemType& item_type_1) const
   {
     const ConnectivityMatrix& connectivity_matrix
-        = m_item_to_item_matrix[itemId(item_type_0)][itemId(item_type_1)];
+        = m_item_to_item_matrix[itemTId(item_type_0)][itemTId(item_type_1)];
     if (not connectivity_matrix.isBuilt()) {
       const_cast<ConnectivityMatrix&>(connectivity_matrix)
           = m_connectivity_computer
diff --git a/src/mesh/ItemType.hpp b/src/mesh/ItemType.hpp
index d37c02fae..965f888b1 100644
--- a/src/mesh/ItemType.hpp
+++ b/src/mesh/ItemType.hpp
@@ -39,12 +39,12 @@ std::string_view itemName(const ItemType& item_type)
 }
 
 template <size_t Dimension>
-struct ItemId {};
+struct ItemTypeId {};
 
 template <>
-struct ItemId<1>
+struct ItemTypeId<1>
 {
-  inline static constexpr size_t itemId(const ItemType& item_type) {
+  inline static constexpr size_t itemTId(const ItemType& item_type) {
     size_t i = std::numeric_limits<size_t>::max();
     switch(item_type) {
       case ItemType::cell: {
@@ -64,9 +64,9 @@ struct ItemId<1>
 };
 
 template <>
-struct ItemId<2>
+struct ItemTypeId<2>
 {
-  inline static constexpr size_t itemId(const ItemType& item_type) {
+  inline static constexpr size_t itemTId(const ItemType& item_type) {
     size_t i = std::numeric_limits<size_t>::max();
     switch(item_type) {
       case ItemType::cell: {
@@ -89,9 +89,9 @@ struct ItemId<2>
 };
 
 template <>
-struct ItemId<3>
+struct ItemTypeId<3>
 {
-  inline static constexpr size_t itemId(const ItemType& item_type) {
+  inline static constexpr size_t itemTId(const ItemType& item_type) {
     size_t i = std::numeric_limits<size_t>::max();
     switch(item_type) {
       case ItemType::cell: {
diff --git a/tests/test_ItemType.cpp b/tests/test_ItemType.cpp
index 7c3996361..096dbdaf5 100644
--- a/tests/test_ItemType.cpp
+++ b/tests/test_ItemType.cpp
@@ -26,23 +26,23 @@ TEST_CASE("ItemType", "[connectivity]") {
   }
 
   SECTION("checking for item ids in 1d") {
-    REQUIRE(ItemId<1>::itemId(cell_type)==0);
-    REQUIRE(ItemId<1>::itemId(edge_type)==1);
-    REQUIRE(ItemId<1>::itemId(face_type)==1);
-    REQUIRE(ItemId<1>::itemId(node_type)==1);
+    REQUIRE(ItemTypeId<1>::itemTId(cell_type)==0);
+    REQUIRE(ItemTypeId<1>::itemTId(edge_type)==1);
+    REQUIRE(ItemTypeId<1>::itemTId(face_type)==1);
+    REQUIRE(ItemTypeId<1>::itemTId(node_type)==1);
   }
 
   SECTION("checking for item ids in 2d") {
-    REQUIRE(ItemId<2>::itemId(cell_type)==0);
-    REQUIRE(ItemId<2>::itemId(edge_type)==1);
-    REQUIRE(ItemId<2>::itemId(face_type)==1);
-    REQUIRE(ItemId<2>::itemId(node_type)==2);
+    REQUIRE(ItemTypeId<2>::itemTId(cell_type)==0);
+    REQUIRE(ItemTypeId<2>::itemTId(edge_type)==1);
+    REQUIRE(ItemTypeId<2>::itemTId(face_type)==1);
+    REQUIRE(ItemTypeId<2>::itemTId(node_type)==2);
   }
 
   SECTION("checking for item ids in 3d") {
-    REQUIRE(ItemId<3>::itemId(cell_type)==0);
-    REQUIRE(ItemId<3>::itemId(edge_type)==1);
-    REQUIRE(ItemId<3>::itemId(face_type)==2);
-    REQUIRE(ItemId<3>::itemId(node_type)==3);
+    REQUIRE(ItemTypeId<3>::itemTId(cell_type)==0);
+    REQUIRE(ItemTypeId<3>::itemTId(edge_type)==1);
+    REQUIRE(ItemTypeId<3>::itemTId(face_type)==2);
+    REQUIRE(ItemTypeId<3>::itemTId(node_type)==3);
   }
 }
-- 
GitLab