24 std::vector<MeshLib::Element*>
const& vec_src_eles,
25 std::vector<std::size_t>
const& vec_removed)
27 std::vector<MeshLib::Element*> vec_dest_eles(vec_src_eles.size() -
31 for (std::size_t i = 0; i < vec_removed[0]; ++i)
33 vec_dest_eles[cnt++] = vec_src_eles[i];
35 for (std::size_t i = 1; i < vec_removed.size(); ++i)
37 for (std::size_t j = vec_removed[i - 1] + 1; j < vec_removed[i]; ++j)
39 vec_dest_eles[cnt++] = vec_src_eles[j];
42 for (std::size_t i = vec_removed.back() + 1; i < vec_src_eles.size(); ++i)
44 vec_dest_eles[cnt++] = vec_src_eles[i];
54 const std::vector<std::size_t>& removed_element_ids,
55 const std::string& new_mesh_name)
57 if (removed_element_ids.empty())
59 INFO(
"No elements to remove");
63 INFO(
"Removing total {:d} elements...", removed_element_ids.size());
64 std::vector<MeshLib::Element*> tmp_elems =
66 INFO(
"{:d} elements remain in mesh.", tmp_elems.size());
69 std::vector<MeshLib::Node*> new_nodes =
71 std::vector<MeshLib::Element*> new_elems =
78 INFO(
"Removing total {:d} nodes...", removed_node_ids.size());
79 for (
auto nodeid : removed_node_ids)
81 delete new_nodes[nodeid];
82 new_nodes[nodeid] =
nullptr;
84 new_nodes.erase(std::remove(new_nodes.begin(), new_nodes.end(),
nullptr),
87 if (!new_elems.empty())
92 removed_element_ids, removed_node_ids));
96 INFO(
"Current selection removes all elements.");
101 std::vector<Node*>
const& nodes)
103 std::vector<bool> unused_nodes(nodes.size(),
true);
104 for (
auto e : elements)
106 for (
unsigned i = 0; i < e->getNumberOfNodes(); i++)
116 std::vector<Node*>& nodes)
118 assert(nodes_to_delete.size() == nodes.size());
120 for (std::size_t i = 0; i < nodes.size(); i++)
122 if (nodes_to_delete[i])
128 nodes.erase(remove(begin(nodes), end(nodes),
nullptr), end(nodes));
132 const std::vector<std::size_t>& del_nodes_idx,
133 const std::string& new_mesh_name)
135 if (del_nodes_idx.empty())
141 std::vector<MeshLib::Node*> new_nodes =
143 std::vector<MeshLib::Element*> new_elems =
150 for (
auto eid : removed_element_ids)
152 delete new_elems[eid];
153 new_elems[eid] =
nullptr;
155 new_elems.erase(std::remove(new_elems.begin(), new_elems.end(),
nullptr),
159 std::vector<bool>
const node_delete_flag =
165 if (!new_elems.empty())
170 removed_element_ids, del_nodes_idx));
Definition of Duplicate functions.
Definition of the Element class.
void INFO(char const *fmt, Args const &... args)
Definition of the Node class.
std::size_t searchByNodeIDs(const std::vector< std::size_t > &nodes)
Marks all elements connecting to any of the given nodes.
const std::vector< std::size_t > & getSearchedElementIDs() const
return marked elements
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Properties & getProperties()
std::size_t searchNodesConnectedToOnlyGivenElements(const std::vector< std::size_t > &elements)
const std::vector< std::size_t > & getSearchedNodeIDs() const
return marked node IDs
Properties excludeCopyProperties(std::vector< std::size_t > const &exclude_elem_ids, std::vector< std::size_t > const &exclude_node_ids) const
std::vector< MeshLib::Element * > excludeElementCopy(std::vector< MeshLib::Element * > const &vec_src_eles, std::vector< std::size_t > const &vec_removed)
MeshLib::Mesh * removeElements(const MeshLib::Mesh &mesh, const std::vector< std::size_t > &removed_element_ids, const std::string &new_mesh_name)
std::vector< Node * > copyNodeVector(const std::vector< Node * > &nodes)
Creates a deep copy of a Node vector.
std::size_t getNodeIndex(Element const &element, unsigned const idx)
std::vector< bool > markUnusedNodes(std::vector< Element * > const &elements, std::vector< Node * > const &nodes)
Marks nodes not used by any of the elements.
MeshLib::Mesh * removeNodes(const MeshLib::Mesh &mesh, const std::vector< std::size_t > &del_nodes_idx, const std::string &new_mesh_name)
void removeMarkedNodes(std::vector< bool > const &nodes_to_delete, std::vector< Node * > &nodes)
Deallocates and removes nodes marked true.
std::vector< Element * > copyElementVector(std::vector< Element * > const &elements, std::vector< Node * > const &new_nodes, std::vector< std::size_t > const *const node_id_map)