diff --git a/MeshLib/ComponentSelector.h b/MeshLib/ComponentSelector.h deleted file mode 100644 index 317a0e87cab9cb1cb6ff9bc0652fc274db6a8398..0000000000000000000000000000000000000000 --- a/MeshLib/ComponentSelector.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * \copyright - * Copyright (c) 2012-2015, OpenGeoSys Community (http://www.opengeosys.org) - * Distributed under a Modified BSD License. - * See accompanying file LICENSE.txt or - * http://www.opengeosys.org/project/license - * - */ - -#ifndef MESHLIB_COMPONENTSELECTOR_H_ -#define MESHLIB_COMPONENTSELECTOR_H_ - -namespace MeshLib -{ - - -/// Create a vector of unique nodes used by given elements. -inline -std::vector<MeshLib::Node*> -selectNodes(std::vector<MeshLib::Element*> const& elements) -{ - std::set<MeshLib::Node*> nodes_set; - for (auto e : elements) - { - MeshLib::Node* const* nodes = e->getNodes(); - unsigned const nnodes = e->getNNodes(); - nodes_set.insert(nodes, nodes + nnodes); - } - - std::vector<MeshLib::Node*> nodes; - nodes.reserve(nodes_set.size()); - - std::move(nodes_set.cbegin(), nodes_set.cend(), - std::back_inserter(nodes)); - - return nodes; -} - -} // namespace MeshLib - -#endif // MESHLIB_COMPONENTSELECTOR_H_ diff --git a/MeshLib/MeshSearcher.cpp b/MeshLib/MeshSearcher.cpp index ea642c81bed9d741e48dfaa84ecd1e850acffcc5..1fb7e6f38f1230d1116183e6d75fda4557edb54a 100644 --- a/MeshLib/MeshSearcher.cpp +++ b/MeshLib/MeshSearcher.cpp @@ -49,5 +49,25 @@ std::vector<std::size_t> getConnectedNodeIDs(const std::vector<MeshLib::Element* return connected_nodes; } +std::vector<Node*> +selectNodes(std::vector<Element*> const& elements) +{ + std::set<Node*> nodes_set; + for (auto e : elements) + { + Node* const* nodes = e->getNodes(); + unsigned const nnodes = e->getNNodes(); + nodes_set.insert(nodes, nodes + nnodes); + } + + std::vector<Node*> nodes; + nodes.reserve(nodes_set.size()); + + std::move(nodes_set.cbegin(), nodes_set.cend(), + std::back_inserter(nodes)); + + return nodes; +} + } // end namespace MeshLib diff --git a/MeshLib/MeshSearcher.h b/MeshLib/MeshSearcher.h index 130d92b145cc5ff3050b9218d969511016e9bf3c..1a211880d7336cb211c6c854fea963718caa99fe 100644 --- a/MeshLib/MeshSearcher.h +++ b/MeshLib/MeshSearcher.h @@ -18,6 +18,7 @@ namespace MeshLib // forward declarations class Mesh; class Element; +class Node; /** * get a vector of elements connected to given nodes @@ -34,6 +35,9 @@ std::vector<std::size_t> getConnectedElementIDs(MeshLib::Mesh const& msh, const */ std::vector<std::size_t> getConnectedNodeIDs(const std::vector<MeshLib::Element*> &elements); +/// Create a vector of unique nodes used by given elements. +std::vector<Node*> selectNodes(std::vector<Element*> const& elements); + } // end namespace MeshLib #endif //MESHSEARCHER_H_ diff --git a/Tests/AssemblerLib/LocalToGlobalIndexMap.cpp b/Tests/AssemblerLib/LocalToGlobalIndexMap.cpp index cd09666aab8b7de9054162502141d1a8c2a4282a..32cadbdfce79f41a9b21801c45c846a90dee0cec 100644 --- a/Tests/AssemblerLib/LocalToGlobalIndexMap.cpp +++ b/Tests/AssemblerLib/LocalToGlobalIndexMap.cpp @@ -14,7 +14,7 @@ #include "AssemblerLib/LocalToGlobalIndexMap.h" #include "MeshLib/MeshGenerators/MeshGenerator.h" -#include "MeshLib/ComponentSelector.h" +#include "MeshLib/MeshSearcher.h" #include "MeshLib/MeshSubsets.h" #include "MeshLib/Mesh.h"