OGS
MeshToolsLib::details Namespace Reference

Functions

std::vector< MeshLib::Element * > excludeElementCopy (std::vector< MeshLib::Element * > const &vec_src_eles, std::vector< std::size_t > const &vec_removed)
 

Function Documentation

◆ excludeElementCopy()

std::vector< MeshLib::Element * > MeshToolsLib::details::excludeElementCopy ( std::vector< MeshLib::Element * > const & vec_src_eles,
std::vector< std::size_t > const & vec_removed )

Definition at line 23 of file RemoveMeshComponents.cpp.

26{
27 std::vector<MeshLib::Element*> vec_dest_eles(vec_src_eles.size() -
28 vec_removed.size());
29
30 unsigned cnt(0);
31 for (std::size_t i = 0; i < vec_removed[0]; ++i)
32 {
33 vec_dest_eles[cnt++] = vec_src_eles[i];
34 }
35 for (std::size_t i = 1; i < vec_removed.size(); ++i)
36 {
37 for (std::size_t j = vec_removed[i - 1] + 1; j < vec_removed[i]; ++j)
38 {
39 vec_dest_eles[cnt++] = vec_src_eles[j];
40 }
41 }
42 for (std::size_t i = vec_removed.back() + 1; i < vec_src_eles.size(); ++i)
43 {
44 vec_dest_eles[cnt++] = vec_src_eles[i];
45 }
46
47 return vec_dest_eles;
48}

Referenced by MeshToolsLib::removeElements().