From 6bd4c2dc6537997c1822be1b551270de1e938671 Mon Sep 17 00:00:00 2001 From: Stephane Del Pino <stephane.delpino44@gmail.com> Date: Wed, 8 Aug 2018 16:08:51 +0200 Subject: [PATCH] Rename members to improve clarity Generically, changes look like - m_item_to_subitem_local_item -> m_item_local_numbers_in_their_subitem - itemToSubitemLocalItem() -> itemLocalNumbersInTheirSubitem() --- src/mesh/Connectivity.cpp | 6 +++--- src/mesh/Connectivity.hpp | 30 ++++++++++++++---------------- src/scheme/AcousticSolver.hpp | 19 +++++++++++++------ 3 files changed, 30 insertions(+), 25 deletions(-) diff --git a/src/mesh/Connectivity.cpp b/src/mesh/Connectivity.cpp index fedd33746..b588f30c5 100644 --- a/src/mesh/Connectivity.cpp +++ b/src/mesh/Connectivity.cpp @@ -158,7 +158,7 @@ void Connectivity<3>::_computeFaceCellConnectivities() m_connectivity_computer.computeInverseConnectivityMatrix(cell_to_face_matrix, face_to_cell_matrix); - m_face_to_cell_local_face + m_face_local_numbers_in_their_cells = m_connectivity_computer.computeLocalItemNumberInChildItem<ItemType::face, ItemType::cell>(*this); @@ -278,10 +278,10 @@ Connectivity(const std::vector<std::vector<unsigned int>>& cell_by_node_vector) m_connectivity_computer.computeInverseConnectivityMatrix(cell_to_node_matrix, node_to_cell_matrix); - m_node_to_cell_local_node + m_node_local_numbers_in_their_cells = m_connectivity_computer.computeLocalItemNumberInChildItem<ItemType::node, ItemType::cell>(*this); - m_cell_to_node_local_cell + m_cell_local_numbers_in_their_nodes = m_connectivity_computer.computeLocalItemNumberInChildItem<ItemType::cell, ItemType::node>(*this); if constexpr (Dimension>1) { diff --git a/src/mesh/Connectivity.hpp b/src/mesh/Connectivity.hpp index 0bb4501ca..b40c1ec18 100644 --- a/src/mesh/Connectivity.hpp +++ b/src/mesh/Connectivity.hpp @@ -248,30 +248,29 @@ class Connectivity final return m_cell_face_is_reversed; } - [[deprecated("These member functions are poorly named")]] - const auto& cellToNodeLocalCell() const + const auto& cellLocalNumbersInTheirNodes() const { - return m_cell_to_node_local_cell; + return m_cell_local_numbers_in_their_nodes; } - const auto& nodeToCellLocalNode() const + const auto& nodeLocalNumbersInTheirCells() const { - return m_node_to_cell_local_node; + return m_node_local_numbers_in_their_cells; } - const auto& faceToCellLocalFace() const + const auto& faceLocalNumbersInTheirCells() const { if constexpr(dimension>1) { - return m_face_to_cell_local_face; + return m_face_local_numbers_in_their_cells; } else { - return m_node_to_cell_local_node; + return m_node_local_numbers_in_their_cells; } } const auto& nodeToFaceLocalNode() const { - static_assert("this function has no meaning in 1d"); - return m_node_to_face_local_node; + static_assert(Dimension==1,"this function has no meaning in 1d"); + return m_node_local_numbers_in_their_faces; } private: @@ -279,17 +278,16 @@ private: FaceValuePerCell<const bool> m_cell_face_is_reversed; - [[deprecated("These members are poorly named")]] - NodeValuePerCell<const unsigned short> m_cell_to_node_local_cell; + NodeValuePerCell<const unsigned short> m_cell_local_numbers_in_their_nodes; - CellValuePerFace<const unsigned short> m_face_to_cell_local_face; + CellValuePerFace<const unsigned short> m_face_local_numbers_in_their_cells; - CellValuePerNode<const unsigned short> m_node_to_cell_local_node; + CellValuePerNode<const unsigned short> m_node_local_numbers_in_their_cells; // not plugged ... #warning remaining def - NodeValuePerFace<unsigned short> m_node_to_face_local_node; - FaceValuePerNode<unsigned short> m_face_to_node_local_face; + NodeValuePerFace<unsigned short> m_node_local_numbers_in_their_faces; + FaceValuePerNode<unsigned short> m_face_local_numbers_in_their_nodes; // ... not plugged ConnectivityComputer m_connectivity_computer; diff --git a/src/scheme/AcousticSolver.hpp b/src/scheme/AcousticSolver.hpp index 52a3905c1..4145c01ea 100644 --- a/src/scheme/AcousticSolver.hpp +++ b/src/scheme/AcousticSolver.hpp @@ -101,14 +101,18 @@ class AcousticSolver const auto& node_to_cell_matrix = getConnectivityMatrix<ItemType::node, ItemType::cell>(m_connectivity); - const auto& node_to_cell_local_node = m_connectivity.nodeToCellLocalNode(); + const auto& node_local_numbers_in_their_cells + = m_connectivity.nodeLocalNumbersInTheirCells(); + Kokkos::parallel_for(m_mesh.numberOfNodes(), KOKKOS_LAMBDA(const int& r) { Rdd sum = zero; const auto& node_to_cell = node_to_cell_matrix.rowConst(r); - const auto& cell_local_node = node_to_cell_local_node.itemValues(r); + const auto& node_local_number_in_its_cells + = node_local_numbers_in_their_cells.itemValues(r); + for (size_t j=0; j<node_to_cell.length; ++j) { const unsigned int J = node_to_cell(j); - const unsigned int R = cell_local_node[j]; + const unsigned int R = node_local_number_in_its_cells[j]; sum += Ajr(J,R); } m_Ar(r) = sum; @@ -126,15 +130,18 @@ class AcousticSolver const auto& node_to_cell_matrix = getConnectivityMatrix<ItemType::node, ItemType::cell>(m_connectivity); - const auto& node_to_cell_local_node = m_connectivity.nodeToCellLocalNode(); + const auto& node_local_numbers_in_their_cells + = m_connectivity.nodeLocalNumbersInTheirCells(); + Kokkos::parallel_for(m_mesh.numberOfNodes(), KOKKOS_LAMBDA(const int& r) { Rd& br = m_br(r); br = zero; const auto& node_to_cell = node_to_cell_matrix.rowConst(r); - const auto& cell_local_node = node_to_cell_local_node.itemValues(r); + const auto& node_local_number_in_its_cells + = node_local_numbers_in_their_cells.itemValues(r); for (size_t j=0; j<node_to_cell.length; ++j) { const unsigned int J = node_to_cell(j); - const unsigned int R = cell_local_node[j]; + const unsigned int R = node_local_number_in_its_cells[j]; br += Ajr(J,R)*uj(J) + pj(J)*Cjr(J,R); } }); -- GitLab