19 switch (
p.integration_method)
21 case (IntegrationMethod::RUNGE_KUTTA):
24 case (IntegrationMethod::EULER):
37 std::cout <<
"Too many epochs: "
84 auto epochs_proxy = epochs_array.mutable_unchecked();
96 auto mean_densities_proxy = mean_densities_array.mutable_unchecked();
107 if (not (
p.n_cells ==
p.n_x *
p.n_y *
p.n_z))
109 std::cout <<
"prep_density: grid size problem" << std::endl;
114 auto density_proxy = density_array.mutable_unchecked();
115 for (
auto i=0; i<
p.n_cells; i++)
119 density_proxy(x, y) =
dpLangevin->get_density_grid_value(i);
void integrate_rungekutta(rng_t &rng)
Runge-Kutta + stochastic integration + grid update.
void integrate_euler(rng_t &rng)
Explicit Euler + stochastic integration + grid update.
int i_current_epoch
Index of current epoch aka time step.
int i_next_epoch
Index of next epoch aka time step.
Parameters p
Model simulation parameters.
py_array_t pyarray_t_epochs
Python-compatible array of epochs time-series.
dbl_vec_t mean_densities
Vector time-series of grid-averaged field density values.
int count_epochs() const
Count upcoming number of epochs by running a dummy time-stepping loop.
bool choose_integrator()
Chooses function implementing either Runge-Kutta or Euler integration methods.
double t_next_epoch
Time of next epoch.
void(DPLangevin::* integrator)(rng_t &)
Integrator: either a Runge-Kutta or an Euler method.
bool pyprep_mean_densities()
Generate a Python-compatible version of the mean densities time-series vector.
int n_epochs
Total number of simulation time steps aka "epochs".
dbl_vec_t t_epochs
Vector time-series of epochs.
py_array_t pyarray_density
Python-compatible array of current density grid.
py_array_t pyarray_mean_densities
Python-compatible array of mean density time-series.
bool pyprep_t_epochs()
Generate a Python-compatible version of the epochs time-series vector.
DPLangevin * dpLangevin
Instance of DP Langevin integrator class (pointer to instance)
bool pyprep_density_grid()
Generate a Python-compatible version of the current density grid.
rng_t * rng
Random number generation function (Mersenne prime) (pointer to RNG)
bool integrate(const int n_next_epochs)
Perform Dornic-type integration of the DP Langevin equation for n_next_epochs
double t_current_epoch
Time of current epoch.
py::array_t< double, py::array::c_style > py_array_t
Type for Python arrays of doubles.
Class that manages simulation of DPLangevin equation.