29 std::vector<MeshLib::Node*> vec_new_nodes =
31 std::vector<MeshLib::Element*> vec_new_eles =
37 ? *(std::max_element(begin(*material_ids), end(*material_ids)))
40 std::vector<int> new_mat_ids;
41 const std::size_t n_ply(ply_vec.
size());
43 for (std::size_t k(0); k < n_ply; k++)
51 auto& vec_nodes_on_ply = mshNodesAlongPoly.
getNodeIDs();
52 if (vec_nodes_on_ply.empty())
56 INFO(
"No nodes found on polyline {:s}", ply_name);
61 for (std::size_t i = 0; i < vec_nodes_on_ply.size() - 1; i++)
63 std::array<MeshLib::Node*, 2> element_nodes;
64 element_nodes[0] = vec_new_nodes[vec_nodes_on_ply[i]];
65 element_nodes[1] = vec_new_nodes[vec_nodes_on_ply[i + 1]];
66 vec_new_eles.push_back(
68 new_mat_ids.push_back(max_matID + k + 1);
73 const std::string
name = mesh.
getName() +
"_with_lines";
75 std::make_unique<MeshLib::Mesh>(
name, vec_new_nodes, vec_new_eles);
76 auto new_material_ids =
77 new_mesh->getProperties().createNewPropertyVector<
int>(
79 if (!new_material_ids)
81 OGS_FATAL(
"Could not create MaterialIDs cell vector in new mesh.");
83 new_material_ids->reserve(new_mesh->getNumberOfElements());
84 if (material_ids !=
nullptr)
86 std::copy(begin(*material_ids), end(*material_ids),
87 std::back_inserter(*new_material_ids));
93 std::copy(begin(new_mat_ids), end(new_mat_ids),
94 std::back_inserter(*new_material_ids));
Definition of Duplicate functions.
Definition of the Element class.
Definition of the Line class.
void INFO(char const *fmt, Args const &... args)
Definition of mesh-related Enumerations.
Definition of the Mesh class.
Definition of the Node class.
Definition of the PolylineVec class.
Definition of the PolyLine class.
Class Polyline consists mainly of a reference to a point vector and a vector that stores the indices ...
The class TemplateVec takes a unique name and manages a std::vector of pointers to data elements of t...
const std::vector< T * > * getVector() const
bool getNameOfElementByID(std::size_t id, std::string &element_name) const
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
double getMinEdgeLength() const
Get the minimum edge length over all elements of the mesh.
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
const std::string getName() const
Get name of the mesh.
std::size_t getNumberOfElements() const
Get the number of elements.
void copy(PETScVector const &x, PETScVector &y)
std::vector< Node * > copyNodeVector(const std::vector< Node * > &nodes)
Creates a deep copy of a Node vector.
PropertyVector< int > const * materialIDs(Mesh const &mesh)
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)