Skip to content
Snippets Groups Projects
Commit b3b7d823 authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

[MeL] Add getBaseNodes() collecting nodes from elements.

The vector is filled with pointers to base nodes.
parent f9c11d78
No related branches found
No related tags found
No related merge requests found
/**
* \copyright
* Copyright (c) 2012-2016, 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_ELEMENTS_UTILS_H_
#define MESHLIB_ELEMENTS_UTILS_H_
#include <algorithm>
#include <vector>
#include "BaseLib/makeVectorUnique.h"
#include "MeshLib/Node.h"
#include "Element.h"
namespace MeshLib
{
/// Returns a vector of node pointers containing the base nodes of the elements
/// input vector.
inline std::vector<Node*> getBaseNodes(std::vector<Element*> const& elements)
{
std::vector<Node*> base_nodes;
base_nodes.reserve(elements.size() * 2); // Save some of the realloctions.
for (auto* const e : elements)
{
std::copy(e->getNodes(), e->getNodes() + e->getNumberOfBaseNodes(),
std::back_inserter(base_nodes));
}
BaseLib::makeVectorUnique(base_nodes);
return base_nodes;
}
} // namespace MeshLib
#endif // MESHLIB_ELEMENTS_UTILS_H_
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment