| 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 |
/// @file PartitionPolygon.h |
| 12 |
/// @author Pedro Maciel |
| 13 |
/// @author Willem Deconinck |
| 14 |
/// @date September 2017 |
| 15 |
|
| 16 |
#pragma once |
| 17 |
|
| 18 |
#include <vector> |
| 19 |
|
| 20 |
#include "atlas/util/Object.h" |
| 21 |
|
| 22 |
#include "atlas/library/config.h" |
| 23 |
#include "atlas/projection/Projection.h" |
| 24 |
#include "atlas/util/Config.h" |
| 25 |
#include "atlas/util/Polygon.h" |
| 26 |
|
| 27 |
namespace atlas { |
| 28 |
namespace mesh { |
| 29 |
namespace detail { |
| 30 |
class MeshImpl; |
| 31 |
} |
| 32 |
} // namespace mesh |
| 33 |
} // namespace atlas |
| 34 |
|
| 35 |
namespace atlas { |
| 36 |
namespace mesh { |
| 37 |
|
| 38 |
/** |
| 39 |
* @brief Polygon class that holds the boundary of a mesh partition |
| 40 |
*/ |
| 41 |
class PartitionPolygon : public util::PartitionPolygon { |
| 42 |
public: // methods |
| 43 |
//-- Constructors |
| 44 |
|
| 45 |
/// @brief Construct "size" polygon |
| 46 |
PartitionPolygon(const detail::MeshImpl& mesh, idx_t halo); |
| 47 |
|
| 48 |
//-- Accessors |
| 49 |
|
| 50 |
idx_t halo() const override { return halo_; } |
| 51 |
|
| 52 |
/// @brief Return the memory footprint of the Polygon |
| 53 |
size_t footprint() const override; |
| 54 |
|
| 55 |
void outputPythonScript(const eckit::PathName&, const eckit::Configuration& = util::NoConfig()) const override; |
| 56 |
|
| 57 |
PointsXY xy() const override; |
| 58 |
PointsXY lonlat() const override; |
| 59 |
|
| 60 |
void allGather(util::PartitionPolygons&) const override; |
| 61 |
|
| 62 |
private: |
| 63 |
void print(std::ostream&) const; |
| 64 |
|
| 65 |
friend std::ostream& operator<<(std::ostream& s, const PartitionPolygon& p) { |
| 66 |
p.print(s); |
| 67 |
return s; |
| 68 |
} |
| 69 |
|
| 70 |
private: |
| 71 |
const detail::MeshImpl& mesh_; |
| 72 |
idx_t halo_; |
| 73 |
}; |
| 74 |
|
| 75 |
//------------------------------------------------------------------------------------------------------ |
| 76 |
|
| 77 |
} // namespace mesh |
| 78 |
} // namespace atlas |