Utilities

Xtensor container selectors

Defined in fastscapelib/utils/xtensor_containers.hpp

Most Fastscapelib data structures (i.e., grids, flow graph, etc.) expose a template parameter that allows setting the type of xtensor container to use for their public array members.

This allows reusing the same classes (and avoid conversion copies) in various contexts, e.g.,


struct xt_selector

The xtensor container selector, used by default in Fastscapelib C++ API.

Fastscapelib template classes specialized with this selector will use xt::xtensor or xt::xarray as container types for their public array members.

template<class S, class T, std::size_t N = 0>
struct container_selection

Used to get the actual container type from a given selector.

Template Parameters:
  • S – The selector type.

  • T – The container value type.

  • N – The number of dimensions required (only for static dimension containers)

template<class S, class T, std::size_t N>
using fastscapelib::fixed_shape_container_t = typename container_selection<S, T, N>::fixed_shape_type

Alias for the selected static dimension container type.

Template Parameters:
  • S – The container selector type.

  • T – The container value type.

  • N – The fixed number of dimensions.

template<class S, class T>
using fastscapelib::dynamic_shape_container_t = typename container_selection<S, T>::dynamic_shape_type

Alias for the selected dynamic dimension container type.

Template Parameters:
  • S – The container selector type.

  • T – The container value type.


Iterators and virtual containers

Defined in fastscapelib/utils/iterators.hpp

For convenience, Fastscapelib provides STL-compatible iterators and virtual containers for looping over grid or flow graph nodes.


template<class G>
class grid_nodes_indices

STL-compatible, immutable, virtual container for iterating through grid node indices.

Currently only implements a bidirectional iterator.

Template Parameters:

G – The grid type.

template<class C>
class stl_container_iterator_wrapper

Thin wrapper around iterators of any STL-compatible container.

Only const forward and reverse iterators are exposed.

Template Parameters:

C – The container type.