From 1041f7bc843d09693f51e1dd0ddc312dc53b9ddd Mon Sep 17 00:00:00 2001 From: Stephane Del Pino <stephane.delpino44@gmail.com> Date: Thu, 11 Apr 2019 19:06:37 +0200 Subject: [PATCH] Fix and remove warnings the untreated #warning have been converted to issues --- src/mesh/Connectivity.cpp | 12 ------------ src/mesh/Connectivity.hpp | 14 ++++++++++++-- src/mesh/ConnectivityDispatcher.cpp | 6 ------ src/mesh/GmshReader.cpp | 20 -------------------- src/mesh/Mesh.hpp | 2 -- src/mesh/MeshData.hpp | 8 ++++++-- src/mesh/MeshNodeBoundary.hpp | 3 --- src/utils/Messenger.cpp | 3 ++- src/utils/Messenger.hpp | 6 ++++-- src/utils/Partitioner.cpp | 2 +- src/utils/SignalManager.cpp | 4 +--- 11 files changed, 26 insertions(+), 54 deletions(-) diff --git a/src/mesh/Connectivity.cpp b/src/mesh/Connectivity.cpp index 3a35c0255..596a9b8b0 100644 --- a/src/mesh/Connectivity.cpp +++ b/src/mesh/Connectivity.cpp @@ -10,7 +10,6 @@ template<size_t Dimension> void Connectivity<Dimension>:: _buildFrom(const ConnectivityDescriptor& descriptor) { -#warning All of these should be checked by ConnectivityDescriptor Assert(descriptor.cell_to_node_vector.size() == descriptor.cell_type_vector.size()); Assert(descriptor.cell_number_vector.size() == descriptor.cell_type_vector.size()); if constexpr (Dimension>1) { @@ -45,8 +44,6 @@ _buildFrom(const ConnectivityDescriptor& descriptor) { WeakCellValue<int> cell_global_index(*this); -#warning index must start accounting number of global indices of other procs -#warning must take care of ghost cells int first_index = 0; parallel_for(this->numberOfCells(), PASTIS_LAMBDA(const CellId& j) { cell_global_index[j] = first_index+j; @@ -54,15 +51,6 @@ _buildFrom(const ConnectivityDescriptor& descriptor) m_cell_global_index = cell_global_index; } - { - WeakCellValue<double> inv_cell_nb_nodes(*this); - parallel_for(this->numberOfCells(), PASTIS_LAMBDA(const CellId& j) { - const auto& cell_nodes = cell_to_node_matrix.rowConst(j); - inv_cell_nb_nodes[j] = 1./cell_nodes.length; - }); - m_inv_cell_nb_nodes = inv_cell_nb_nodes; - } - { WeakCellValue<int> cell_owner(*this); cell_owner = convert_to_array(descriptor.cell_owner_vector); diff --git a/src/mesh/Connectivity.hpp b/src/mesh/Connectivity.hpp index 098675884..5643d0737 100644 --- a/src/mesh/Connectivity.hpp +++ b/src/mesh/Connectivity.hpp @@ -172,7 +172,6 @@ class Connectivity final ConnectivityMatrix m_item_to_item_matrix[Dimension+1][Dimension+1]; WeakCellValue<const CellType> m_cell_type; -#warning is m_cell_global_index really necessary? should it be computed on demand instead? WeakCellValue<const int> m_cell_global_index; WeakCellValue<const int> m_cell_number; @@ -721,7 +720,18 @@ class Connectivity final CellValue<const double> invCellNbNodes() const { -#warning add calculation on demand when variables will be defined + if (not m_inv_cell_nb_nodes.isBuilt()) { + const auto& cell_to_node_matrix + = m_item_to_item_matrix[itemTId(ItemType::cell)][itemTId(ItemType::node)]; + + WeakCellValue<double> inv_cell_nb_nodes(*this); + parallel_for(this->numberOfCells(), PASTIS_LAMBDA(const CellId& j) { + const auto& cell_nodes = cell_to_node_matrix.rowConst(j); + inv_cell_nb_nodes[j] = 1./cell_nodes.length; + }); + const_cast<WeakCellValue<const double>&>(m_inv_cell_nb_nodes) = inv_cell_nb_nodes; + } + return m_inv_cell_nb_nodes; } diff --git a/src/mesh/ConnectivityDispatcher.cpp b/src/mesh/ConnectivityDispatcher.cpp index a21b316bd..aa26cb6f7 100644 --- a/src/mesh/ConnectivityDispatcher.cpp +++ b/src/mesh/ConnectivityDispatcher.cpp @@ -431,8 +431,6 @@ ConnectivityDispatcher<Dimension>::_buildItemReferenceList() return number_of_item_list_sender; }(); - pout() << "- dispatching references for " << itemName(item_type) << '\n'; - if (number_of_item_list_sender > 0) { if (number_of_item_list_sender > 1) { perr() << __FILE__ << ':' << __LINE__ << ": " @@ -505,10 +503,6 @@ ConnectivityDispatcher<Dimension>::_buildItemReferenceList() return ref_id_list; } (); - for (auto ref_id : ref_id_list) { - pout() << " - " << ref_id << '\n'; - } - using block_type = int32_t; constexpr size_t block_size = sizeof(block_type); const size_t nb_block = ref_id_list.size()/block_size + (ref_id_list.size()%block_size != 0); diff --git a/src/mesh/GmshReader.cpp b/src/mesh/GmshReader.cpp index 2817d7a3d..1881f99a4 100644 --- a/src/mesh/GmshReader.cpp +++ b/src/mesh/GmshReader.cpp @@ -208,12 +208,6 @@ class ConnectivityFace<2> (m_node_number_vector[m_node1_id]<m_node_number_vector[f.m_node1_id]))); } - PASTIS_INLINE - ConnectivityFace& operator=(const ConnectivityFace&) = default; - - PASTIS_INLINE - ConnectivityFace& operator=(ConnectivityFace&&) = default; - PASTIS_INLINE ConnectivityFace(const std::vector<unsigned int>& node_id_list, const std::vector<int>& node_number_vector) @@ -235,9 +229,6 @@ class ConnectivityFace<2> PASTIS_INLINE ConnectivityFace(const ConnectivityFace&) = default; - PASTIS_INLINE - ConnectivityFace(ConnectivityFace&&) = default; - PASTIS_INLINE ~ConnectivityFace() = default; }; @@ -333,19 +324,9 @@ class ConnectivityFace<3> return m_node_id_list.size() < f.m_node_id_list.size(); } - PASTIS_INLINE - ConnectivityFace& operator=(const ConnectivityFace&) = default; - - PASTIS_INLINE - ConnectivityFace& operator=(ConnectivityFace&&) = default; - PASTIS_INLINE ConnectivityFace(const ConnectivityFace&) = default; - PASTIS_INLINE - ConnectivityFace(ConnectivityFace&&) = default; - - PASTIS_INLINE ConnectivityFace() = delete; @@ -1210,7 +1191,6 @@ GmshReader::__proceedData() ErrorHandler::normal); } -#warning should use an unordered_map // A value of -1 means that the vertex is unknown __verticesCorrepondance.resize(maxNumber+1,-1); diff --git a/src/mesh/Mesh.hpp b/src/mesh/Mesh.hpp index e111d1453..b103e2294 100644 --- a/src/mesh/Mesh.hpp +++ b/src/mesh/Mesh.hpp @@ -11,7 +11,6 @@ struct IMesh { virtual size_t dimension() const = 0; - // virtual CSRGraph cellToCellGraph() const = 0; ~IMesh() = default; }; @@ -66,7 +65,6 @@ public: return m_xr; } - [[deprecated("should rework this class: quite ugly")]] PASTIS_INLINE NodeValue<Rd> mutableXr() const { diff --git a/src/mesh/MeshData.hpp b/src/mesh/MeshData.hpp index dd8f33dea..3d5cc9b75 100644 --- a/src/mesh/MeshData.hpp +++ b/src/mesh/MeshData.hpp @@ -178,13 +178,11 @@ class MeshData const FaceId& l = cell_faces[L]; const auto& face_nodes = face_to_node_matrix[l]; -#warning should this lambda be replaced by a precomputed correspondance? auto local_node_number_in_cell = [&](const NodeId& node_number) { for (size_t i_node=0; i_node<cell_nodes.size(); ++i_node) { if (node_number == cell_nodes[i_node]) { return i_node; - break; } } return std::numeric_limits<size_t>::max(); @@ -227,31 +225,37 @@ class MeshData } public: + PASTIS_INLINE const MeshType& mesh() const { return m_mesh; } + PASTIS_INLINE const NodeValuePerCell<const Rd>& Cjr() const { return m_Cjr; } + PASTIS_INLINE const NodeValuePerCell<const double>& ljr() const { return m_ljr; } + PASTIS_INLINE const NodeValuePerCell<const Rd>& njr() const { return m_njr; } + PASTIS_INLINE const CellValue<const Rd>& xj() const { return m_xj; } + PASTIS_INLINE const CellValue<const double>& Vj() const { return m_Vj; diff --git a/src/mesh/MeshNodeBoundary.hpp b/src/mesh/MeshNodeBoundary.hpp index ae31e3240..ff8ef4a92 100644 --- a/src/mesh/MeshNodeBoundary.hpp +++ b/src/mesh/MeshNodeBoundary.hpp @@ -287,7 +287,6 @@ _getNormal(const MeshType& mesh) zmax = x; } } -#warning re work this part to avoir parallelism dependance Array<R3> xmin_array = parallel::allGather(xmin); Array<R3> xmax_array = parallel::allGather(xmax); Array<R3> ymin_array = parallel::allGather(ymin); @@ -320,7 +319,6 @@ _getNormal(const MeshType& mesh) if (x[2] > zmax[2]) { zmax = x; } } - const R3 u = xmax-xmin; const R3 v = ymax-ymin; const R3 w = zmax-zmin; @@ -355,7 +353,6 @@ _getNormal(const MeshType& mesh) normal *= 1./sqrt(normal_l2); -#warning Add flatness test // this->_checkBoundaryIsFlat(normal, xmin, xmax, mesh); return normal; diff --git a/src/utils/Messenger.cpp b/src/utils/Messenger.cpp index 2bf82efac..6dc4056ef 100644 --- a/src/utils/Messenger.cpp +++ b/src/utils/Messenger.cpp @@ -26,7 +26,8 @@ void Messenger::destroy() } Messenger:: -Messenger(int& argc, char* argv[]) +Messenger([[maybe_unused]] int& argc, + [[maybe_unused]] char* argv[]) { #ifdef PASTIS_HAS_MPI MPI_Init(&argc, &argv); diff --git a/src/utils/Messenger.hpp b/src/utils/Messenger.hpp index 163489cc5..4a54994a2 100644 --- a/src/utils/Messenger.hpp +++ b/src/utils/Messenger.hpp @@ -138,7 +138,8 @@ class Messenger } template <typename DataType> - void _broadcast_value(DataType& data, const size_t& root_rank) const + void _broadcast_value([[maybe_unused]] DataType& data, + [[maybe_unused]] const size_t& root_rank) const { static_assert(not std::is_const_v<DataType>); static_assert(std::is_arithmetic_v<DataType>); @@ -152,7 +153,8 @@ class Messenger } template <typename ArrayType> - void _broadcast_array(ArrayType& array, const size_t& root_rank) const + void _broadcast_array([[maybe_unused]] ArrayType& array, + [[maybe_unused]] const size_t& root_rank) const { using DataType = typename ArrayType::data_type; static_assert(not std::is_const_v<DataType>); diff --git a/src/utils/Partitioner.cpp b/src/utils/Partitioner.cpp index c1da28a49..709038090 100644 --- a/src/utils/Partitioner.cpp +++ b/src/utils/Partitioner.cpp @@ -83,7 +83,7 @@ Array<int> Partitioner::partition(const CSRGraph& graph) #else // PASTIS_HAS_MPI -Array<int> Partitioner::partition(const CSRGraph& graph) +Array<int> Partitioner::partition(const CSRGraph&) { return Array<int>(0); } diff --git a/src/utils/SignalManager.cpp b/src/utils/SignalManager.cpp index 319765461..525db43c8 100644 --- a/src/utils/SignalManager.cpp +++ b/src/utils/SignalManager.cpp @@ -36,9 +36,7 @@ std::string SignalManager::signalName(const int& signal) void SignalManager::pauseForDebug(const int& signal) { if (std::string(PASTIS_BUILD_TYPE) != "Release") { -#warning should try to detect if outputs to a terminal (buggy with mpi) - if (// (ConsoleManager::isTerminal(pout()) and (s_pause_on_error == "auto")) or - (s_pause_on_error == "yes")) { + if (s_pause_on_error == "yes") { std::cerr << "\n======================================\n" << rang::style::reset << rang::fg::reset -- GitLab