Debian Codegraph @

src/atlas/grid/detail/partitioner/BandsPartitioner.h

raw
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 #pragma once
12
13 #include "atlas/grid/detail/partitioner/Partitioner.h"
14
15 #include "atlas/grid/Distribution.h"
16 #include "atlas/grid/Grid.h"
17
18 namespace atlas {
19 namespace grid {
20 namespace detail {
21 namespace partitioner {
22
23 class BandsPartitioner : public Partitioner {
24 private:
25 int blocksize_;
26 static size_t extract_blocksize(const eckit::Parametrisation& config) {
27 size_t blocksize{1};
28 config.get("blocksize", blocksize);
29 return blocksize;
30 }
31
32 size_t blocksize(const Grid& grid) const;
33
34 protected:
35 static constexpr int BLOCKSIZE_NX{-1};
36
37 public:
38 BandsPartitioner(const eckit::Parametrisation& config = util::NoConfig());
39 BandsPartitioner(int N, const eckit::Parametrisation& config): BandsPartitioner(N, extract_blocksize(config), config) {}
40 BandsPartitioner(int N, int blocksize, const eckit::Parametrisation& config = util::NoConfig());
41
42 std::string type() const override { return static_type(); }
43 static std::string static_type() { return "bands"; }
44
45 Distribution partition(const Grid& grid) const override;
46
47 void partition(const Grid& grid, int part[]) const override;
48 };
49
50 } // namespace partitioner
51 } // namespace detail
52 } // namespace grid
53 } // namespace atlas