diff --git a/include/amici/model_dae.h b/include/amici/model_dae.h index 232bfc867d..03ffbf8fb9 100644 --- a/include/amici/model_dae.h +++ b/include/amici/model_dae.h @@ -53,10 +53,10 @@ class Model_DAE : public Model { std::map> state_independent_events = {} ) : Model( - model_dimensions, simulation_parameters, o2mode, idlist, z2event, - pythonGenerated, ndxdotdp_explicit, ndxdotdx_explicit, - w_recursion_depth, state_independent_events - ) { + model_dimensions, simulation_parameters, o2mode, idlist, z2event, + pythonGenerated, ndxdotdp_explicit, ndxdotdx_explicit, + w_recursion_depth, state_independent_events + ) { derived_state_.M_ = SUNMatrixWrapper(nx_solver, nx_solver); auto M_nnz = static_cast( std::reduce(idlist.begin(), idlist.end()) diff --git a/include/amici/model_ode.h b/include/amici/model_ode.h index 3632c2198f..24d410a33c 100644 --- a/include/amici/model_ode.h +++ b/include/amici/model_ode.h @@ -52,10 +52,10 @@ class Model_ODE : public Model { std::map> state_independent_events = {} ) : Model( - model_dimensions, simulation_parameters, o2mode, idlist, z2event, - pythonGenerated, ndxdotdp_explicit, ndxdotdx_explicit, - w_recursion_depth, state_independent_events - ) {} + model_dimensions, simulation_parameters, o2mode, idlist, z2event, + pythonGenerated, ndxdotdp_explicit, ndxdotdx_explicit, + w_recursion_depth, state_independent_events + ) {} void fJ(realtype t, realtype cj, AmiVector const& x, AmiVector const& dx, diff --git a/src/edata.cpp b/src/edata.cpp index 2408e4becd..a4c0868ad8 100644 --- a/src/edata.cpp +++ b/src/edata.cpp @@ -59,9 +59,9 @@ ExpData::ExpData( ExpData::ExpData(Model const& model) : ExpData( - model.nytrue, model.nztrue, model.nMaxEvent(), model.getTimepoints(), - model.getFixedParameters() - ) { + model.nytrue, model.nztrue, model.nMaxEvent(), model.getTimepoints(), + model.getFixedParameters() + ) { reinitializeFixedParameterInitialStates = model.getReinitializeFixedParameterInitialStates() && model.getReinitializationStateIdxs().empty(); @@ -70,9 +70,9 @@ ExpData::ExpData(Model const& model) ExpData::ExpData(ReturnData const& rdata, realtype sigma_y, realtype sigma_z) : ExpData( - rdata, std::vector(rdata.nytrue * rdata.nt, sigma_y), - std::vector(rdata.nztrue * rdata.nmaxevent, sigma_z) - ) {} + rdata, std::vector(rdata.nytrue * rdata.nt, sigma_y), + std::vector(rdata.nztrue * rdata.nmaxevent, sigma_z) + ) {} ExpData::ExpData( ReturnData const& rdata, std::vector sigma_y, diff --git a/src/exception.cpp b/src/exception.cpp index 81ec938d29..984be52821 100644 --- a/src/exception.cpp +++ b/src/exception.cpp @@ -37,17 +37,17 @@ CvodeException::CvodeException( int const error_code, char const* function, char const* extra ) : AmiException( - "CVODE routine %s failed with error code %i. %s", function, error_code, - extra ? extra : "" - ) {} + "CVODE routine %s failed with error code %i. %s", function, + error_code, extra ? extra : "" + ) {} IDAException::IDAException( int const error_code, char const* function, char const* extra ) : AmiException( - "IDA routine %s failed with error code %i. %s", function, error_code, - extra ? extra : "" - ) {} + "IDA routine %s failed with error code %i. %s", function, error_code, + extra ? extra : "" + ) {} IntegrationFailure::IntegrationFailure(int code, realtype t) : AmiException("AMICI failed to integrate the forward problem") @@ -61,8 +61,8 @@ IntegrationFailureB::IntegrationFailureB(int code, realtype t) NewtonFailure::NewtonFailure(int code, char const* function) : AmiException( - "NewtonSolver routine %s failed with error code %i", function, code - ) { + "NewtonSolver routine %s failed with error code %i", function, code + ) { error_code = code; } diff --git a/src/interface_matlab.cpp b/src/interface_matlab.cpp index e0f4702f34..93ffb24fdd 100644 --- a/src/interface_matlab.cpp +++ b/src/interface_matlab.cpp @@ -423,8 +423,10 @@ void setModelData(mxArray const* prhs[], int nrhs, Model& model) { model.setParameterScale( static_cast(dbl2int(mxGetScalar(a))) ); - } else if((mxGetM(a) == 1 && gsl::narrow(mxGetN(a)) == model.np()) - || (mxGetN(a) == 1 && gsl::narrow(mxGetM(a)) == model.np())) { + } else if ((mxGetM(a) == 1 + && gsl::narrow(mxGetN(a)) == model.np()) + || (mxGetN(a) == 1 + && gsl::narrow(mxGetM(a)) == model.np())) { auto pscaleArray = static_cast(mxGetData(a)); std::vector pscale(model.np()); for (int ip = 0; ip < model.np(); ++ip) { @@ -597,7 +599,9 @@ void mexFunction(int nlhs, mxArray* plhs[], int nrhs, mxArray const* prhs[]) { ex.what() ); } - } else if (solver->getSensitivityOrder() >= amici::SensitivityOrder::first && solver->getSensitivityMethod() == amici::SensitivityMethod::adjoint) { + } else if (solver->getSensitivityOrder() >= amici::SensitivityOrder::first + && solver->getSensitivityMethod() + == amici::SensitivityMethod::adjoint) { mexErrMsgIdAndTxt("AMICI:mex:setup", "No data provided!"); } diff --git a/src/newton_solver.cpp b/src/newton_solver.cpp index c14b05c7f2..72bf0a3d64 100644 --- a/src/newton_solver.cpp +++ b/src/newton_solver.cpp @@ -145,7 +145,7 @@ void NewtonSolverDense::solveLinearSystem(AmiVector& rhs) { throw NewtonFailure(status, "SUNLinSolSolve_Dense"); } -void NewtonSolverDense::reinitialize(){ +void NewtonSolverDense::reinitialize() { /* dense solver does not need reinitialization */ }; diff --git a/src/rdata.cpp b/src/rdata.cpp index d7b99f3c8a..649b420ccb 100644 --- a/src/rdata.cpp +++ b/src/rdata.cpp @@ -15,14 +15,14 @@ namespace amici { ReturnData::ReturnData(Solver const& solver, Model const& model) : ReturnData( - model.getTimepoints(), - ModelDimensions(static_cast(model)), - model.nplist(), model.nMaxEvent(), model.nt(), - solver.getNewtonMaxSteps(), model.getParameterScale(), model.o2mode, - solver.getSensitivityOrder(), solver.getSensitivityMethod(), - solver.getReturnDataReportingMode(), model.hasQuadraticLLH(), - model.getAddSigmaResiduals(), model.getMinimumSigmaResiduals() - ) {} + model.getTimepoints(), + ModelDimensions(static_cast(model)), + model.nplist(), model.nMaxEvent(), model.nt(), + solver.getNewtonMaxSteps(), model.getParameterScale(), model.o2mode, + solver.getSensitivityOrder(), solver.getSensitivityMethod(), + solver.getReturnDataReportingMode(), model.hasQuadraticLLH(), + model.getAddSigmaResiduals(), model.getMinimumSigmaResiduals() + ) {} ReturnData::ReturnData( std::vector ts, ModelDimensions const& model_dimensions, diff --git a/src/spline.cpp b/src/spline.cpp index 4e7d742520..719af0a86e 100644 --- a/src/spline.cpp +++ b/src/spline.cpp @@ -217,7 +217,7 @@ double seval( j = k; /* move the upper bound */ if (u >= x[k]) i = k; /* move the lower bound */ - } /* there are no more segments to search */ + } /* there are no more segments to search */ while (j > i + 1); } } @@ -273,7 +273,7 @@ double sinteg( j = k; /* move the upper bound */ if (u >= x[k]) i = k; /* move the lower bound */ - } /* there are no more segments to search */ + } /* there are no more segments to search */ while (j > i + 1); } diff --git a/src/splinefunctions.cpp b/src/splinefunctions.cpp index f5d2599ea7..0b07a75aa9 100644 --- a/src/splinefunctions.cpp +++ b/src/splinefunctions.cpp @@ -145,9 +145,9 @@ HermiteSpline::HermiteSpline( bool logarithmic_parametrization ) : AbstractSpline( - std::move(nodes), std::move(node_values), equidistant_spacing, - logarithmic_parametrization - ) + std::move(nodes), std::move(node_values), equidistant_spacing, + logarithmic_parametrization + ) , node_values_derivative_(std::move(node_values_derivative)) , first_node_bc_(firstNodeBC) , last_node_bc_(lastNodeBC) @@ -602,21 +602,25 @@ void HermiteSpline::compute_coefficients_extrapolation_sensi( case SplineExtrapolation::linear: if (first_node_bc_ == SplineBoundaryCondition::zeroDerivative) { sm0 = 0; - } else if (get_node_derivative_by_fd() && first_node_bc_ == SplineBoundaryCondition::given) { + } else if (get_node_derivative_by_fd() + && first_node_bc_ == SplineBoundaryCondition::given) { sm0 = (dvaluesdp[spline_offset + ip + nplist] - sp0) / (nodes_[1] - nodes_[0]); - } else if (get_node_derivative_by_fd() && first_node_bc_ == SplineBoundaryCondition::natural) { + } else if (get_node_derivative_by_fd() + && first_node_bc_ == SplineBoundaryCondition::natural) { throw AmiException( "Natural boundary condition for " "Hermite splines with linear extrapolation is " "not yet implemented." ); - } else if (!get_node_derivative_by_fd() && first_node_bc_ == SplineBoundaryCondition::given) { + } else if (!get_node_derivative_by_fd() + && first_node_bc_ == SplineBoundaryCondition::given) { sm0 = dslopesdp[spline_offset + ip]; - } else if (!get_node_derivative_by_fd() && first_node_bc_ == SplineBoundaryCondition::natural) { + } else if (!get_node_derivative_by_fd() + && first_node_bc_ == SplineBoundaryCondition::natural) { throw AmiException( "Natural boundary condition for " "Hermite splines with linear extrapolation is " @@ -662,24 +666,28 @@ void HermiteSpline::compute_coefficients_extrapolation_sensi( case SplineExtrapolation::linear: if (last_node_bc_ == SplineBoundaryCondition::zeroDerivative) { sm_end = 0; - } else if (get_node_derivative_by_fd() && last_node_bc_ == SplineBoundaryCondition::given) { + } else if (get_node_derivative_by_fd() + && last_node_bc_ == SplineBoundaryCondition::given) { sm_end = (sp_end - dvaluesdp [spline_offset + ip + (n_nodes() - 2) * nplist]) / (nodes_[n_nodes() - 1] - nodes_[n_nodes() - 2]); - } else if (get_node_derivative_by_fd() && last_node_bc_ == SplineBoundaryCondition::natural) { + } else if (get_node_derivative_by_fd() + && last_node_bc_ == SplineBoundaryCondition::natural) { throw AmiException( "Natural boundary condition for " "Hermite splines with linear extrapolation is " "not yet implemented." ); - } else if (!get_node_derivative_by_fd() && last_node_bc_ == SplineBoundaryCondition::given) { + } else if (!get_node_derivative_by_fd() + && last_node_bc_ == SplineBoundaryCondition::given) { sm_end = dslopesdp[spline_offset + ip + (n_nodes() - 1) * nplist]; - } else if (!get_node_derivative_by_fd() && last_node_bc_ == SplineBoundaryCondition::natural) { + } else if (!get_node_derivative_by_fd() + && last_node_bc_ == SplineBoundaryCondition::natural) { throw AmiException( "Natural boundary condition for " "Hermite splines with linear extrapolation is " diff --git a/src/sundials_linsol_wrapper.cpp b/src/sundials_linsol_wrapper.cpp index 5752ea03c3..6836949cb8 100644 --- a/src/sundials_linsol_wrapper.cpp +++ b/src/sundials_linsol_wrapper.cpp @@ -277,8 +277,8 @@ N_Vector SUNLinSolSPBCGS::getResid() const { SUNLinSolSPFGMR::SUNLinSolSPFGMR(AmiVector const& x, int pretype, int maxl) : SUNLinSolWrapper( - SUNLinSol_SPFGMR(const_cast(x.getNVector()), pretype, maxl) - ) { + SUNLinSol_SPFGMR(const_cast(x.getNVector()), pretype, maxl) + ) { if (!solver_) throw AmiException("Failed to create solver."); } @@ -311,8 +311,8 @@ N_Vector SUNLinSolSPFGMR::getResid() const { SUNLinSolSPGMR::SUNLinSolSPGMR(AmiVector const& x, int pretype, int maxl) : SUNLinSolWrapper( - SUNLinSol_SPGMR(const_cast(x.getNVector()), pretype, maxl) - ) { + SUNLinSol_SPGMR(const_cast(x.getNVector()), pretype, maxl) + ) { if (!solver_) throw AmiException("Failed to create solver."); } @@ -404,8 +404,8 @@ SUNNonLinSolFixedPoint::SUNNonLinSolFixedPoint( int count, const_N_Vector x, int m ) : SUNNonLinSolWrapper( - SUNNonlinSol_FixedPointSens(count, const_cast(x), m) - ) {} + SUNNonlinSol_FixedPointSens(count, const_cast(x), m) + ) {} int SUNNonLinSolFixedPoint::getSysFn(SUNNonlinSolSysFn* SysFn) const { return SUNNonlinSolGetSysFn_FixedPoint(solver, SysFn);