7#include <pybind11/numpy.h>
9#include <pybind11/stl.h>
28 module.attr("__version__") = "2025.10.13a1";
30 "Operator-splitting method of integrating DP-type Langevin equations";
32 py::enum_<GridDimension>(module,
"GridDimension")
33 .value(
"D1", GridDimension::D1)
34 .value(
"D2", GridDimension::D2)
35 .value(
"D3", GridDimension::D3)
39 py::enum_<GridTopology>(module,
"GridTopology")
40 .value(
"BOUNDED", GridTopology::BOUNDED)
41 .value(
"PERIODIC", GridTopology::PERIODIC)
44 py::enum_<BoundaryCondition>(module,
"BoundaryCondition")
45 .value(
"FLOATING", BoundaryCondition::FLOATING)
46 .value(
"FIXED_VALUE", BoundaryCondition::FIXED_VALUE)
47 .value(
"FIXED_FLUX", BoundaryCondition::FIXED_FLUX)
50 py::enum_<InitialCondition>(module,
"InitialCondition")
51 .value(
"RANDOM_UNIFORM", InitialCondition::RANDOM_UNIFORM)
52 .value(
"RANDOM_GAUSSIAN", InitialCondition::RANDOM_GAUSSIAN)
53 .value(
"CONSTANT_VALUE", InitialCondition::CONSTANT_VALUE)
54 .value(
"SINGLE_SEED", InitialCondition::SINGLE_SEED)
57 py::enum_<IntegrationMethod>(module,
"IntegrationMethod")
58 .value(
"EULER", IntegrationMethod::EULER)
59 .value(
"RUNGE_KUTTA", IntegrationMethod::RUNGE_KUTTA)
62 py::class_<SimDP>(module,
"SimDP")
67 double,
double,
double,
78 "Simulation of DP Langevin equation",
79 py::arg(
"linear") = 1.0,
80 py::arg(
"quadratic") = 2.0,
81 py::arg(
"diffusion") = 0.1,
82 py::arg(
"noise") = 1.0,
83 py::arg(
"t_final") = 100.0,
86 py::arg(
"random_seed") = 1,
87 py::arg(
"grid_dimension") = GridDimension::D2,
89 py::arg(
"grid_topologies") =
gt_vec_t(2),
90 py::arg(
"boundary_conditions") = bc_vec_t(4),
92 py::arg(
"initial_condition") = InitialCondition::RANDOM_UNIFORM,
94 py::arg(
"integration_method") = IntegrationMethod::RUNGE_KUTTA
int get_i_current_epoch() const
Fetch the index of the current epoch of the simulation.
bool run(const int n_next_epochs)
Execute the model simulation for n_next_epochs
bool postprocess()
Process the model results data if available.
py_array_t get_density() const
Fetch the current Langevin density field grid as a Python array.
py_array_t get_t_epochs() const
Fetch a times-series vector of the simulation epochs as a Python array.
double get_t_next_epoch() const
Fetch the next epoch (time) of the simulation.
bool initialize()
Initialize the model simulation.
double get_t_current_epoch() const
Fetch the current epoch (time) of the simulation.
py_array_t get_mean_densities() const
Fetch a times-series vector of the grid-averaged density field over time as a Python array.
int get_n_epochs() const
Fetch the total number of simulation epochs.
int get_i_next_epoch() const
Fetch the index of the next epoch of the simulation.
GridDimension
Density field grid dimension: only 1D or 2D grids implemented so far.
IntegrationMethod
Deterministic integration method: default is 4th-order Runge-Kutta; can be explicit Euler.
InitialCondition
Grid density field initial condition: random uniform or Gaussian variates; constant everywhere; or ce...
std::vector< GridTopology > gt_vec_t
Type for specifying grid topology in each direction x, y, z...
std::vector< int > int_vec_t
Type for vectors of integers.
std::vector< double > dbl_vec_t
Type for vectors of doubles.
Class that manages simulation of DPLangevin equation.
PYBIND11_MODULE(dplvn, module)