Program Listing for File abstract_model.h
↰ Return to documentation for file (include/amici/abstract_model.h
)
#ifndef AMICI_ABSTRACT_MODEL_H
#define AMICI_ABSTRACT_MODEL_H
#include "amici/defines.h"
#include "amici/splinefunctions.h"
#include "amici/sundials_matrix_wrapper.h"
#include "amici/vector.h"
#include <sunmatrix/sunmatrix_band.h>
#include <sunmatrix/sunmatrix_dense.h>
#include <sunmatrix/sunmatrix_sparse.h>
#include <memory>
namespace amici {
class Solver;
class AbstractModel {
public:
virtual ~AbstractModel() = default;
virtual std::unique_ptr<Solver> getSolver() = 0;
virtual void froot(
realtype const t, AmiVector const& x, AmiVector const& dx,
gsl::span<realtype> root
) = 0;
virtual void fxdot(
realtype const t, AmiVector const& x, AmiVector const& dx,
AmiVector& xdot
) = 0;
virtual void fsxdot(
realtype const t, AmiVector const& x, AmiVector const& dx, int ip,
AmiVector const& sx, AmiVector const& sdx, AmiVector& sxdot
) = 0;
virtual void fxBdot_ss(
realtype const t, AmiVector const& xB, AmiVector const& dxB,
AmiVector& xBdot
) = 0;
virtual void fJSparseB_ss(SUNMatrix JB) = 0;
virtual void writeSteadystateJB(
realtype const t, realtype cj, AmiVector const& x, AmiVector const& dx,
AmiVector const& xB, AmiVector const& dxB, AmiVector const& xBdot
) = 0;
virtual void
fJ(realtype const t, realtype cj, AmiVector const& x, AmiVector const& dx,
AmiVector const& xdot, SUNMatrix J)
= 0;
virtual void
fJB(realtype const t, realtype cj, AmiVector const& x, AmiVector const& dx,
AmiVector const& xB, AmiVector const& dxB, AmiVector const& xBdot,
SUNMatrix JB)
= 0;
virtual void fJSparse(
realtype const t, realtype cj, AmiVector const& x, AmiVector const& dx,
AmiVector const& xdot, SUNMatrix J
) = 0;
virtual void fJSparseB(
realtype const t, realtype cj, AmiVector const& x, AmiVector const& dx,
AmiVector const& xB, AmiVector const& dxB, AmiVector const& xBdot,
SUNMatrix JB
) = 0;
virtual void fJDiag(
realtype const t, AmiVector& Jdiag, realtype cj, AmiVector const& x,
AmiVector const& dx
) = 0;
virtual void
fdxdotdp(realtype const t, AmiVector const& x, AmiVector const& dx)
= 0;
virtual void
fJv(realtype const t, AmiVector const& x, AmiVector const& dx,
AmiVector const& xdot, AmiVector const& v, AmiVector& nJv, realtype cj)
= 0;
virtual std::string getAmiciVersion() const;
virtual std::string getAmiciCommit() const;
virtual void
fx0(realtype* x0, realtype const t, realtype const* p, realtype const* k);
virtual bool isFixedParameterStateReinitializationAllowed() const;
virtual void fx0_fixedParameters(
realtype* x0, realtype const t, realtype const* p, realtype const* k,
gsl::span<int const> reinitialization_state_idxs
);
virtual void fsx0_fixedParameters(
realtype* sx0, realtype const t, realtype const* x0, realtype const* p,
realtype const* k, int ip,
gsl::span<int const> reinitialization_state_idxs
);
virtual void fsx0(
realtype* sx0, realtype const t, realtype const* x0, realtype const* p,
realtype const* k, int ip
);
virtual void fdx0(AmiVector& x0, AmiVector& dx0);
virtual void fstau(
realtype* stau, realtype const t, realtype const* x, realtype const* p,
realtype const* k, realtype const* h, realtype const* tcl,
realtype const* sx, int ip, int ie
);
virtual void
fy(realtype* y, realtype const t, realtype const* x, realtype const* p,
realtype const* k, realtype const* h, realtype const* w);
virtual void fdydp(
realtype* dydp, realtype const t, realtype const* x, realtype const* p,
realtype const* k, realtype const* h, int ip, realtype const* w,
realtype const* dwdp
);
virtual void fdydp(
realtype* dydp, realtype const t, realtype const* x, realtype const* p,
realtype const* k, realtype const* h, int ip, realtype const* w,
realtype const* tcl, realtype const* dtcldp, realtype const* spl,
realtype const* sspl
);
virtual void fdydx(
realtype* dydx, realtype const t, realtype const* x, realtype const* p,
realtype const* k, realtype const* h, realtype const* w,
realtype const* dwdx
);
virtual void
fz(realtype* z, int ie, realtype const t, realtype const* x,
realtype const* p, realtype const* k, realtype const* h);
virtual void
fsz(realtype* sz, int ie, realtype const t, realtype const* x,
realtype const* p, realtype const* k, realtype const* h,
realtype const* sx, int ip);
virtual void
frz(realtype* rz, int ie, realtype const t, realtype const* x,
realtype const* p, realtype const* k, realtype const* h);
virtual void fsrz(
realtype* srz, int ie, realtype const t, realtype const* x,
realtype const* p, realtype const* k, realtype const* h,
realtype const* sx, int ip
);
virtual void fdzdp(
realtype* dzdp, int ie, realtype const t, realtype const* x,
realtype const* p, realtype const* k, realtype const* h, int ip
);
virtual void fdzdx(
realtype* dzdx, int ie, realtype const t, realtype const* x,
realtype const* p, realtype const* k, realtype const* h
);
virtual void fdrzdp(
realtype* drzdp, int ie, realtype const t, realtype const* x,
realtype const* p, realtype const* k, realtype const* h, int ip
);
virtual void fdrzdx(
realtype* drzdx, int ie, realtype const t, realtype const* x,
realtype const* p, realtype const* k, realtype const* h
);
virtual void fdeltax(
realtype* deltax, realtype const t, realtype const* x,
realtype const* p, realtype const* k, realtype const* h, int ie,
realtype const* xdot, realtype const* xdot_old
);
virtual void fdeltasx(
realtype* deltasx, realtype const t, realtype const* x,
realtype const* p, realtype const* k, realtype const* h,
realtype const* w, int ip, int ie, realtype const* xdot,
realtype const* xdot_old, realtype const* sx, realtype const* stau,
realtype const* tcl
);
virtual void fdeltaxB(
realtype* deltaxB, realtype const t, realtype const* x,
realtype const* p, realtype const* k, realtype const* h, int ie,
realtype const* xdot, realtype const* xdot_old, realtype const* xB
);
virtual void fdeltaqB(
realtype* deltaqB, realtype const t, realtype const* x,
realtype const* p, realtype const* k, realtype const* h, int ip, int ie,
realtype const* xdot, realtype const* xdot_old, realtype const* xB
);
virtual void fsigmay(
realtype* sigmay, realtype const t, realtype const* p,
realtype const* k, realtype const* y
);
virtual void fdsigmaydp(
realtype* dsigmaydp, realtype const t, realtype const* p,
realtype const* k, realtype const* y, int ip
);
virtual void fdsigmaydy(
realtype* dsigmaydy, realtype const t, realtype const* p,
realtype const* k, realtype const* y
);
virtual void fsigmaz(
realtype* sigmaz, realtype const t, realtype const* p, realtype const* k
);
virtual void fdsigmazdp(
realtype* dsigmazdp, realtype const t, realtype const* p,
realtype const* k, int ip
);
virtual void
fJy(realtype* nllh, int iy, realtype const* p, realtype const* k,
realtype const* y, realtype const* sigmay, realtype const* my);
virtual void
fJz(realtype* nllh, int iz, realtype const* p, realtype const* k,
realtype const* z, realtype const* sigmaz, realtype const* mz);
virtual void fJrz(
realtype* nllh, int iz, realtype const* p, realtype const* k,
realtype const* z, realtype const* sigmaz
);
virtual void fdJydy(
realtype* dJydy, int iy, realtype const* p, realtype const* k,
realtype const* y, realtype const* sigmay, realtype const* my
);
virtual void fdJydy_colptrs(SUNMatrixWrapper& dJydy, int index);
virtual void fdJydy_rowvals(SUNMatrixWrapper& dJydy, int index);
virtual void fdJydsigma(
realtype* dJydsigma, int iy, realtype const* p, realtype const* k,
realtype const* y, realtype const* sigmay, realtype const* my
);
virtual void fdJzdz(
realtype* dJzdz, int iz, realtype const* p, realtype const* k,
realtype const* z, realtype const* sigmaz, realtype const* mz
);
virtual void fdJzdsigma(
realtype* dJzdsigma, int iz, realtype const* p, realtype const* k,
realtype const* z, realtype const* sigmaz, realtype const* mz
);
virtual void fdJrzdz(
realtype* dJrzdz, int iz, realtype const* p, realtype const* k,
realtype const* rz, realtype const* sigmaz
);
virtual void fdJrzdsigma(
realtype* dJrzdsigma, int iz, realtype const* p, realtype const* k,
realtype const* rz, realtype const* sigmaz
);
virtual void
fw(realtype* w, realtype const t, realtype const* x, realtype const* p,
realtype const* k, realtype const* h, realtype const* tcl,
realtype const* spl, bool include_static = true);
virtual void fdwdp(
realtype* dwdp, realtype const t, realtype const* x, realtype const* p,
realtype const* k, realtype const* h, realtype const* w,
realtype const* tcl, realtype const* stcl, realtype const* spl,
realtype const* sspl, bool include_static = true
);
virtual void fdwdp_colptrs(SUNMatrixWrapper& dwdp);
virtual void fdwdp_rowvals(SUNMatrixWrapper& dwdp);
virtual void fdwdx(
realtype* dwdx, realtype const t, realtype const* x, realtype const* p,
realtype const* k, realtype const* h, realtype const* w,
realtype const* tcl, realtype const* spl, bool include_static = true
);
virtual void fdwdx_colptrs(SUNMatrixWrapper& dwdx);
virtual void fdwdx_rowvals(SUNMatrixWrapper& dwdx);
virtual void fdwdw(
realtype* dwdw, realtype t, realtype const* x, realtype const* p,
realtype const* k, realtype const* h, realtype const* w,
realtype const* tcl, bool include_static = true
);
virtual void fdwdw_colptrs(SUNMatrixWrapper& dwdw);
virtual void fdwdw_rowvals(SUNMatrixWrapper& dwdw);
virtual void fdx_rdatadx_solver(
realtype* dx_rdatadx_solver, realtype const* x, realtype const* tcl,
realtype const* p, realtype const* k
);
virtual void fdx_rdatadx_solver_colptrs(SUNMatrixWrapper& dxrdatadxsolver);
virtual void fdx_rdatadx_solver_rowvals(SUNMatrixWrapper& dxrdatadxsolver);
virtual void fdx_rdatadp(
realtype* dx_rdatadp, realtype const* x, realtype const* tcl,
realtype const* p, realtype const* k, int const ip
);
virtual void fdx_rdatadtcl(
realtype* dx_rdatadtcl, realtype const* x, realtype const* tcl,
realtype const* p, realtype const* k
);
virtual void fdx_rdatadtcl_colptrs(SUNMatrixWrapper& dx_rdatadtcl);
virtual void fdx_rdatadtcl_rowvals(SUNMatrixWrapper& dx_rdatadtcl);
virtual void fdtotal_cldp(
realtype* dtotal_cldp, realtype const* x_rdata, realtype const* p,
realtype const* k, int const ip
);
virtual void fdtotal_cldx_rdata(
realtype* dtotal_cldx_rdata, realtype const* x_rdata, realtype const* p,
realtype const* k, realtype const* tcl
);
virtual void fdtotal_cldx_rdata_colptrs(SUNMatrixWrapper& dtotal_cldx_rdata
);
virtual void fdtotal_cldx_rdata_rowvals(SUNMatrixWrapper& dtotal_cldx_rdata
);
virtual std::vector<HermiteSpline>
fcreate_splines(realtype const* p, realtype const* k);
virtual void fdspline_valuesdp(
realtype* dspline_valuesdp, realtype const* p, realtype const* k,
int const ip
);
virtual void fdspline_slopesdp(
realtype* dspline_slopesdp, realtype const* p, realtype const* k,
int const ip
);
};
} // namespace amici
#endif // AMICI_ABSTRACT_MODEL_H