3 #if defined(__cpp_concepts) && defined(__cpp_lib_ranges)
11 template <
typename T,
typename MeshType,
int Dim>
22 template <
typename Derived>
30 template <
typename U,
typename MeshType,
int Dim>
32 template <
int64_t cell_dimension,
typename NodeFunctor>
36 Derived&
derived() {
return static_cast<Derived&
>(*this); }
38 const Derived&
derived()
const {
return static_cast<const Derived&
>(*this); }
43 return derived().switch_tuple(tuple, type);
47 #if defined(__cpp_concepts) && defined(__cpp_lib_ranges)
48 template <std::ranges::forward_range ContainerType>
50 template <
typename ContainerType>
62 return derived().is_boundary(pt, tuple);
66 template <
typename T,
int Dim = Eigen::Dynamic>
73 template <
typename T,
int Dim = Eigen::Dynamic>
81 template <
typename T,
int Dim = Eigen::Dynamic>
85 assert(&handle.
mesh() ==
this);
86 assert(handle.
holds<T>());
87 return create_accessor<T, Dim>(handle.
as<T>());
92 template <
typename T,
int Dim = Eigen::Dynamic>
96 assert(&handle.
mesh() ==
this);
97 assert(handle.
holds<T>());
98 return create_const_accessor<T, Dim>(handle.
as<T>());
108 return id(tuple, type);
115 return id(s.tuple(),s.primitive_type());
125 return derived().tuple_from_id(type, gid);
129 template <
typename Derived>
130 #if defined(__cpp_concepts) && defined(__cpp_lib_ranges)
131 template <std::ranges::forward_range ContainerType>
133 template <
typename ContainerType>
137 static_assert(std::is_same_v<typename ContainerType::value_type, PrimitiveType>);
141 const int64_t boundary_dim = top_cell_dimension() - 1;
146 if (primitive == top_type && is_boundary(boundary_pt, r)) {
147 assert(!is_boundary(boundary_pt, r));
151 r = switch_tuple(r, primitive);
157 template <
typename Derived>
160 const std::initializer_list<PrimitiveType>& op_sequence)
const
162 return switch_tuples<std::initializer_list<PrimitiveType>>(tuple, op_sequence);
A Curiously Recurring Template Pattern shim to enable generic specialization of functions.
int64_t id_virtual(const Tuple &tuple, PrimitiveType type) const final override
internal utility for overriding the mesh class's id function without having the final override block ...
Tuple switch_tuple(const Tuple &tuple, PrimitiveType type) const override
switch the orientation of the Tuple of the given dimension
Derived & derived()
CRTP utility to extract the derived type of this.
attribute::Accessor< T, Derived, Dim > create_accessor(const TypedAttributeHandle< T > &handle)
constructs an accessor that is aware of the derived mesh's type
const Derived & derived() const
CRTP utility to extract the derived type of this with constnesss.
int64_t id(const Tuple &tuple, PrimitiveType type) const
return the global id of the Tuple of the given dimension
attribute::Accessor< T, Derived, Dim > create_accessor(const attribute::MeshAttributeHandle &handle)
constructs a accessor that is aware of the derived mesh's type
const attribute::Accessor< T, Derived, Dim > create_const_accessor(const attribute::TypedAttributeHandle< T > &handle) const
constructs a const accessor that is aware of the derived mesh's type
bool is_ccw(const Tuple &tuple) const override
returns if a tuple is counterclockwise or not
Tuple switch_tuples(const Tuple &tuple, const std::initializer_list< PrimitiveType > &op_sequence) const
annoying initializer list prototype to catch switch_tuples(t, {PV,PE})
Tuple tuple_from_id(const PrimitiveType type, const int64_t gid) const override
internal function that returns the tuple of requested type, and has the global index cid
int64_t id(const Tuple &tuple, PrimitiveType type) const
Returns the id of a simplex encoded in a tuple.
int64_t id(const simplex::Simplex &s) const final override
variant of id that can cache internally held values
bool is_boundary(PrimitiveType pt, const Tuple &tuple) const override
returns if a simplex is on the boundary of hte mesh. For anything but dimension - 1 this checks if th...
Tuple switch_tuples(const Tuple &tuple, const ContainerType &op_sequence) const
Performs a sequence of switch_tuple operations in the order specified in op_sequence.
const attribute::Accessor< T, Derived, Dim > create_const_accessor(const attribute::MeshAttributeHandle &handle) const
constructs a const accessor that is aware of the derived mesh's type
Mesh(const int64_t &dimension)
int64_t id(const Tuple &tuple, PrimitiveType type) const
return the global id of the Tuple of the given dimension
PrimitiveType top_simplex_type() const
A CachingAccessor that uses tuples for accessing attributes instead of indices.
auto as() const -> const held_handle_type< held_type_from_primitive< T >()> &
Handle that represents attributes for some mesh.