| 1 |
/* |
| 2 |
* (C) Copyright 1996- 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 |
* |
| 7 |
* In applying this licence, ECMWF does not waive the privileges and immunities |
| 8 |
* granted to it by virtue of its status as an intergovernmental organisation nor |
| 9 |
* does it submit to any jurisdiction. |
| 10 |
*/ |
| 11 |
|
| 12 |
|
| 13 |
#pragma once |
| 14 |
|
| 15 |
#include <iosfwd> |
| 16 |
#include <vector> |
| 17 |
|
| 18 |
|
| 19 |
namespace atlas { |
| 20 |
class Grid; |
| 21 |
} |
| 22 |
|
| 23 |
|
| 24 |
namespace atlas { |
| 25 |
namespace interpolation { |
| 26 |
namespace method { |
| 27 |
|
| 28 |
|
| 29 |
class GridBox { |
| 30 |
public: |
| 31 |
// -- Exceptions |
| 32 |
// None |
| 33 |
|
| 34 |
// -- Constructors |
| 35 |
|
| 36 |
GridBox(double north, double west, double south, double east); |
| 37 |
|
| 38 |
// -- Destructor |
| 39 |
// None |
| 40 |
|
| 41 |
// -- Convertors |
| 42 |
// None |
| 43 |
|
| 44 |
// -- Operators |
| 45 |
// None |
| 46 |
|
| 47 |
// -- Methods |
| 48 |
|
| 49 |
double area() const; |
| 50 |
double diagonal() const; |
| 51 |
bool intersects(GridBox&) const; |
| 52 |
|
| 53 |
double north() const { return north_; } |
| 54 |
double west() const { return west_; } |
| 55 |
double south() const { return south_; } |
| 56 |
double east() const { return east_; } |
| 57 |
// -- Overridden methods |
| 58 |
// None |
| 59 |
|
| 60 |
// -- Class members |
| 61 |
// None |
| 62 |
|
| 63 |
// -- Class methods |
| 64 |
// None |
| 65 |
|
| 66 |
protected: |
| 67 |
// -- Members |
| 68 |
// None |
| 69 |
|
| 70 |
// -- Methods |
| 71 |
// None |
| 72 |
|
| 73 |
// -- Overridden methods |
| 74 |
// None |
| 75 |
|
| 76 |
// -- Class members |
| 77 |
// None |
| 78 |
|
| 79 |
// -- Class methods |
| 80 |
// None |
| 81 |
|
| 82 |
// -- Friends |
| 83 |
// None |
| 84 |
|
| 85 |
private: |
| 86 |
// -- Members |
| 87 |
|
| 88 |
double north_; |
| 89 |
double west_; |
| 90 |
double south_; |
| 91 |
double east_; |
| 92 |
|
| 93 |
// -- Methods |
| 94 |
|
| 95 |
void print(std::ostream&) const; |
| 96 |
|
| 97 |
// -- Overridden methods |
| 98 |
// None |
| 99 |
|
| 100 |
// -- Class members |
| 101 |
// None |
| 102 |
|
| 103 |
// -- Class methods |
| 104 |
// None |
| 105 |
|
| 106 |
// -- Friends |
| 107 |
|
| 108 |
friend std::ostream& operator<<(std::ostream& s, const GridBox& p) { |
| 109 |
p.print(s); |
| 110 |
return s; |
| 111 |
} |
| 112 |
}; |
| 113 |
|
| 114 |
|
| 115 |
struct GridBoxes : std::vector<GridBox> { |
| 116 |
GridBoxes(const Grid&, bool gaussianWeightedLatitudes = true); |
| 117 |
GridBoxes(); |
| 118 |
double getLongestGridBoxDiagonal() const; |
| 119 |
}; |
| 120 |
|
| 121 |
|
| 122 |
} // namespace method |
| 123 |
} // namespace interpolation |
| 124 |
} // namespace atlas |