19 #ifndef PISM_ARRAY_FORCING
20 #define PISM_ARRAY_FORCING
22 #include "pism/util/array/Scalar.hh"
23 #include "pism/util/MaxTimestep.hh"
24 #include "pism/util/interpolation.hh"
46 const std::string &short_name,
47 const std::string &standard_name,
48 unsigned int max_buffer_size,
54 static std::shared_ptr<Forcing>
55 Constant(std::shared_ptr<const Grid>
grid,
const std::string &short_name,
double value);
59 void init(
const std::string &filename,
bool periodic);
61 void update(
double t,
double dt);
66 void interp(
int i,
int j, std::vector<double> &results);
68 void average(
double t,
double dt);
80 const std::string &short_name,
86 void update(
unsigned int start);
High-level PISM I/O class.
Combines the max. time step with the flag indicating if a restriction is active. Makes is possible to...
std::shared_ptr< const Grid > grid() const
MaxTimestep max_timestep(double t) const
Given the time t determines the maximum possible time-step this Forcing allows.
void begin_access() const
Checks if an Array is allocated and calls DAVecGetArray.
void average(double t, double dt)
void discard(int N)
Discard the first N records, shifting the rest of them towards the "beginning".
void init_periodic_data(const File &file)
void set_record(int n)
Sets the record number n to the contents of the (internal) Vec v.
void init(const std::string &filename, bool periodic)
void allocate(unsigned int buffer_size, InterpolationType interpolation_type)
void end_access() const
Checks if an Array is allocated and calls DAVecRestoreArray.
Forcing(std::shared_ptr< const Grid > grid, const File &file, const std::string &short_name, const std::string &standard_name, unsigned int max_buffer_size, bool periodic, InterpolationType interpolation_type=PIECEWISE_CONSTANT)
void init_interpolation(const std::vector< double > &ts)
Compute weights for the piecewise-constant interpolation. This is used both for time-series and "snap...
static std::shared_ptr< Forcing > Constant(std::shared_ptr< const Grid > grid, const std::string &short_name, double value)
unsigned int buffer_size()
void update(double t, double dt)
Read some data to make sure that the interval (t, t + dt) is covered.
2D time-dependent inputs (for climate forcing, etc)