From 403caa7c7e348e597463cc772dd2a0cb41c4e182 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <github@naumov.de> Date: Sat, 7 Jul 2018 13:05:58 +0200 Subject: [PATCH] NWMP; Move out getElementIntegerVariables(). It's not accessing any members of the class. --- .../PartitionMesh/NodeWiseMeshPartitioner.cpp | 42 +++++++++++-------- .../PartitionMesh/NodeWiseMeshPartitioner.h | 14 ------- 2 files changed, 24 insertions(+), 32 deletions(-) diff --git a/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp b/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp index 176d94b97ee..f748dceb6c8 100644 --- a/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp +++ b/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp @@ -505,6 +505,30 @@ NodeWiseMeshPartitioner::writeConfigDataBinary( return std::make_tuple(num_elem_integers, num_g_elem_integers); } +/// Get integer variables, which are used to define an element +/// +/// \param elem Element +/// \param local_node_ids Local node indices of a partition +/// \param elem_info A vector holds all integer variables of +/// element definitions +/// \param counter Recorder of the number of integer variables. +void getElementIntegerVariables(const MeshLib::Element& elem, + const std::vector<long>& local_node_ids, + std::vector<long>& elem_info, + long& counter) +{ + unsigned mat_id = 0; // TODO: Material ID to be set from the mesh data + const long nn = elem.getNumberOfNodes(); + elem_info[counter++] = mat_id; + elem_info[counter++] = static_cast<long>(elem.getCellType()); + elem_info[counter++] = nn; + + for (long i = 0; i < nn; i++) + { + elem_info[counter++] = local_node_ids[elem.getNodeIndex(i)]; + } +} + void NodeWiseMeshPartitioner::writeElementsBinary( const std::string& file_name_base, const std::vector<IntegerType>& num_elem_integers, @@ -701,24 +725,6 @@ void NodeWiseMeshPartitioner::writeASCII(const std::string& file_name_base) writeNodesASCII(file_name_base); } -void NodeWiseMeshPartitioner::getElementIntegerVariables( - const MeshLib::Element& elem, - const std::vector<IntegerType>& local_node_ids, - std::vector<IntegerType>& elem_info, - IntegerType& counter) -{ - unsigned mat_id = 0; // TODO: Material ID to be set from the mesh data - const IntegerType nn = elem.getNumberOfNodes(); - elem_info[counter++] = mat_id; - elem_info[counter++] = static_cast<unsigned>(elem.getCellType()); - elem_info[counter++] = nn; - - for (IntegerType i = 0; i < nn; i++) - { - elem_info[counter++] = local_node_ids[elem.getNodeIndex(i)]; - } -} - void NodeWiseMeshPartitioner::writeLocalElementNodeIndices( std::ostream& os, const MeshLib::Element& elem, diff --git a/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.h b/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.h index 671d043dfd9..0d181efff84 100644 --- a/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.h +++ b/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.h @@ -112,20 +112,6 @@ private: /// interpolation void renumberNodeIndices(const bool is_mixed_high_order_linear_elems); - /*! - \brief Get integer variables, which are used to define an element - \param elem Element - \param local_node_ids Local node indices of a partition - \param elem_info A vector holds all integer variables of - element definitions - \param counter Recorder of the number of integer variables. - */ - void getElementIntegerVariables( - const MeshLib::Element& elem, - const std::vector<IntegerType>& local_node_ids, - std::vector<IntegerType>& elem_info, - IntegerType& counter); - void writeNodePropertiesBinary(std::string const& file_name_base) const; void writeCellPropertiesBinary(std::string const& file_name_base) const; -- GitLab