From 953eeb115e3f487ec22d72f59d32ed62e8fc1ff1 Mon Sep 17 00:00:00 2001 From: Michael Uleysky Date: Tue, 6 Jun 2023 15:53:15 +1000 Subject: [PATCH] Added UngriddedData class --- include/basedata.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/basedata.h b/include/basedata.h index 2a7f0c1..41082c7 100644 --- a/include/basedata.h +++ b/include/basedata.h @@ -34,6 +34,26 @@ class BaseData explicit operator bool() const { return N() != 0; } }; +class UngriddedData: public BaseData +{ + std::vector lons, lats; + + public: + template UngriddedData(size_t n, Lon genlon, Lat genlat): BaseData(n), lons(n), lats(n) + { + for(size_t i = 0; i < n; i++) + { + lons[i] = genlon(i); + lats[i] = genlat(i); + } + }; + + UngriddedData() = default; + + real Lon(size_t i) const { return lons[i]; } + real Lat(size_t i) const { return lats[i]; } +}; + template class DefaultAverager: public Data { static constexpr bool isuv = IsUVData;