Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 10 additions & 95 deletions include/amici/model_dimensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,94 +12,10 @@ namespace amici {
* Holds number of state variables, observables, etc.
*/
struct ModelDimensions {
/** Default ctor */
ModelDimensions() = default;

/**
* @brief Constructor with model dimensions
* @param nx_rdata Number of state variables
* @param nxtrue_rdata Number of state variables of the non-augmented model
* @param nx_solver Number of state variables with conservation laws applied
* @param nxtrue_solver Number of state variables of the non-augmented model
* with conservation laws applied
* @param nx_solver_reinit Number of state variables with conservation laws
* subject to reinitialization
* @param np Number of parameters
* @param nk Number of constants
* @param ny Number of observables
* @param nytrue Number of observables of the non-augmented model
* @param nz Number of event observables
* @param nztrue Number of event observables of the non-augmented model
* @param ne Number of events
* @param ne_solver Number of events that require root-finding
* @param nspl Number of splines
* @param nJ Number of objective functions
* @param nw Number of repeating elements
* @param ndwdx Number of nonzero elements in the `x` derivative of the
* repeating elements
* @param ndwdp Number of nonzero elements in the `p` derivative of the
* repeating elements
* @param ndwdw Number of nonzero elements in the `w` derivative of the
* repeating elements
* @param ndxdotdw Number of nonzero elements in the \f$ w\f$ derivative of
* \f$ xdot\f$
* @param ndJydy Number of nonzero elements in the \f$ y\f$ derivative of
* \f$ dJy\f$ (shape `nytrue`)
* @param ndxrdatadxsolver Number of nonzero elements in the \f$ x\f$
* derivative of \f$ x_rdata\f$
* @param ndxrdatadtcl Number of nonzero elements in the \f$ tcl\f$
* derivative of \f$ x_rdata\f$
* @param ndtotal_cldx_rdata Number of nonzero elements in the
* \f$ x_rdata \f$ derivative of \f$ total_cl \f$
* @param nnz Number of nonzero elements in Jacobian
* @param ubw Upper matrix bandwidth in the Jacobian
* @param lbw Lower matrix bandwidth in the Jacobian
* @param ndxdotdp_explicit Number of nonzero elements in `dxdotdp_explicit`
* @param ndxdotdx_explicit Number of nonzero elements in `dxdotdx_explicit`
* @param w_recursion_depth Recursion depth of fw
* @brief Validate dimensions.
*/
ModelDimensions(
int const nx_rdata, int const nxtrue_rdata, int const nx_solver,
int const nxtrue_solver, int const nx_solver_reinit, int const np,
int const nk, int const ny, int const nytrue, int const nz,
int const nztrue, int const ne, int const ne_solver, int const nspl,
int const nJ, int const nw, int const ndwdx, int const ndwdp,
int const ndwdw, int const ndxdotdw, std::vector<int> ndJydy,
int const ndxrdatadxsolver, int const ndxrdatadtcl,
int const ndtotal_cldx_rdata, int const nnz, int const ubw,
int const lbw, int ndxdotdp_explicit = 0, int ndxdotdx_explicit = 0,
int w_recursion_depth = 0
)
: nx_rdata(nx_rdata)
, nxtrue_rdata(nxtrue_rdata)
, nx_solver(nx_solver)
, nxtrue_solver(nxtrue_solver)
, nx_solver_reinit(nx_solver_reinit)
, np(np)
, nk(nk)
, ny(ny)
, nytrue(nytrue)
, nz(nz)
, nztrue(nztrue)
, ne(ne)
, ne_solver(ne_solver)
, nspl(nspl)
, nw(nw)
, ndwdx(ndwdx)
, ndwdp(ndwdp)
, ndwdw(ndwdw)
, ndxdotdw(ndxdotdw)
, ndJydy(std::move(ndJydy))
, ndxrdatadxsolver(ndxrdatadxsolver)
, ndxrdatadtcl(ndxrdatadtcl)
, ndtotal_cldx_rdata(ndtotal_cldx_rdata)
, nnz(nnz)
, nJ(nJ)
, ubw(ubw)
, lbw(lbw)
, ndxdotdp_explicit(ndxdotdp_explicit)
, ndxdotdx_explicit(ndxdotdx_explicit)
, w_recursion_depth(w_recursion_depth) {
void validate() const {
Expects(nxtrue_rdata >= 0);
Expects(nxtrue_rdata <= nx_rdata);
Expects(nxtrue_solver >= 0);
Expand Down Expand Up @@ -139,23 +55,22 @@ struct ModelDimensions {
Expects(ndxdotdx_explicit >= 0);
Expects(w_recursion_depth >= 0);
}

/** Number of states */
/** Number of state variables */
int nx_rdata{0};

/** Number of states in the unaugmented system */
/** Number of state variables in the unaugmented system */
int nxtrue_rdata{0};

/** Number of states with conservation laws applied */
/** Number of state variables with conservation laws applied */
int nx_solver{0};

/**
* Number of states in the unaugmented system with conservation laws
* applied
* Number of state variables in the unaugmented system with conservation
* laws applied
*/
int nxtrue_solver{0};

/** Number of solver states subject to reinitialization */
/** Number of solver state variables subject to reinitialization */
int nx_solver_reinit{0};

/** Number of parameters */
Expand Down Expand Up @@ -240,10 +155,10 @@ struct ModelDimensions {
/** Lower bandwidth of the Jacobian */
int lbw{0};

/** Number of nonzero elements in `dxdotdx_explicit` */
/** Number of nonzero elements in `dxdotdp_explicit` */
int ndxdotdp_explicit = 0;

/** Number of nonzero elements in `dxdotdp_explicit` */
/** Number of nonzero elements in `dxdotdx_explicit` */
int ndxdotdx_explicit = 0;

/** Recursion depth of fw */
Expand Down
2 changes: 1 addition & 1 deletion models/model_calvetti_py/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_policy(VERSION 3.22...3.31)

project(model_calvetti_py)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

Expand Down
66 changes: 33 additions & 33 deletions models/model_calvetti_py/model_calvetti_py.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,38 +110,38 @@ class Model_model_calvetti_py : public amici::Model_DAE {
*/
Model_model_calvetti_py()
: amici::Model_DAE(
amici::ModelDimensions(
6, // nx_rdata
6, // nxtrue_rdata
6, // nx_solver
6, // nxtrue_solver
0, // nx_solver_reinit
0, // np
6, // nk
6, // ny
6, // nytrue
0, // nz
0, // nztrue
4, // nevent
0, // nevent_solver
0, // nspl
1, // nobjective
17, // nw
15, // ndwdx
0, // ndwdp
16, // ndwdw
7, // ndxdotdw
std::vector<int>{1, 1, 1, 1, 1, 1}, // ndjydy
0, // ndxrdatadxsolver
0, // ndxrdatadtcl
0, // ndtotal_cldx_rdata
0, // nnz
6, // ubw
6, // lbw
0, // ndxdotdp_explicit
5, // ndxdotdx_explicit
2 // w_recursion_depth
),
amici::ModelDimensions{
.nx_rdata = 6,
.nxtrue_rdata = 6,
.nx_solver = 6,
.nxtrue_solver = 6,
.nx_solver_reinit = 0,
.np = 0,
.nk = 6,
.ny = 6,
.nytrue = 6,
.nz = 0,
.nztrue = 0,
.ne = 4,
.ne_solver = 0,
.nspl = 0,
.nw = 17,
.ndwdx = 15,
.ndwdp = 0,
.ndwdw = 16,
.ndxdotdw = 7,
.ndJydy = std::vector<int>{1, 1, 1, 1, 1, 1},
.ndxrdatadxsolver = 0,
.ndxrdatadtcl = 0,
.ndtotal_cldx_rdata = 0,
.nnz = 0,
.nJ = 1,
.ubw = 6,
.lbw = 6,
.ndxdotdp_explicit = 0,
.ndxdotdx_explicit = 5,
.w_recursion_depth = 2,
},
amici::SimulationParameters(
std::vector<realtype>{0.28999999999999998, 0.73999999999999999, 0.44, 0.080000000000000002, 0.27000000000000002, 0.17999999999999999}, // fixedParameters
std::vector<realtype>{} // dynamic parameters
Expand Down Expand Up @@ -557,7 +557,7 @@ class Model_model_calvetti_py : public amici::Model_DAE {
* @return AMICI git commit hash
*/
std::string getAmiciCommit() const override {
return "dcbbae0f8e9b52afd7ab8b4b7a046da36b907139";
return "570c71d2a041ed15d548e826df3d97e05d124309";
}

bool hasQuadraticLLH() const override {
Expand Down
2 changes: 1 addition & 1 deletion models/model_dirac_py/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_policy(VERSION 3.22...3.31)

project(model_dirac_py)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

Expand Down
66 changes: 33 additions & 33 deletions models/model_dirac_py/model_dirac_py.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,38 +110,38 @@ class Model_model_dirac_py : public amici::Model_ODE {
*/
Model_model_dirac_py()
: amici::Model_ODE(
amici::ModelDimensions(
2, // nx_rdata
2, // nxtrue_rdata
2, // nx_solver
2, // nxtrue_solver
0, // nx_solver_reinit
4, // np
0, // nk
1, // ny
1, // nytrue
0, // nz
0, // nztrue
1, // nevent
0, // nevent_solver
0, // nspl
1, // nobjective
1, // nw
0, // ndwdx
0, // ndwdp
0, // ndwdw
0, // ndxdotdw
std::vector<int>{1}, // ndjydy
0, // ndxrdatadxsolver
0, // ndxrdatadtcl
0, // ndtotal_cldx_rdata
0, // nnz
2, // ubw
2, // lbw
3, // ndxdotdp_explicit
3, // ndxdotdx_explicit
0 // w_recursion_depth
),
amici::ModelDimensions{
.nx_rdata = 2,
.nxtrue_rdata = 2,
.nx_solver = 2,
.nxtrue_solver = 2,
.nx_solver_reinit = 0,
.np = 4,
.nk = 0,
.ny = 1,
.nytrue = 1,
.nz = 0,
.nztrue = 0,
.ne = 1,
.ne_solver = 0,
.nspl = 0,
.nw = 1,
.ndwdx = 0,
.ndwdp = 0,
.ndwdw = 0,
.ndxdotdw = 0,
.ndJydy = std::vector<int>{1},
.ndxrdatadxsolver = 0,
.ndxrdatadtcl = 0,
.ndtotal_cldx_rdata = 0,
.nnz = 0,
.nJ = 1,
.ubw = 2,
.lbw = 2,
.ndxdotdp_explicit = 3,
.ndxdotdx_explicit = 3,
.w_recursion_depth = 0,
},
amici::SimulationParameters(
std::vector<realtype>{}, // fixedParameters
std::vector<realtype>{1.0, 0.5, 2.0, 3.0} // dynamic parameters
Expand Down Expand Up @@ -544,7 +544,7 @@ class Model_model_dirac_py : public amici::Model_ODE {
* @return AMICI git commit hash
*/
std::string getAmiciCommit() const override {
return "dcbbae0f8e9b52afd7ab8b4b7a046da36b907139";
return "570c71d2a041ed15d548e826df3d97e05d124309";
}

bool hasQuadraticLLH() const override {
Expand Down
2 changes: 1 addition & 1 deletion models/model_events_py/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_policy(VERSION 3.22...3.31)

project(model_events_py)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

Expand Down
Loading
Loading