23 const std::vector<std::size_t>& removed_element_ids,
24 const std::string& new_mesh_name)
26 if (removed_element_ids.empty())
28 INFO(
"No elements to remove");
32 INFO(
"Removing total {:d} elements...", removed_element_ids.size());
33 std::vector<MeshLib::Element*> tmp_elems =
35 INFO(
"{:d} elements remain in mesh.", tmp_elems.size());
38 std::vector<MeshLib::Node*> new_nodes =
40 std::vector<MeshLib::Element*> new_elems =
47 INFO(
"Removing total {:d} nodes...", removed_node_ids.size());
48 for (
auto nodeid : removed_node_ids)
50 delete new_nodes[nodeid];
51 new_nodes[nodeid] =
nullptr;
53 new_nodes.erase(std::remove(new_nodes.begin(), new_nodes.end(),
nullptr),
56 if (!new_elems.empty())
62 removed_element_ids, removed_node_ids));
66 INFO(
"Current selection removes all elements.");
71 std::vector<MeshLib::Element*>
const& elements,
72 std::vector<MeshLib::Node*>
const& nodes)
74 std::vector<bool> unused_nodes(nodes.size(),
true);
75 for (
auto e : elements)
77 for (
unsigned i = 0; i < e->getNumberOfNodes(); i++)
79 unused_nodes[getNodeIndex(*e, i)] =
false;
87 std::vector<MeshLib::Node*>& nodes)
89 assert(nodes_to_delete.size() == nodes.size());
91 for (std::size_t i = 0; i < nodes.size(); i++)
93 if (nodes_to_delete[i])
99 nodes.erase(remove(begin(nodes), end(nodes),
nullptr), end(nodes));
103 const std::vector<std::size_t>& del_nodes_idx,
104 const std::string& new_mesh_name)
106 if (del_nodes_idx.empty())
112 std::vector<MeshLib::Node*> new_nodes =
114 std::vector<MeshLib::Element*> new_elems =
121 for (
auto eid : removed_element_ids)
123 delete new_elems[eid];
124 new_elems[eid] =
nullptr;
126 new_elems.erase(std::remove(new_elems.begin(), new_elems.end(),
nullptr),
130 std::vector<bool>
const node_delete_flag =
136 if (!new_elems.empty())
142 removed_element_ids, del_nodes_idx));
Definition of Duplicate functions.
Definition of the Element class.
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition of the Node class.
const std::vector< std::size_t > & getSearchedElementIDs() const
return marked elements
std::size_t searchByNodeIDs(const std::vector< std::size_t > &nodes)
Marks all elements connecting to any of the given nodes.
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< T > excludeObjectCopy(std::vector< T > const &src_vec, std::vector< std::size_t > const &exclude_positions)
std::vector< Node * > copyNodeVector(const std::vector< Node * > &nodes)
Creates a deep copy of a Node vector.
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)