30 template <
typename T_ELEMENT>
32 std::vector<MeshLib::Node*>
const& vec_new_nodes)
34 auto const n_base_nodes = T_ELEMENT::n_base_nodes;
38 auto const it = find_if(
39 begin(vec_new_nodes), end(vec_new_nodes),
45 if (it == end(vec_new_nodes))
48 "A base node {:d} (with original global node id {:d}) not "
49 "found in the list for element {:d}.",
54 return new T_ELEMENT(nodes);
60 MeshLib::Mesh const& org_mesh, std::string
const& new_mesh_name)
62 std::vector<MeshLib::Node*> vec_new_nodes =
66 std::vector<MeshLib::Element*> vec_new_eles;
71 vec_new_eles.push_back(
72 createLinearElement<MeshLib::Line>(e, vec_new_nodes));
76 vec_new_eles.push_back(
77 createLinearElement<MeshLib::Quad>(e, vec_new_nodes));
81 vec_new_eles.push_back(
82 createLinearElement<MeshLib::Tri>(e, vec_new_nodes));
86 vec_new_eles.push_back(
87 createLinearElement<MeshLib::Hex>(e, vec_new_nodes));
91 vec_new_eles.push_back(
92 createLinearElement<MeshLib::Tet>(e, vec_new_nodes));
96 OGS_FATAL(
"Mesh element type {:s} is not supported",
101 auto new_mesh = std::make_unique<MeshLib::Mesh>(
102 new_mesh_name, vec_new_nodes, vec_new_eles,
104 std::vector<MeshLib::MeshItemType>(1,
115 if (double_property ==
nullptr)
121 new_mesh->getProperties().createNewPropertyVector<
double>(
123 new_prop->resize(new_mesh->getNumberOfNodes() * n_src_comp);
128 for (
int j = 0; j < n_src_comp; j++)
130 (*new_prop)[i * n_src_comp + j] =
131 (*double_property)[i * n_src_comp + j];
Definition of Duplicate functions.
Definition of the Element class.
Definition of the Hex class.
Definition of the Line class.
Definition of the class Properties that implements a container of properties.
Definition of the Mesh class.
Definition of the Node class.
Definition of the Quad class.
Definition of the Tet class.
Definition of the Tri class.
std::size_t getID() const
virtual const Node * getNode(unsigned idx) const =0
virtual unsigned getNumberOfBaseNodes() const =0
virtual std::size_t getID() const final
Returns the ID of the element.
std::size_t getNumberOfBaseNodes() const
Get the number of base nodes.
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Properties & getProperties()
Properties excludeCopyProperties(std::vector< std::size_t > const &exclude_elem_ids, std::vector< std::size_t > const &exclude_node_ids) const
int getNumberOfGlobalComponents() const
T_ELEMENT * createLinearElement(MeshLib::Element const *e, std::vector< MeshLib::Node * > const &vec_new_nodes)
std::vector< Node * > copyNodeVector(const std::vector< Node * > &nodes)
Creates a deep copy of a Node vector.
std::string CellType2String(const CellType t)
Given a MeshElemType this returns the appropriate string.
std::unique_ptr< MeshLib::Mesh > convertToLinearMesh(MeshLib::Mesh const &org_mesh, std::string const &new_mesh_name)
std::vector< Node * > getBaseNodes(std::vector< Element * > const &elements)