16#include <lagrange/Mesh.h>
17#include <lagrange/MeshTrait.h>
18#include <lagrange/common.h>
19#include <lagrange/legacy/inline.h>
20#include <lagrange/utils/safe_cast.h>
33template <
typename MeshType1,
typename MeshType2>
34void map_facet_attributes(
35 const MeshType1& from,
37 const std::vector<typename MeshType1::Index>& facet_map = {})
39 static_assert(MeshTrait<MeshType1>::is_mesh(),
"Input type is not Mesh");
40 static_assert(MeshTrait<MeshType2>::is_mesh(),
"Input type is not Mesh");
41 using Index =
typename MeshType1::Index;
43 facet_map.empty() ||
safe_cast<Index>(facet_map.size()) == to.get_num_facets());
45 const auto& facet_attributes = from.get_facet_attribute_names();
46 const auto num_facets = to.get_num_facets();
48 for (
const auto& name : facet_attributes) {
49 auto attr = from.get_facet_attribute_array(name);
50 to.add_facet_attribute(name);
53 to.set_facet_attribute_array(name, std::move(attr2));
56 to.set_facet_attribute_array(name, std::move(attr2));
#define la_runtime_assert(...)
Runtime assertion check.
Definition assert.h:174
constexpr auto safe_cast(SourceType value) -> std::enable_if_t<!std::is_same< SourceType, TargetType >::value, TargetType >
Perform safe cast from SourceType to TargetType, where "safe" means:
Definition safe_cast.h:50
Main namespace for Lagrange.
std::shared_ptr< T > to_shared_ptr(std::unique_ptr< T > &&ptr)
Helper for automatic type deduction for unique_ptr to shared_ptr conversion.
Definition common.h:88