Wildmeshing Toolkit
AttributeDescription.hpp
Go to the documentation of this file.
1 #pragma once
2 #include <compare>
3 #include <optional>
4 #include <wmtk/PrimitiveType.hpp>
7 
8 namespace wmtk::attribute {
10 }
11 
13 
14 
15 // the minimal information to uniquely extract an attribute handle
17 {
18  std::string path;
19  std::optional<uint8_t> dimension;
20  std::optional<attribute::AttributeType> type;
21 
22 
23  AttributeDescription() = default;
28  ~AttributeDescription() = default;
29 
31  const std::string_view& p,
32  const std::optional<uint8_t>& dim,
33  const std::optional<attribute::AttributeType>& t)
34  : path(p)
35  , dimension(dim)
36  , type(t)
37  {}
38 
40  const std::string_view& p,
41  const std::optional<PrimitiveType>& pt,
42  const std::optional<attribute::AttributeType>& t)
44  p,
45  pt.has_value() ? std::optional<uint8_t>{wmtk::get_primitive_type_id(pt.value())}
46  : std::optional<uint8_t>{},
47  t)
48  {}
49 
50 
51  std::optional<PrimitiveType> primitive_type() const;
52 
53  auto operator<=>(const AttributeDescription&) const -> std::strong_ordering;
54  auto operator==(const AttributeDescription&) const -> bool;
55 
56 
58 };
59 } // namespace wmtk::components::multimesh::utils
#define WMTK_NLOHMANN_JSON_FRIEND_DECLARATION(Type)
Definition: json_macros.hpp:6
#define WMTK_NLOHMANN_JSON_DECLARATION(Type)
Definition: json_macros.hpp:11
Definition: autodiff.h:995
constexpr int8_t get_primitive_type_id(PrimitiveType t)
Get a unique integer id corresponding to each primitive type.
AttributeDescription(const std::string_view &p, const std::optional< PrimitiveType > &pt, const std::optional< attribute::AttributeType > &t)
AttributeDescription(AttributeDescription &&)=default
AttributeDescription & operator=(AttributeDescription &&)=default
AttributeDescription & operator=(const AttributeDescription &)=default
auto operator==(const AttributeDescription &) const -> bool
AttributeDescription(const AttributeDescription &)=default
auto operator<=>(const AttributeDescription &) const -> std::strong_ordering
AttributeDescription(const std::string_view &p, const std::optional< uint8_t > &dim, const std::optional< attribute::AttributeType > &t)