| 1 |
/* |
| 2 |
* (C) Copyright 2013 ECMWF. |
| 3 |
* |
| 4 |
* This software is licensed under the terms of the Apache Licence Version 2.0 |
| 5 |
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. |
| 6 |
* In applying this licence, ECMWF does not waive the privileges and immunities |
| 7 |
* granted to it by virtue of its status as an intergovernmental organisation |
| 8 |
* nor does it submit to any jurisdiction. |
| 9 |
*/ |
| 10 |
|
| 11 |
#include "SerialDistribution.h" |
| 12 |
|
| 13 |
#include <algorithm> |
| 14 |
#include <ostream> |
| 15 |
|
| 16 |
#include "atlas/grid/Grid.h" |
| 17 |
#include "atlas/parallel/mpi/mpi.h" |
| 18 |
|
| 19 |
namespace atlas { |
| 20 |
namespace grid { |
| 21 |
namespace detail { |
| 22 |
namespace distribution { |
| 23 |
|
| 24 |
SerialDistribution::SerialDistribution(const Grid& grid): |
| 25 |
SerialDistribution(grid, mpi::rank()) { |
| 26 |
} |
| 27 |
|
| 28 |
SerialDistribution::SerialDistribution(const Grid& grid, int part): DistributionFunctionT<SerialDistribution>(grid) { |
| 29 |
type_ = "serial"; |
| 30 |
nb_partitions_ = 1; |
| 31 |
size_ = grid.size(); |
| 32 |
nb_pts_.resize(nb_partitions_, grid.size()); |
| 33 |
max_pts_ = *std::max_element(nb_pts_.begin(), nb_pts_.end()); |
| 34 |
min_pts_ = *std::min_element(nb_pts_.begin(), nb_pts_.end()); |
| 35 |
part_ = part; |
| 36 |
} |
| 37 |
|
| 38 |
|
| 39 |
} // namespace distribution |
| 40 |
} // namespace detail |
| 41 |
} // namespace grid |
| 42 |
} // namespace atlas |