From e674dde67befe43a1ebeaf79a48c787aae565681 Mon Sep 17 00:00:00 2001 From: djairoh Date: Tue, 7 May 2024 15:46:29 +0200 Subject: [PATCH] added funcs to get min/max of lon/lat values --- .../src/advection/UVGrid.cpp | 18 +++++++++++++- .../src/advection/UVGrid.h | 24 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/particle-track-and-trace/src/advection/UVGrid.cpp b/particle-track-and-trace/src/advection/UVGrid.cpp index f35aa72..393b507 100644 --- a/particle-track-and-trace/src/advection/UVGrid.cpp +++ b/particle-track-and-trace/src/advection/UVGrid.cpp @@ -55,6 +55,22 @@ int UVGrid::timeStep() const { return times[1] - times[0]; } +double UVGrid::lonMin() const { + return this->lons.front(); +} + +double UVGrid::lonMax() const { + return this->lons.back(); +} + +double UVGrid::latMin() const { + return this->lats.front(); +} + +double UVGrid::latMax() const { + return this->lats.back(); +} + void UVGrid::streamSlice(ostream &os, size_t t) { for (int x = 0; x < latSize; x++) { for (int y = 0; y < lonSize; y++) { @@ -63,4 +79,4 @@ void UVGrid::streamSlice(ostream &os, size_t t) { } os << endl; } -} \ No newline at end of file +} diff --git a/particle-track-and-trace/src/advection/UVGrid.h b/particle-track-and-trace/src/advection/UVGrid.h index 221363f..4d3a99a 100644 --- a/particle-track-and-trace/src/advection/UVGrid.h +++ b/particle-track-and-trace/src/advection/UVGrid.h @@ -38,6 +38,30 @@ public: */ int timeStep() const; + /** + * Returns the lowest longitudinal value of grid. + * @return minimum longitude + */ + double lonMin() const; + + /** + * Returns the highest longitudinal value of grid. + * @return maximum longitude + */ + double lonMax() const; + + /** + * Returns the lowest latitudinal value of grid. + * @return minimum latitude + */ + double latMin() const; + + /** + * Returns the higehst latitudinal value of grid. + * @return maximum latitude + */ + double latMax() const; + /** * times, lats, lons are vector of length timeSize, latSize, lonSize respectively. * The maintain the following invariant: