Wildmeshing Toolkit
transfer_attribute.cpp
Go to the documentation of this file.
1 
2 #include "transfer_attribute.hpp"
3 #include <string>
4 #include <wmtk/Mesh.hpp>
6 
7 namespace wmtk::multimesh::utils {
9  const wmtk::attribute::MeshAttributeHandle& original_handle,
10  Mesh& m)
11 {
12  const std::string name = original_handle.mesh().get_attribute_name(original_handle.handle());
13  return transfer_attribute(original_handle, m, name);
14 }
15 
17  const wmtk::attribute::MeshAttributeHandle& original_handle,
18  Mesh& m,
19  const std::string& new_attribute_name)
20 {
21  return std::visit(
22  [&](const auto& h) {
23  using T = typename std::decay_t<decltype(h)>::Type;
24  return wmtk::utils::cast_attribute<T>(original_handle, m, new_attribute_name);
25  },
26 
27  original_handle.handle());
28 }
29 } // namespace wmtk::multimesh::utils
std::string get_attribute_name(const TypedAttributeHandle< T > &handle) const
Definition: Mesh.hpp:950
wmtk::attribute::MeshAttributeHandle transfer_attribute(const wmtk::attribute::MeshAttributeHandle &original_handle, Mesh &m)