diff --git a/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp b/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp index b958f2faf3e25f288980ce68e194f70642d76f19..176d94b97ee78569fb588a53684a05aad39c0448 100644 --- a/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp +++ b/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp @@ -309,20 +309,6 @@ void NodeWiseMeshPartitioner::renumberNodeIndices( } } -NodeWiseMeshPartitioner::IntegerType -NodeWiseMeshPartitioner::getNumberOfIntegerVariablesOfElements( - const std::vector<const MeshLib::Element*>& elements) const -{ - // Element ID, element type, and number of the nodes of - // an element of all elements in the current partition. - IntegerType nmb_element_idxs = 3 * elements.size(); - for (const auto* elem : elements) - { - nmb_element_idxs += elem->getNumberOfNodes(); - } - return nmb_element_idxs; -} - void NodeWiseMeshPartitioner::writeNodePropertiesBinary( const std::string& file_name_base) const { @@ -442,6 +428,21 @@ void NodeWiseMeshPartitioner::writeCellPropertiesBinary( out.close(); } + +/// Calculate the total number of integer variables of an element vector. Each +/// element has three integer variables for element ID, element type, number of +/// nodes of the element. Therefore the total number of the integers in an +/// element vector is 3 * vector size + sum (number of nodes of each element) +NodeWiseMeshPartitioner::IntegerType getNumberOfIntegerVariablesOfElements( + std::vector<const MeshLib::Element*> const& elements) +{ + return 3 * elements.size() + + std::accumulate(begin(elements), end(elements), 0, + [](auto const nnodes, auto const* e) { + return nnodes + e->getNumberOfNodes(); + }); +} + std::tuple<std::vector<NodeWiseMeshPartitioner::IntegerType>, std::vector<NodeWiseMeshPartitioner::IntegerType>> NodeWiseMeshPartitioner::writeConfigDataBinary( diff --git a/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.h b/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.h index 648ce9479e759e7b8a15bc9bd0c176b5830a40cb..671d043dfd98009424f9afbbd45d0d23900d1382 100644 --- a/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.h +++ b/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.h @@ -112,16 +112,6 @@ private: /// interpolation void renumberNodeIndices(const bool is_mixed_high_order_linear_elems); - /*! - Calculate the total number of integer variables of an element - vector. Each element has three integer variables for element ID, - element type, number of nodes of the element. Therefore - the total number of the integers in an element vector is - 3 * vector size + sum (number of nodes of each element) - */ - IntegerType getNumberOfIntegerVariablesOfElements( - const std::vector<const MeshLib::Element*>& elements) const; - /*! \brief Get integer variables, which are used to define an element \param elem Element