Utilities#

Xtensor container selectors#

Defined in fastscapelib/utils/xtensor_utils.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 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 xt_container#

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

Template Parameters:
  • S – The xtensor selector type.

  • T – The container value type.

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

template<class S, class T, std::size_t N>
using fastscapelib::xt_tensor_t = typename xt_container<S, T, N>::tensor_type#

Alias for the selected (static dimension) xtensor container type.

Template Parameters:
  • S – The xtensor selector type.

  • T – The container value type.

  • N – The fixed number of dimensions.

template<class S, class T>
using fastscapelib::xt_array_t = typename xt_container<S, T>::array_type#

Alias for the selected (dynamic dimension) xtensor container type.

Template Parameters:
  • S – The xtensor 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.