| Home | Libraries | People | FAQ | More

## Class cartesian_topology

boost::mpi::cartesian_topology — Describe the topology of a cartesian grid.

## Synopsis

    // In header: <boost/mpi/cartesian_communicator.hpp>

    class cartesian_topology : private std::vector< cartesian_dimension > {
    public:
      // construct/copy/destruct
      cartesian_topology() = delete;
      cartesian_topology(cartesian_topology const &) = default;
      cartesian_topology(cartesian_topology &&);
      cartesian_topology(int);
      cartesian_topology(std::vector< cartesian_dimension > const &);
      template<typename InitArr> explicit cartesian_topology(InitArr);
      explicit cartesian_topology(std::initializer_list< cartesian_dimension >);
      template<int NDIM> explicit cartesian_topology(cartesian_dimension(&));
      template<typename DimRg, typename PerRg>
        cartesian_topology(DimRg const &, PerRg const &);
      template<typename DimIter, typename PerIter>
        cartesian_topology(DimIter, PerIter, int);
      cartesian_topology & operator=(cartesian_topology const &) = default;
      cartesian_topology & operator=(cartesian_topology &&);
      ~cartesian_topology();

      // public member functions
      std::vector< cartesian_dimension > & stl();
      std::vector< cartesian_dimension > const  & stl() const;
      void split(std::vector< int > &, std::vector< bool > &) const;
    };

## Description

Behave mostly like a sequence of `cartesian_dimension` with the notable exception that its size is fixed. This is a lightweight object, so that any constructor that could be considered missing could be replaced with a function (move constructor provided when supported).

### `cartesian_topology` public construct/copy/destruct

1.     cartesian_topology() = delete;

2.     cartesian_topology(cartesian_topology const &) = default;

3.     cartesian_topology(cartesian_topology && other);

4.     cartesian_topology(int ndim);

   Create a N dimension space. Each dimension is initialized as non periodic of size 0.

5.     cartesian_topology(std::vector< cartesian_dimension > const & dims);

   Use the provided dimensions specification as initial values.

6.     template<typename InitArr> explicit cartesian_topology(InitArr dims);

   Use dimensions specification provided in the sequence container as initial values. #param dims must be a sequence container.

7.     explicit cartesian_topology(std::initializer_list< cartesian_dimension > dims);

   Use dimensions specification provided in the initialization list as initial values. #param dims can be of the form { dim_1, false}, .... {dim_n, true}.

8.     template<int NDIM> explicit cartesian_topology(cartesian_dimension(&) dims);

   Use dimensions specification provided in the array. #param dims can be of the form { dim_1, false}, .... {dim_n, true}.

9.     template<typename DimRg, typename PerRg>
         cartesian_topology(DimRg const & dim_rg, PerRg const & period_rg);

   Use dimensions specification provided in the input ranges The ranges do not need to be the same size. If the sizes are different, the missing values will be complete with zeros of the dim and assumed non periodic.

   Parameters:

   `dim_rg` | the dimensions, values must convert to integers.
   `period_rg` | the periodicities, values must convert to booleans. #param dims can be of the form { dim_1, false}, .... {dim_n, true}

10.     template<typename DimIter, typename PerIter>
          cartesian_topology(DimIter dit, PerIter pit, int n);

    Iterator based initializer. Will use the first n iterated values. Both iterators can be single pass.

    Parameters:

    `dit` | dimension iterator, value must convert to integer type.
    `pit` | periodicity iterator, value must convert to booleans..

11.     cartesian_topology & operator=(cartesian_topology const &) = default;

12.     cartesian_topology & operator=(cartesian_topology && other);

13.     ~cartesian_topology();

### `cartesian_topology` public member functions

1.     std::vector< cartesian_dimension > & stl();

   Export as an stl sequence.

2.     std::vector< cartesian_dimension > const  & stl() const;

   Export as an stl sequence.

3.     void split(std::vector< int > & dims, std::vector< bool > & periodics) const;

   Split the topology in two sequences of sizes and periodicities.