6 #include "..//MeshCollection.hpp"
7 #include "../NamedMultiMesh.hpp"
21 #if defined(WMTK_ENABLED_CPP20)
23 auto tmp = std::ranges::views::split(attribute_path,
"/"sv) |
24 std::views::transform([](
const auto& r) noexcept -> std::string_view {
25 return std::string_view(r.begin(), r.end());
28 std::array<std::string_view, 2> ret;
29 std::ranges::copy(tmp, ret.begin());
31 std::swap(ret[0], ret[1]);
36 std::array<std::string, 2> ret;
37 std::vector<std::string> tmp;
38 if (attribute_path.empty()) {
43 std::string v = std::string(attribute_path);
44 std::istringstream iss(v);
46 if (v.size() > 0 && v[0] ==
'/') {
49 while (std::getline(iss, token,
'/')) {
50 if (!token.empty()) tmp.emplace_back(token);
53 assert(tmp.size() <= 2);
54 if (tmp.size() == 1) {
58 return std::array<std::string, 2>{{tmp[0], tmp[1]}};
77 wmtk::attribute ::attribute_type_enum_from_type<T>());
83 const std::string_view& name,
91 return get_attribute<wmtk::attribute::type_from_attribute_type_enum_t<TYPE>>( \
100 default: assert(
false);
106 const std::string_view& name,
107 std::optional<PrimitiveType> pt,
108 std::optional<wmtk::attribute::AttributeType> type)
112 constexpr
static std::array<AT, 4> types{{AT::Char, AT::Int64, AT::Double,
AT::Rational}};
114 std::vector<AttributeDescription> possibilities;
122 if (pt.has_value() && type.has_value()) {
123 add_option(pt.value(), type.value());
125 }
else if (pt.has_value()) {
126 for (
AT at : types) {
128 add_option(pt.value(), at);
133 }
else if (type.has_value()) {
136 add_option(p, type.value());
142 for (
AT at : types) {
154 if (possibilities.empty()) {
156 }
else if (possibilities.size() > 1) {
attribute::MeshAttributeHandle get_attribute_handle(const std::string &name, const PrimitiveType ptype) const
bool has_attribute(const std::string &name, const PrimitiveType ptype) const
PrimitiveType top_simplex_type() const
const Mesh & get_mesh(const std::string_view &path) const
Mesh & get_mesh(const std::string_view &path) const
static attribute_ambiguous_error make(const std::vector< AttributeDescription > &possiblities, Args &&... args)
static attribute_missing_error make(Args &&... args)
auto decompose_attribute_path(std::string_view attribute_path)
wmtk::attribute::MeshAttributeHandle get_attribute(const Mesh &mesh, const std::string_view &name, PrimitiveType pt)
std::vector< PrimitiveType > primitive_below(PrimitiveType pt, bool lower_to_upper)
constexpr int8_t get_primitive_type_id(PrimitiveType t)
Get a unique integer id corresponding to each primitive type.
std::optional< PrimitiveType > primitive_type() const
std::optional< attribute::AttributeType > type