Iterating over mesh attributes.
More...
|
| template<std::underlying_type_t< AttributeElement > mask = BitField<AttributeElement>::all(), typename Visitor, typename Scalar, typename Index> |
| void | seq_foreach_named_attribute_read (const SurfaceMesh< Scalar, Index > &mesh, Visitor &&vis) |
| | Applies a function to each attribute of a mesh.
|
| |
| template<std::underlying_type_t< AttributeElement > mask = BitField<AttributeElement>::all(), typename Visitor, typename Scalar, typename Index> |
| void | seq_foreach_attribute_read (const SurfaceMesh< Scalar, Index > &mesh, Visitor &&vis) |
| | Applies a function to each attribute of a mesh.
|
| |
|
| template<std::underlying_type_t< AttributeElement > mask = BitField<AttributeElement>::all(), typename Visitor, typename Scalar, typename Index> |
| void | seq_foreach_named_attribute_write (SurfaceMesh< Scalar, Index > &mesh, Visitor &&vis) |
| | Applies a function to each attribute of a mesh.
|
| |
| template<std::underlying_type_t< AttributeElement > mask = BitField<AttributeElement>::all(), typename Visitor, typename Scalar, typename Index> |
| void | seq_foreach_attribute_write (SurfaceMesh< Scalar, Index > &mesh, Visitor &&vis) |
| | Applies a function to each attribute of a mesh.
|
| |
|
| template<std::underlying_type_t< AttributeElement > mask = BitField<AttributeElement>::all(), typename Visitor, typename Scalar, typename Index> |
| void | par_foreach_named_attribute_read (const SurfaceMesh< Scalar, Index > &mesh, Visitor &&vis) |
| | Applies a function in parallel to each attribute of a mesh.
|
| |
| template<std::underlying_type_t< AttributeElement > mask = BitField<AttributeElement>::all(), typename Visitor, typename Scalar, typename Index> |
| void | par_foreach_attribute_read (const SurfaceMesh< Scalar, Index > &mesh, Visitor &&vis) |
| | Applies a function in parallel to each attribute of a mesh.
|
| |
|
| template<std::underlying_type_t< AttributeElement > mask = BitField<AttributeElement>::all(), typename Visitor, typename Scalar, typename Index> |
| void | par_foreach_named_attribute_write (SurfaceMesh< Scalar, Index > &mesh, Visitor &&vis) |
| | Applies a function in parallel to each attribute of a mesh.
|
| |
| template<std::underlying_type_t< AttributeElement > mask = BitField<AttributeElement>::all(), typename Visitor, typename Scalar, typename Index> |
| void | par_foreach_attribute_write (SurfaceMesh< Scalar, Index > &mesh, Visitor &&vis) |
| | Applies a function in parallel to each attribute of a mesh.
|
| |
Iterating over mesh attributes.
These utility functions use generic lambdas to iterate over mesh attributes of different types. Because a generic lambda is templated, the type of each attribute is accessible at compile type within the lambda function:
using AttributeType = std::decay_t<decltype(attr)>;
using ValueType = typename AttributeType::ValueType;
lagrange::logger().info(
"Mesh attribute value type has size {}",
sizeof(ValueType));
});
LA_CORE_API spdlog::logger & logger()
Retrieves the current logger.
Definition Logger.cpp:40
void seq_foreach_attribute_read(const SurfaceMesh< Scalar, Index > &mesh, Visitor &&vis)
Applies a function to each attribute of a mesh.
Definition foreach_attribute.h:233
To iterate over mesh attributes while accessing their names, use the named_ variants:
"Mesh attribute named '{} with {} rows', name, attr.get_num_elements()");
});
void seq_foreach_named_attribute_read(const SurfaceMesh< Scalar, Index > &mesh, Visitor &&vis)
Applies a function to each attribute of a mesh.
Definition foreach_attribute.h:208
There are read and write variants of the functions above, depending on what type of access is needed over the mesh attributes. Finally, the par_* variants call the visitor function in parallel for each mesh attribute.
◆ seq_foreach_named_attribute_read()
template<std::underlying_type_t<
AttributeElement > mask = BitField<AttributeElement>::all(), typename Visitor, typename
Scalar, typename Index>
| void seq_foreach_named_attribute_read |
( |
const SurfaceMesh< Scalar, Index > & | mesh, |
|
|
Visitor && | vis ) |
#include <lagrange/foreach_attribute.h>
Applies a function to each attribute of a mesh.
The visitor function iterates over a pair of (name x attribute).
- Parameters
-
| [in] | mesh | Mesh on whose attribute to apply the visitor function. |
| [in] | vis | Visitor function to apply to each mesh attribute. Typically a generic lambda. |
- Template Parameters
-
| mask | Bit field mask to filter attribute based on their element types. |
| Visitor | Type of the visitor function, which should be template<typename T> void(std::string_view, const Attribute<T> &); |
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |
◆ seq_foreach_attribute_read()
template<std::underlying_type_t<
AttributeElement > mask = BitField<AttributeElement>::all(), typename Visitor, typename
Scalar, typename Index>
| void seq_foreach_attribute_read |
( |
const SurfaceMesh< Scalar, Index > & | mesh, |
|
|
Visitor && | vis ) |
#include <lagrange/foreach_attribute.h>
Applies a function to each attribute of a mesh.
- Parameters
-
| [in] | mesh | Mesh on whose attribute to apply the visitor function. |
| [in] | vis | Visitor function to apply to each mesh attribute. Typically a generic lambda. |
- Template Parameters
-
| mask | Bit field mask to filter attribute based on their element types. |
| Visitor | Type of the visitor function, which should be template<typename T> void(const Attribute<T> &); |
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |
◆ seq_foreach_named_attribute_write()
template<std::underlying_type_t<
AttributeElement > mask = BitField<AttributeElement>::all(), typename Visitor, typename
Scalar, typename Index>
| void seq_foreach_named_attribute_write |
( |
SurfaceMesh< Scalar, Index > & | mesh, |
|
|
Visitor && | vis ) |
#include <lagrange/foreach_attribute.h>
Applies a function to each attribute of a mesh.
The visitor function iterates over a pair of (name x attribute). In this variant, the attribute is passed as a writable reference to the visitor function.
- Parameters
-
| [in] | mesh | Mesh on whose attribute to apply the visitor function. |
| [in] | vis | Visitor function to apply to each mesh attribute. Typically a generic lambda. |
- Template Parameters
-
| mask | Bit field mask to filter attribute based on their element types. |
| Visitor | Type of the visitor function, which should be template<typename T> void(std::string_view, const Attribute<T> &); |
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |
◆ seq_foreach_attribute_write()
template<std::underlying_type_t<
AttributeElement > mask = BitField<AttributeElement>::all(), typename Visitor, typename
Scalar, typename Index>
| void seq_foreach_attribute_write |
( |
SurfaceMesh< Scalar, Index > & | mesh, |
|
|
Visitor && | vis ) |
#include <lagrange/foreach_attribute.h>
Applies a function to each attribute of a mesh.
In this variant, the attribute is passed as a writable reference to the visitor function.
- Parameters
-
| [in,out] | mesh | Mesh on whose attribute to apply the visitor function. |
| [in] | vis | Visitor function to apply to each mesh attribute. Typically a generic lambda. |
- Template Parameters
-
| mask | Bit field mask to filter attribute based on their element types. |
| Visitor | Type of the visitor function, which should be template<typename T> void(Attribute<T> &); |
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |
◆ par_foreach_named_attribute_read()
template<std::underlying_type_t<
AttributeElement > mask = BitField<AttributeElement>::all(), typename Visitor, typename
Scalar, typename Index>
| void par_foreach_named_attribute_read |
( |
const SurfaceMesh< Scalar, Index > & | mesh, |
|
|
Visitor && | vis ) |
#include <lagrange/foreach_attribute.h>
Applies a function in parallel to each attribute of a mesh.
The visitor function iterates over a pair of (name x attribute).
- Parameters
-
| [in] | mesh | Mesh on whose attribute to apply the visitor function. |
| [in] | vis | Visitor function to apply to each mesh attribute. Typically a generic lambda. |
- Template Parameters
-
| mask | Bit field mask to filter attribute based on their element types. |
| Visitor | Type of the visitor function, which should be template<typename T> void(std::string_view, const Attribute<T> &); |
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |
◆ par_foreach_attribute_read()
template<std::underlying_type_t<
AttributeElement > mask = BitField<AttributeElement>::all(), typename Visitor, typename
Scalar, typename Index>
| void par_foreach_attribute_read |
( |
const SurfaceMesh< Scalar, Index > & | mesh, |
|
|
Visitor && | vis ) |
#include <lagrange/foreach_attribute.h>
Applies a function in parallel to each attribute of a mesh.
- Parameters
-
| [in] | mesh | Mesh on whose attribute to apply the visitor function. |
| [in] | vis | Visitor function to apply to each mesh attribute. Typically a generic lambda. |
- Template Parameters
-
| mask | Bit field mask to filter attribute based on their element types. |
| Visitor | Type of the visitor function, which should be template<typename T> void(const Attribute<T> &); |
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |
◆ par_foreach_named_attribute_write()
template<std::underlying_type_t<
AttributeElement > mask = BitField<AttributeElement>::all(), typename Visitor, typename
Scalar, typename Index>
| void par_foreach_named_attribute_write |
( |
SurfaceMesh< Scalar, Index > & | mesh, |
|
|
Visitor && | vis ) |
#include <lagrange/foreach_attribute.h>
Applies a function in parallel to each attribute of a mesh.
The visitor function iterates over a pair of (name x attribute). In this variant, the attribute is passed as a writable reference to the visitor function.
- Parameters
-
| [in] | mesh | Mesh on whose attribute to apply the visitor function. |
| [in] | vis | Visitor function to apply to each mesh attribute. Typically a generic lambda. |
- Template Parameters
-
| mask | Bit field mask to filter attribute based on their element types. |
| Visitor | Type of the visitor function, which should be template<typename T> void(std::string_view, const Attribute<T> &); |
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |
◆ par_foreach_attribute_write()
template<std::underlying_type_t<
AttributeElement > mask = BitField<AttributeElement>::all(), typename Visitor, typename
Scalar, typename Index>
| void par_foreach_attribute_write |
( |
SurfaceMesh< Scalar, Index > & | mesh, |
|
|
Visitor && | vis ) |
#include <lagrange/foreach_attribute.h>
Applies a function in parallel to each attribute of a mesh.
In this variant, the attribute is passed as a writable reference to the visitor function.
- Parameters
-
| [in,out] | mesh | Mesh on whose attribute to apply the visitor function. |
| [in] | vis | Visitor function to apply to each mesh attribute. Typically a generic lambda. |
- Template Parameters
-
| mask | Bit field mask to filter attribute based on their element types. |
| Visitor | Type of the visitor function, which should be template<typename void(Attribute<T> &); |
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |