|
|
|
@ -43,3 +43,36 @@ class Simple2DData: public BaseData
|
|
|
|
|
real XStep() const { return xstep; } |
|
|
|
|
real YStep() const { return ystep; } |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
class Rect2DData: public BaseData |
|
|
|
|
{ |
|
|
|
|
std::vector<real> lon, lat; |
|
|
|
|
|
|
|
|
|
public: |
|
|
|
|
using BaseData::IsFill; |
|
|
|
|
using BaseData::V; |
|
|
|
|
using BaseData::operator(); |
|
|
|
|
Rect2DData() = default; |
|
|
|
|
|
|
|
|
|
Rect2DData(const std::vector<real>& lons, const std::vector<real>& lats, MString&& unit = ""): BaseData(lons.size() * lats.size(), std::move(unit)), lon(lons), lat(lats) {} |
|
|
|
|
|
|
|
|
|
const real& V(size_t ix, size_t iy) const { return V(iy * Nx() + ix); } |
|
|
|
|
real& V(size_t ix, size_t iy) { return V(iy * Nx() + ix); } |
|
|
|
|
|
|
|
|
|
const real& operator()(size_t ix, size_t iy) const { return V(iy * Nx() + ix); } |
|
|
|
|
real& operator()(size_t ix, size_t iy) { return V(iy * Nx() + ix); } |
|
|
|
|
|
|
|
|
|
size_t Nx() const { return lon.size(); } |
|
|
|
|
size_t Ny() const { return lat.size(); } |
|
|
|
|
|
|
|
|
|
bool IsFill(size_t ix, size_t iy) const { return IsFill(iy * Nx() + ix); } |
|
|
|
|
|
|
|
|
|
real Lon(size_t ix, [[maybe_unused]] size_t iy) const { return lon[ix]; } |
|
|
|
|
real Lat([[maybe_unused]] size_t ix, size_t iy) const { return lat[iy]; } |
|
|
|
|
|
|
|
|
|
real Lon(size_t i) const { return Lon(i % Nx(), i / Nx()); } |
|
|
|
|
real Lat(size_t i) const { return Lat(i % Nx(), i / Nx()); } |
|
|
|
|
|
|
|
|
|
real Ix2Lon(size_t ix) const { return lon[ix]; } |
|
|
|
|
real Iy2Lat(size_t iy) const { return lat[iy]; } |
|
|
|
|
}; |
|
|
|
|