Lagrange
find_attribute_utils.h
1/*
2 * Copyright 2022 Adobe. All rights reserved.
3 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License. You may obtain a copy
5 * of the License at http://www.apache.org/licenses/LICENSE-2.0
6 *
7 * Unless required by applicable law or agreed to in writing, software distributed under
8 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9 * OF ANY KIND, either express or implied. See the License for the specific language
10 * governing permissions and limitations under the License.
11 */
12#pragma once
13
14#include <lagrange/SurfaceMesh.h>
15#include <lagrange/utils/BitField.h>
16#include <lagrange/utils/span.h>
17
18#include <string_view>
19
20namespace lagrange::internal {
21
22enum class ResetToDefault { Yes, No };
23
42template <typename ExpectedValueType, typename Scalar, typename Index>
45 std::string_view name,
46 BitField<AttributeElement> expected_element,
47 AttributeUsage expected_usage,
48 size_t expected_channels);
49
69template <typename ExpectedValueType, typename Scalar, typename Index>
72 span<const AttributeId> selected_ids,
73 BitField<AttributeElement> expected_element,
74 AttributeUsage expected_usage,
75 size_t expected_channels);
76
93template <typename ExpectedValueType, typename Scalar, typename Index>
96 std::string_view name,
97 BitField<AttributeElement> expected_element,
98 AttributeUsage expected_usage,
99 size_t expected_channels);
100
119template <typename ExpectedValueType, typename Scalar, typename Index>
122 std::string_view name,
123 AttributeElement expected_element,
124 AttributeUsage expected_usage,
125 size_t expected_channels,
126 ResetToDefault reset_tag);
127
128} // namespace lagrange::internal
A general purpose polygonal mesh class.
Definition: SurfaceMesh.h:66
uint32_t AttributeId
Identified to be used to access an attribute.
Definition: AttributeFwd.h:73
AttributeUsage
Usage tag indicating how the attribute should behave under mesh transformations.
Definition: AttributeFwd.h:54
AttributeElement
Type of element to which the attribute is attached.
Definition: AttributeFwd.h:26
nullptr_t, size_t, ptrdiff_t basic_ostream bad_weak_ptr extent, remove_extent, is_array,...
Definition: attribute_string_utils.h:21
AttributeId find_attribute(const SurfaceMesh< Scalar, Index > &mesh, std::string_view name, BitField< AttributeElement > expected_element, AttributeUsage expected_usage, size_t expected_channels)
Find an attribute with a given name, ensuring the usage and element type match an expected target.
Definition: find_attribute_utils.cpp:144
AttributeId find_matching_attribute(const SurfaceMesh< Scalar, Index > &mesh, std::string_view name, BitField< AttributeElement > expected_element, AttributeUsage expected_usage, size_t expected_channels)
Find an attribute with a given name, ensuring the usage and element type match an expected target.
Definition: find_attribute_utils.cpp:82
AttributeId find_or_create_attribute(SurfaceMesh< Scalar, Index > &mesh, std::string_view name, AttributeElement expected_element, AttributeUsage expected_usage, size_t expected_channels, ResetToDefault reset_tag)
Either retrieve or create an attribute with a prescribed name, element type and usage.
Definition: find_attribute_utils.cpp:168