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