Skip to content
Merged

Cleanup #2907

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
2 changes: 1 addition & 1 deletion include/amici/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Event {
* @brief Get the initial value of the root function
* @return The value of the root function at t_0.
*/
bool get_initial_value() { return initial_value_; }
bool get_initial_value() const { return initial_value_; }

/**
* @brief Get the priority of the event assignments
Expand Down
2 changes: 1 addition & 1 deletion include/amici/model_dae.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class Model_DAE : public Model {

void
fJv(realtype t, AmiVector const& x, AmiVector const& dx,
AmiVector const& xdot, AmiVector const& v, AmiVector& nJv,
AmiVector const& xdot, AmiVector const& v, AmiVector& Jv,
realtype cj) override;

/**
Expand Down
2 changes: 1 addition & 1 deletion include/amici/model_ode.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class Model_ODE : public Model {

void
fJv(realtype t, AmiVector const& x, AmiVector const& dx,
AmiVector const& xdot, AmiVector const& v, AmiVector& nJv,
AmiVector const& xdot, AmiVector const& v, AmiVector& Jv,
realtype cj) override;

/**
Expand Down
6 changes: 2 additions & 4 deletions include/amici/solver.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ class Solver;
} // namespace amici

// for serialization friend in Solver
namespace boost {
namespace serialization {
namespace boost::serialization {
template <class Archive>
void serialize(Archive& ar, amici::Solver& s, unsigned int version);
}
} // namespace boost
} // namespace boost::serialization

namespace amici {

Expand Down
12 changes: 5 additions & 7 deletions include/amici/vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ class AmiVector;
}

// for serialization friend
namespace boost {
namespace serialization {
namespace boost::serialization {
template <class Archive>
void serialize(Archive& ar, amici::AmiVector& v, unsigned int version);
}
} // namespace boost
} // namespace boost::serialization

namespace amici {

Expand Down Expand Up @@ -51,7 +49,7 @@ class AmiVector {
* @param length number of elements in vector
* @param sunctx SUNDIALS context
*/
explicit AmiVector(long int const length, SUNContext sunctx)
explicit AmiVector(long int const length, SUNContext const sunctx)
: vec_(static_cast<decltype(vec_)::size_type>(length), 0.0)
, nvec_(N_VMake_Serial(length, vec_.data(), sunctx)) {}

Expand All @@ -63,7 +61,7 @@ class AmiVector {
* @param rvec vector from which the data will be moved
* @param sunctx SUNDIALS context
*/
explicit AmiVector(std::vector<realtype> rvec, SUNContext sunctx)
explicit AmiVector(std::vector<realtype> rvec, SUNContext const sunctx)
: vec_(std::move(rvec))
, nvec_(N_VMake_Serial(
gsl::narrow<long int>(vec_.size()), vec_.data(), sunctx
Expand All @@ -74,7 +72,7 @@ class AmiVector {
* @param rvec vector from which the data will be copied
* @param sunctx SUNDIALS context
*/
explicit AmiVector(gsl::span<realtype const> rvec, SUNContext sunctx)
explicit AmiVector(gsl::span<realtype const> const rvec, SUNContext const sunctx)
: AmiVector(std::vector(rvec.begin(), rvec.end()), sunctx) {}

/**
Expand Down
14 changes: 7 additions & 7 deletions src/backwardproblem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ BwdSimWorkspace::BwdSimWorkspace(
, xQB_(model_->nJ * model_->nplist(), solver->getSunContext()) {}

void EventHandlingBwdSimulator::run(
realtype t_start, realtype t_end, realtype it,
realtype const t_start, realtype const t_end, realtype it,
std::vector<realtype> const& timepoints, std::vector<realtype> const* dJydx,
std::vector<realtype> const* dJzdx
) {
Expand Down Expand Up @@ -311,15 +311,15 @@ SteadyStateBackwardProblem::SteadyStateBackwardProblem(
, solver_(&solver)
, ws_(ws) {}

void SteadyStateBackwardProblem::run(realtype t0) {
void SteadyStateBackwardProblem::run(realtype const t0) {
newton_solver_.reinitialize();

// initialize quadratures
xQ_.zero();
ws_->xQB_.zero();

// Compute quadratures, track computation time
CpuTimer cpu_timer;
CpuTimer const cpu_timer;

compute_steady_state_quadrature(t0);
cpu_timeB_ = cpu_timer.elapsed_milliseconds();
Expand All @@ -333,7 +333,7 @@ AmiVector const& SteadyStateBackwardProblem::getAdjointQuadrature() const {
return ws_->xQB_;
}

void SteadyStateBackwardProblem::compute_steady_state_quadrature(realtype t0) {
void SteadyStateBackwardProblem::compute_steady_state_quadrature(realtype const t0) {
// This routine computes the quadratures:
// xQB = Integral[ xB(x(t), t, p) * dxdot/dp(x(t), t, p) | dt ]
// As we're in steady state, we have x(t) = x_ss (x_steadystate), hence
Expand Down Expand Up @@ -399,7 +399,7 @@ void SteadyStateBackwardProblem::compute_quadrature_by_lin_solve() {
}
}

void SteadyStateBackwardProblem::compute_quadrature_by_simulation(realtype t0) {
void SteadyStateBackwardProblem::compute_quadrature_by_simulation(realtype const t0) {
// If the Jacobian is singular, the integral over xB must be computed
// by usual integration over time, but simplifications can be applied:
// x is not time-dependent, no forward trajectory is needed.
Expand All @@ -409,7 +409,7 @@ void SteadyStateBackwardProblem::compute_quadrature_by_simulation(realtype t0) {
// xQ was written in getQuadratureByLinSolve() -> set to zero
xQ_.zero();

auto sim_solver = std::unique_ptr<Solver>(solver_->clone());
auto const sim_solver = std::unique_ptr<Solver>(solver_->clone());
sim_solver->logger = solver_->logger;
sim_solver->setSensitivityMethod(SensitivityMethod::none);
sim_solver->setSensitivityOrder(SensitivityOrder::none);
Expand Down Expand Up @@ -454,7 +454,7 @@ void SteadyStateBackwardProblem::run_simulation(Solver const& solver) {
AmiVector xQBdot(model_->nplist(), solver.getSunContext());

int const convergence_check_frequency = newton_step_conv_ ? 25 : 1;
auto max_steps = (solver.getMaxStepsBackwardProblem() > 0)
auto const max_steps = (solver.getMaxStepsBackwardProblem() > 0)
? solver.getMaxStepsBackwardProblem()
: solver.getMaxSteps() * 100;

Expand Down
2 changes: 1 addition & 1 deletion src/cblas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void amici_dgemv(
}

void amici_daxpy(
int n, double alpha, double const* x, int const incx, double* y, int incy
int const n, double const alpha, double const* x, int const incx, double* y, int const incy
) {
BLAS_FUNC(daxpy)(n, alpha, x, incx, y, incy);
}
Expand Down
Loading
Loading