Debian Codegraph @

src/atlas/mesh/detail/PartitionGraph.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 <iosfwd>
14 #include <vector>
15
16 #include "atlas/library/config.h"
17 #include "atlas/util/Object.h"
18
19 //----------------------------------------------------------------------------------------------------------------------
20
21 namespace atlas {
22 namespace mesh {
23 namespace detail {
24
25 class MeshImpl;
26
27 //----------------------------------------------------------------------------------------------------------------------
28
29 class PartitionGraph : public util::Object {
30 public:
31 using Neighbours = std::vector<idx_t>;
32
33 public:
34 PartitionGraph();
35 PartitionGraph(idx_t values[], idx_t rows, idx_t displs[], idx_t counts[]);
36 size_t footprint() const;
37 idx_t size() const;
38 Neighbours nearestNeighbours(const idx_t partition) const;
39 idx_t maximumNearestNeighbours() const;
40 operator bool() const;
41
42 private:
43 void print(std::ostream&) const;
44 friend std::ostream& operator<<(std::ostream& s, const PartitionGraph& p);
45
46 private:
47 std::vector<idx_t> counts_;
48 std::vector<idx_t> displs_;
49 std::vector<idx_t> values_;
50 idx_t maximum_nearest_neighbours_;
51 };
52
53 PartitionGraph* build_partition_graph(const MeshImpl& mesh);
54
55 //----------------------------------------------------------------------------------------------------------------------
56
57 } // namespace detail
58 } // namespace mesh
59 } // namespace atlas