AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
SetBuilders.hpp File Reference

Free-function "make" helpers that construct SLAM sets from a buffer or a range while deducing the full policy stack. More...

#include "axom/core/Array.hpp"
#include "axom/core/Types.hpp"
#include "axom/slam/Utilities.hpp"
#include "axom/slam/RangeSet.hpp"
#include "axom/slam/IndirectionSet.hpp"
#include <cstddef>
#include <vector>

Namespaces

 axom
 
 axom::slam
 

Functions

Set construction helpers

Construct a SLAM set while deducing its policy stack from the buffer or range. PosType defaults to slam's default position type and may be supplied explicitly as the leading template argument.

template<typename PosType = DefaultPositionType, typename ElemType = DefaultElementType>
RangeSet< PosType, ElemType > axom::slam::make_range_set (axom::type_identity_t< PosType > size)
 Make a contiguous range set \([0, size)\). More...
 
template<typename PosType = DefaultPositionType, typename ElemType = DefaultElementType>
RangeSet< PosType, ElemType > axom::slam::make_range_set (axom::type_identity_t< PosType > lower, axom::type_identity_t< PosType > upper)
 Make a contiguous range set \([lower, upper)\). More...
 
template<typename PosType = DefaultPositionType, typename T >
ArrayViewIndirectionSet< PosType, T > axom::slam::make_indirection_set (axom::ArrayView< T > view)
 Make an indirection set whose elements indirect through an axom::ArrayView. More...
 
template<typename PosType = DefaultPositionType, typename T >
VectorIndirectionSet< PosType, T > axom::slam::make_indirection_set (std::vector< T > &vec)
 Make an indirection set whose elements indirect through an std::vector. More...
 
template<typename PosType = DefaultPositionType, typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
ArrayViewIndirectionSet< PosType, T > axom::slam::make_indirection_set (axom::Array< T, DIM, SPACE, StoragePolicy > &arr)
 Make an indirection set whose elements indirect through an axom::Array's flat storage. More...
 
template<typename PosType = DefaultPositionType, typename T >
CArrayIndirectionSet< PosType, T > axom::slam::make_indirection_set (T *data, axom::type_identity_t< PosType > size)
 Make an indirection set whose elements indirect through a C array. More...
 

Detailed Description

Free-function "make" helpers that construct SLAM sets from a buffer or a range while deducing the full policy stack.

SLAM's sets are configured by a long list of orthogonal policy template parameters. Spelling the full stack at every construction site is verbose:

using Set = slam::ArrayViewIndirectionSet<int, double>;
Set s(Set::SetBuilder().size(v.size()).data(v));

The helpers here collapse that to a single call that deduces the element type from the buffer:

auto s = slam::make_indirection_set(view); // -> ArrayViewIndirectionSet<.., double>
ArrayViewIndirectionSet< PosType, T > make_indirection_set(axom::ArrayView< T > view)
Make an indirection set whose elements indirect through an axom::ArrayView.
Definition: SetBuilders.hpp:92
Note
On CTAD vs. helpers. A class-template-argument deduction guide cannot recover a set's policy stack from a SetBuilder argument: a guide parameter of the form typename OrderedSet<P,...>::SetBuilder is a non-deduced context (the template arguments appear only as a nested-name-specifier), so OrderedSet s(builder) can never deduce. Deduction only works from a directly-named argument type such as axom::ArrayView<T>. These free functions are therefore the portable way to get stack-deducing construction in C++17.