...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::mpi::cartesian_topology — Describe the topology of a cartesian grid.
// In header: <boost/mpi/cartesian_communicator.hpp> class cartesian_topology : private std::vector< cartesian_dimension > { public: // public member functions cartesian_topology() = delete; cartesian_topology(cartesian_topology const &) = default; cartesian_topology & operator=(cartesian_topology const &) = default; cartesian_topology(cartesian_topology &&); cartesian_topology & operator=(cartesian_topology &&); ~cartesian_topology() = default; 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); std::vector< cartesian_dimension > & stl(); std::vector< cartesian_dimension > const & stl() const; void split(std::vector< int > &, std::vector< bool > &) const; };
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 member functionscartesian_topology() = delete;
cartesian_topology(cartesian_topology const &) = default;
cartesian_topology & operator=(cartesian_topology const &) = default;
cartesian_topology(cartesian_topology && other);
cartesian_topology & operator=(cartesian_topology && other);
~cartesian_topology() = default;
cartesian_topology(int ndim);Create a N dimension space. Each dimension is initialized as non periodic of size 0.
cartesian_topology(std::vector< cartesian_dimension > const & dims);Use the provided dimensions specification as initial values.
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.
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}.
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}.
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: |
|
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: |
|
std::vector< cartesian_dimension > & stl();
Export as an stl sequence.
std::vector< cartesian_dimension > const & stl() const;
Export as an stl sequence.
void split(std::vector< int > & dims, std::vector< bool > & periodics) const;
Split the topology in two sequences of sizes and periodicities.