This commit is contained in:
robin 2024-05-09 08:41:38 +02:00
parent c50a27948f
commit 9caf439277
1 changed files with 55 additions and 50 deletions

View File

@ -6,84 +6,89 @@
class UVGrid { class UVGrid {
private: private:
/** /**
* 1D data vector of all the us and vs * 1D data vector of all the us and vs
*/ */
std::vector<Vel> uvData; std::vector<Vel> uvData;
public: public:
UVGrid(std::string path); /**
* Constructs the UVGrid.
* @param path The data path where the constructor expects to find
* the files hydrodynamic_U.h5, hydrodynamic_V.h5, and grid.h5
*/
UVGrid(std::string path);
/** /**
* The matrix has shape (timeSize, latSize, lonSize) * The matrix has shape (timeSize, latSize, lonSize)
*/ */
size_t timeSize; size_t timeSize;
size_t latSize; size_t latSize;
size_t lonSize; size_t lonSize;
/** /**
* Assuming grid is a regular grid, gives the longitudinal spacing of grid. * Assuming grid is a regular grid, gives the longitudinal spacing of grid.
* @return longitudinal spacing * @return longitudinal spacing
*/ */
double lonStep() const; double lonStep() const;
/** /**
* Assuming grid is a regular grid, gives the latitudinal spacing of grid. * Assuming grid is a regular grid, gives the latitudinal spacing of grid.
* @return latitudinal spacing * @return latitudinal spacing
*/ */
double latStep() const; double latStep() const;
/** /**
* Assuming grid is a regular grid, gives the time spacing of grid. * Assuming grid is a regular grid, gives the time spacing of grid.
* @return time spacing * @return time spacing
*/ */
int timeStep() const; int timeStep() const;
/** /**
* Returns the lowest longitudinal value of grid. * Returns the lowest longitudinal value of grid.
* @return minimum longitude * @return minimum longitude
*/ */
double lonMin() const; double lonMin() const;
/** /**
* Returns the highest longitudinal value of grid. * Returns the highest longitudinal value of grid.
* @return maximum longitude * @return maximum longitude
*/ */
double lonMax() const; double lonMax() const;
/** /**
* Returns the lowest latitudinal value of grid. * Returns the lowest latitudinal value of grid.
* @return minimum latitude * @return minimum latitude
*/ */
double latMin() const; double latMin() const;
/** /**
* Returns the higehst latitudinal value of grid. * Returns the higehst latitudinal value of grid.
* @return maximum latitude * @return maximum latitude
*/ */
double latMax() const; double latMax() const;
/** /**
* times, lats, lons are vector of length timeSize, latSize, lonSize respectively. * times, lats, lons are vector of length timeSize, latSize, lonSize respectively.
* The maintain the following invariant: * The maintain the following invariant:
* grid[timeIndex,latIndex,lonIndex] gives the u,v at the point with latitude at lats[latIndex], * grid[timeIndex,latIndex,lonIndex] gives the u,v at the point with latitude at lats[latIndex],
* with longitude at lons[lonIndex], and with time at times[timeIndex]. * with longitude at lons[lonIndex], and with time at times[timeIndex].
*/ */
std::vector<int> times; std::vector<int> times;
std::vector<double> lats; std::vector<double> lats;
std::vector<double> lons; std::vector<double> lons;
/** /**
* The 3D index into the data. The array is sized by [8761][67][116] * The 3D index into the data. The array is sized by [8761][67][116]
* @return Velocity at that index * @return Velocity at that index
*/ */
const Vel& operator[](size_t timeIndex, size_t latIndex, size_t lonIndex) const; const Vel &operator[](size_t timeIndex, size_t latIndex, size_t lonIndex) const;
/** /**
* Streams a slice at timeIndex t of the matrix to the outstream given by os * Streams a slice at timeIndex t of the matrix to the outstream given by os
* @param os outstream * @param os outstream
* @param t index with which to slice matrix * @param t index with which to slice matrix
*/ */
void streamSlice(std::ostream &os, size_t t); void streamSlice(std::ostream &os, size_t t);
}; };
#endif //UVGRID_H #endif //UVGRID_H