23#ifndef TSUNAMI_LAB_IO_NETCDF_H
24#define TSUNAMI_LAB_IO_NETCDF_H
65 std::size_t m_timeIdx = 0;
75 static void check(
int i_status,
char const * i_what );
82 void writeSlice(
int i_varId,
90 return (a + b - 1) / b;
113 NetCdf( std::string i_path,
118 t_real const * i_bathymetry,
174 std::size_t
records()
const {
return m_timeIdx; }
187 std::vector<t_real>
x;
188 std::vector<t_real>
y;
189 std::vector<t_real>
z;
198 return !
x.empty() && !
y.empty()
199 && i_x >=
x.front() && i_x <=
x.back()
200 && i_y >=
y.front() && i_y <=
y.back();
225 static Grid
read( std::string i_path );
251 t_real const * i_bathymetry,
~NetCdf()
Definition NetCdf.cpp:151
static Checkpoint readCheckpoint(std::string i_path)
Definition NetCdf.cpp:369
NetCdf & operator=(NetCdf const &)=delete
std::size_t records() const
Definition NetCdf.h:174
static Grid read(std::string i_path)
Definition NetCdf.cpp:226
void writeTimeStep(t_real i_simTime, t_real const *i_h, t_real const *i_hu, t_real const *i_hv)
Definition NetCdf.cpp:187
void writeCheckpoint(std::string i_path, t_real const *i_h, t_real const *i_hu, t_real const *i_hv, t_real const *i_bathymetry, t_real i_simTime, t_idx i_timeStep, t_real i_dt)
Definition NetCdf.cpp:294
static bool hasCheckpoint(std::string i_path)
Definition NetCdf.cpp:361
NetCdf(std::string i_path, t_real i_dxy, t_idx i_nx, t_idx i_ny, t_idx i_stride, t_real const *i_bathymetry, t_idx i_k)
Definition NetCdf.cpp:28
NetCdf(NetCdf const &)=delete
Definition constants.h:12
float t_real
floating point type
Definition constants.h:17
std::size_t t_idx
integral type for cell-ids, pointer arithmetic, etc.
Definition constants.h:14
tag type selecting the append constructor (assignment 7.1 resume)
Definition NetCdf.h:122
Grid hv
y-momentum
Definition NetCdf.h:266
Grid h
water height
Definition NetCdf.h:264
t_real dxy() const
cell size (m)
Definition NetCdf.h:273
t_idx timeStep
time-step counter of the checkpoint
Definition NetCdf.h:268
Grid b
bathymetry
Definition NetCdf.h:263
t_idx nx() const
interior cells in x
Definition NetCdf.h:271
t_idx ny() const
interior cells in y
Definition NetCdf.h:272
t_real simTime
simulation time of the checkpoint (s)
Definition NetCdf.h:267
t_real dt
constant time step of the run (s)
Definition NetCdf.h:269
Grid hu
x-momentum
Definition NetCdf.h:265
bool inBounds(t_real i_x, t_real i_y) const
Definition NetCdf.h:197
std::vector< t_real > x
monotonically ascending x (size nx)
Definition NetCdf.h:187
t_idx nx
number of x-coordinates
Definition NetCdf.h:185
std::vector< t_real > z
2d field in (y, x) order (size nx * ny)
Definition NetCdf.h:189
t_idx ny
number of y-coordinates
Definition NetCdf.h:186
t_real sampleNearest(t_real i_x, t_real i_y) const
Definition NetCdf.cpp:206
std::vector< t_real > y
monotonically ascending y (size ny)
Definition NetCdf.h:188