index.h Source File
|
CPP API
|
index.h
Go to the documentation of this file.
277 struct type_at_index<Tag, ::mio::Index<CategoryTags...>> : public type_at_index<Tag, CategoryTags...> {
282 struct index_of_type<Tag, ::mio::Index<CategoryTags...>> : public index_of_type<Tag, CategoryTags...> {
358 decltype(details::tuple_to_index(details::concatenate_indices_impl(std::declval<IndexArgs>()...)));
366 inline Index<CategoryTags...> reduce_index_impl(const SuperIndex& i, mio::Tag<Index<CategoryTags...>>)
371 // below, we use get<index_of_type<>> instead of get<> directly to handle categories that are not unique
378 inline Index<CategoryTags...> extend_index_impl(const Index<Subset...>& i, const size_t fill_value,
387 // This is an IIFE, which is invoked for each category (note the '...' after the function call).
388 // So CategoryTags without a '...' is seen by each IIFE as exactly one category from this variadic template.
390 // We use get<index_of_type<>> instead of get<> directly to handle categories that are not unique
An Index with a single template parameter is a typesafe wrapper for size_t that is associated with a ...
Definition: index.h:121
void serialize(IOContext &io) const
serialize this.
Definition: index.h:156
Index(CategoryTag val) requires std
Constructor from enum, if CategoryTag is an enum.
Definition: index.h:136
static IOResult< Index > deserialize(IOContext &io)
deserialize an object of this class.
Definition: index.h:166
An Index with more than one template parameter combines several Index objects.
Definition: index.h:181
Index(const std::tuple< Index< CategoryTag >... > &_indices)
Internal constructor from a tuple.
Definition: index.h:208
static constexpr Index Zero()
Construct an Index filled with zeroes.
Definition: index.h:187
Index(Index< CategoryTag > const &... _indices)
Constructor from individual Indices.
Definition: index.h:193
requires(sizeof...(IndexArgs) > 1) Index(IndexArgs &&... subindices)
Constructor from mixed Indices and MultiIndices.
Definition: index.h:200
static IOResult< Index > deserialize(IOContext &io)
deserialize an object of this class.
Definition: index.h:260
base class to add default operator +, +=, -, -= to a class derived from TypeSafe.
Definition: type_safe.h:152
base class to add operator <, <=, >, >= to a class derived from TypeSafe.
Definition: type_safe.h:205
base class to add operator *, *=, /, /= with a scalar to a class derived from TypeSafe.
Definition: type_safe.h:179
typesafe wrapper around any type to make function arguments, tuple elements, etc.
Definition: type_safe.h:42
void is_multi_index_impl(Index< T... >)
Function definition that accepts a MultiIndex, used for the definition of IsMultiIndex.
Index< CategoryTags... > extend_index_impl(const Index< Subset... > &i, const size_t fill_value, mio::Tag< Index< CategoryTags... >>)
Creates and returns a SuperIndex from SubIndex, using entries from the given SubIndex or fill_value.
Definition: index.h:378
Index< T... > tuple_to_index(std::tuple< Index< T >... >)
Function declaration that allows type conversion from a tuple of single-category indices to MultiInde...
Index< CategoryTags... > reduce_index_impl(const SuperIndex &i, mio::Tag< Index< CategoryTags... >>)
Extracts CategoryTags from the tagged Index and returns a subindex of SuperIndex with the given categ...
Definition: index.h:366
std::tuple< Index< Tags >... > get_tuple(const Index< Tags... > &i)
Obtain a tuple of single-category indices from a Index or MultiIndex.
Definition: index.h:57
int size(Comm comm)
Return the size of the given communicator.
Definition: miompi.cpp:75
A collection of classes to simplify handling of matrix shapes in meta programming.
Definition: models/abm/analyze_result.h:30
IOResult< T > deserialize(IOContext &io, Tag< T > tag)
Restores an object from the data stored in an IO context.
Definition: io.h:860
void serialize(IOContext &io, const T &t)
Save data that describes an object in a format determined by the given context.
Definition: io.h:836
boost::outcome_v2::in_place_type_t< T > Tag
Type that is used for overload resolution.
Definition: io.h:407
concept IsMultiIndex
A MultiIndex is an Index with any number of categories. Does accept empty or single category indices.
Definition: index.h:50
details::ApplyResultT< F, T... > apply(IOContext &io, F f, const IOResult< T > &... rs)
Evaluate a function with zero or more unpacked IOResults as arguments.
Definition: io.h:481
constexpr bool has_duplicates_v
Checks whether Type has any duplicates.
Definition: metaprogramming.h:223
requires(!std::is_trivial_v< T >) void BinarySerializerObject
Definition: binary_serializer.h:333
decltype(auto) reduce_index(const SuperIndex &index)
Create a SubIndex by copying values from SuperIndex.
Definition: index.h:412
auto success()
Create an object that is implicitly convertible to a succesful IOResult<void>.
Definition: io.h:359
decltype(auto) concatenate_indices(IndexArgs &&... args)
Combine several Indexs into one MultiIndex.
Definition: index.h:355
SuperIndex extend_index(const SubIndex &index, size_t fill_value=0)
Create a SuperIndex by copying values from SubIndex, filling new categories with fill_value.
Definition: index.h:442
constexpr std::tuple_element< I, std::tuple< Index< CategoryTags >... > >::type & get(Index< CategoryTags... > &i) noexcept
Retrieves the Index (by reference) at the Ith position of a MultiIndex.
Definition: index.h:294
boost::outcome_v2::unchecked< T, IOStatus > IOResult
Value-or-error type for operations that return a value but can fail.
Definition: io.h:353
Definition: io.h:94
Tests whether the list Types contains any type multiple times.
Definition: metaprogramming.h:198
Finds the type at the Index-th position in the list Types.
Definition: metaprogramming.h:107
Generated by