Program Listing for File model_state.h

Return to documentation for file (include/amici/model_state.h)

#ifndef AMICI_MODEL_STATE_H
#define AMICI_MODEL_STATE_H

#include "amici/defines.h"
#include "amici/misc.h"
#include "amici/model_dimensions.h"
#include "amici/sundials_matrix_wrapper.h"

#include <vector>

namespace amici {

struct ModelState {
    std::vector<realtype> h;

    std::vector<realtype> total_cl;

    std::vector<realtype> stotal_cl;

    std::vector<realtype> unscaledParameters;

    std::vector<realtype> fixedParameters;

    std::vector<int> plist;

    std::vector<realtype> spl_;
};

inline bool operator==(ModelState const& a, ModelState const& b) {
    return is_equal(a.h, b.h) && is_equal(a.total_cl, b.total_cl)
           && is_equal(a.stotal_cl, b.stotal_cl)
           && is_equal(a.unscaledParameters, b.unscaledParameters)
           && is_equal(a.fixedParameters, b.fixedParameters)
           && a.plist == b.plist;
}

struct ModelStateDerived {
    ModelStateDerived() = default;

    explicit ModelStateDerived(ModelDimensions const& dim);

    SUNMatrixWrapper J_;

    SUNMatrixWrapper JB_;

    SUNMatrixWrapper dxdotdw_;

    SUNMatrixWrapper dwdx_;

    SUNMatrixWrapper dwdp_;

    SUNMatrixWrapper M_;

    SUNMatrixWrapper MSparse_;

    SUNMatrixWrapper dfdx_;

    SUNMatrixWrapper dxdotdp_full;

    SUNMatrixWrapper dxdotdp_explicit;

    SUNMatrixWrapper dxdotdp_implicit;

    SUNMatrixWrapper dxdotdx_explicit;

    SUNMatrixWrapper dxdotdx_implicit;

    SUNMatrixWrapper dx_rdatadx_solver;

    SUNMatrixWrapper dx_rdatadtcl;

    SUNMatrixWrapper dtotal_cldx_rdata;

    AmiVectorArray dxdotdp{0, 0};

    std::vector<SUNMatrixWrapper> dJydy_;

    std::vector<realtype> dJydy_matlab_;

    std::vector<realtype> dJydsigma_;

    std::vector<realtype> dJydx_;

    std::vector<realtype> dJydp_;

    std::vector<realtype> dJzdz_;

    std::vector<realtype> dJzdsigma_;

    std::vector<realtype> dJrzdz_;

    std::vector<realtype> dJrzdsigma_;

    std::vector<realtype> dJzdx_;

    std::vector<realtype> dJzdp_;

    std::vector<realtype> dzdx_;

    std::vector<realtype> dzdp_;

    std::vector<realtype> drzdx_;

    std::vector<realtype> drzdp_;

    std::vector<realtype> dydp_;

    std::vector<realtype> dydx_;

    std::vector<realtype> w_;

    std::vector<realtype> sx_;

    std::vector<realtype> sy_;

    std::vector<realtype> x_rdata_;

    std::vector<realtype> sx_rdata_;

    std::vector<realtype> y_;

    std::vector<realtype> sigmay_;

    std::vector<realtype> dsigmaydp_;

    std::vector<realtype> dsigmaydy_;

    std::vector<realtype> z_;

    std::vector<realtype> rz_;

    std::vector<realtype> sigmaz_;

    std::vector<realtype> dsigmazdp_;

    std::vector<realtype> deltax_;

    std::vector<realtype> deltasx_;

    std::vector<realtype> deltaxB_;

    std::vector<realtype> deltaqB_;

    SUNMatrixWrapper sspl_;

    AmiVector x_pos_tmp_{0};
};

struct SimulationState {
    realtype t;
    AmiVector x;
    AmiVector dx;
    AmiVectorArray sx;
    ModelState state;
};

} // namespace amici

#endif // AMICI_MODEL_STATE_H