Browse Source

Removed Lon/Lat functions from BaseData class

interpolate
Michael Uleysky 2 years ago
parent
commit
df8ad63545
  1. 4
      include/actions.h
  2. 15
      include/basedata.h
  3. 13
      include/simple2ddata.h

4
include/actions.h

@ -162,7 +162,7 @@ template<class D> std::pair<TIndex, MString> GetTIndexes(const D& data, const CL
return {tindexes, ""};
}
template<class D> BaseData Read(const D& data, const MString& vname, const BaseParameters* p, const TIndex& tindex)
template<class D> ReadType<D> Read(const D& data, const MString& vname, const BaseParameters* p, const TIndex& tindex)
{
using RT = ReadType<D>;
size_t ind;
@ -196,7 +196,7 @@ template<class D> BaseData Read(const D& data, const MString& vname, const BaseP
}
if(ok) return out.Div();
}
return BaseData();
return RT();
}
template<class D> UVData<ReadType<D>> ReadUV(const D& data, const BaseParameters* p, size_t ind)

15
include/basedata.h

@ -13,18 +13,8 @@ class BaseData
protected:
static constexpr real fillval = 1.0e10;
std::vector<real> data;
std::vector<real> lons, lats;
BaseData(size_t n): data(n), lons(n), lats(n) {}
template<class Lon, class Lat> BaseData(size_t n, Lon genlon, Lat genlat): data(n), lons(n), lats(n)
{
for(size_t i = 0; i < n; i++)
{
lons[i] = genlon(i);
lats[i] = genlat(i);
}
};
BaseData(size_t n): data(n) {}
public:
BaseData() = default;
@ -35,9 +25,6 @@ class BaseData
const real& operator()(size_t i) const { return data[i]; }
real& operator()(size_t i) { return data[i]; }
real Lon(size_t i) const { return lons[i]; }
real Lat(size_t i) const { return lats[i]; }
size_t N() const { return data.size(); }
bool IsFill(size_t i) const { return V(i) == Fillval(); }

13
include/simple2ddata.h

@ -10,18 +10,7 @@ class Simple2DData: public BaseData
public:
Simple2DData() = default;
Simple2DData(size_t nx_, size_t ny_, real x0_, real y0_, real xs_, real ys_):
BaseData(
nx_ * ny_, [x0 = x0_, nx = nx_, xstep = xs_](size_t i) -> real { return x0 + (i % nx) * xstep; },
[y0 = y0_, nx = nx_, ystep = ys_](size_t i) -> real { return y0 + (i / nx) * ystep; }),
x0(x0_),
y0(y0_),
nx(nx_),
ny(ny_),
xstep(xs_),
ystep(ys_)
{
}
Simple2DData(size_t nx_, size_t ny_, real x0_, real y0_, real xs_, real ys_): BaseData(nx_ * ny_), x0(x0_), y0(y0_), nx(nx_), ny(ny_), xstep(xs_), ystep(ys_) {}
const real& V(size_t i) const { return BaseData::V(i); }
real& V(size_t i) { return BaseData::V(i); }

Loading…
Cancel
Save