OGS
anonymous_namespace{MeshUtils.cpp} Namespace Reference

Functions

std::vector< MeshLib::Element * > extractOneDimensionalElements (std::vector< MeshLib::Element * > const &elements)
 
std::vector< int > getUniqueMaterialIds (std::vector< int > const &material_ids, std::vector< MeshLib::Element * > const &elements)
 

Function Documentation

◆ extractOneDimensionalElements()

std::vector< MeshLib::Element * > anonymous_namespace{MeshUtils.cpp}::extractOneDimensionalElements ( std::vector< MeshLib::Element * > const & elements)

Definition at line 22 of file MeshUtils.cpp.

24{
25 std::vector<MeshLib::Element*> one_dimensional_elements;
26
27 copy_if(
28 begin(elements), end(elements), back_inserter(one_dimensional_elements),
29 [](MeshLib::Element const* const e) { return e->getDimension() == 1; });
30
31 return one_dimensional_elements;
32}
virtual constexpr unsigned getDimension() const =0
Get dimension of the mesh element.

References MeshLib::Element::getDimension().

◆ getUniqueMaterialIds()

std::vector< int > anonymous_namespace{MeshUtils.cpp}::getUniqueMaterialIds ( std::vector< int > const & material_ids,
std::vector< MeshLib::Element * > const & elements )

Definition at line 34 of file MeshUtils.cpp.

37{
38 std::set<int> unique_material_ids;
39 std::transform(begin(elements), end(elements),
40 inserter(unique_material_ids, end(unique_material_ids)),
41 [&material_ids](MeshLib::Element const* const e)
42 { return material_ids[e->getID()]; });
43 return {begin(unique_material_ids), end(unique_material_ids)};
44}
std::size_t getID() const
Returns the ID of the element.
Definition Element.h:89

References MeshLib::Element::getID().