15#include <lagrange/SurfaceMesh.h>
16#include <lagrange/unify_index_buffer.h>
22template <
typename Scalar,
typename Index>
23bool involve_indexed_attribute(
24 const SurfaceMesh<Scalar, Index>& mesh,
27 if (attr_ids.empty()) {
28 bool has_indexed_attribute =
false;
30 if (has_indexed_attribute)
return;
34 has_indexed_attribute =
true;
37 return has_indexed_attribute;
39 for (
auto id : attr_ids) {
46template <
typename Scalar,
typename Index>
47std::tuple<SurfaceMesh<Scalar, Index>, std::vector<AttributeId>> remap_indexed_attributes(
48 const SurfaceMesh<Scalar, Index>& in_mesh,
51 std::vector<AttributeId> attr_ids(in_attr_ids.begin(), in_attr_ids.end());
59 auto name = in_mesh.get_attribute_name(id);
60 la_runtime_assert(mesh.has_attribute(name));
61 return mesh.get_attribute_id(name);
64 return {mesh, attr_ids};
std::string_view get_attribute_name(AttributeId id) const
Retrieve attribute name from its id.
Definition SurfaceMesh.cpp:355
bool is_attribute_indexed(std::string_view name) const
Determines whether the specified attribute is indexed.
Definition SurfaceMesh.cpp:1229
static bool attr_name_is_reserved(std::string_view name)
Check whether the given name corresponds to a reserved attribute.
Definition SurfaceMesh.cpp:1409
void seq_foreach_attribute_id(function_ref< void(AttributeId)> func) const
Iterates over all attribute ids sequentially.
Definition SurfaceMesh.cpp:1242
SurfaceMesh< Scalar, Index > unify_index_buffer(const SurfaceMesh< Scalar, Index > &mesh, const std::vector< AttributeId > &attribute_ids={})
Unify index buffers of the input mesh for all attributes specified in attribute_ids.
Definition unify_index_buffer.cpp:34
uint32_t AttributeId
Identified to be used to access an attribute.
Definition AttributeFwd.h:73
::nonstd::span< T, Extent > span
A bounds-safe view for sequences of objects.
Definition span.h:27
Mesh input/output.
Definition detect_file_format.h:18