Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: AMICI-dev/AMICI
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 92fc3f12a0a0b1a4700319ac9bef6a16355b9644
Choose a base ref
..
head repository: AMICI-dev/AMICI
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fd5fedcd2bae12f7d402b5ff5c8747d32dee3f14
Choose a head ref
Showing with 7 additions and 8 deletions.
  1. +1 −2 include/amici/vector.h
  2. +1 −1 src/solver.cpp
  3. +5 −5 src/vector.cpp
3 changes: 1 addition & 2 deletions include/amici/vector.h
Original file line number Diff line number Diff line change
@@ -88,8 +88,7 @@ class AmiVector {
return;
}
nvec_ = N_VMake_Serial(
gsl::narrow<long int>(vold.vec_.size()), vec_.data(),
vold.nvec_->sunctx
gsl::narrow<long int>(vec_.size()), vec_.data(), vold.nvec_->sunctx
);
}

2 changes: 1 addition & 1 deletion src/solver.cpp
Original file line number Diff line number Diff line change
@@ -769,7 +769,7 @@ void Solver::setConstraints(std::vector<realtype> const& constraints) {

if (!any_constraint) {
// all-0 must be converted to empty, otherwise sundials will fail
constraints_ = AmiVector();
constraints_ = AmiVector(0, sunctx_);
return;
}

10 changes: 5 additions & 5 deletions src/vector.cpp
Original file line number Diff line number Diff line change
@@ -58,11 +58,11 @@ void AmiVector::copy(AmiVector const& other) {
void AmiVector::synchroniseNVector(SUNContext sunctx) {
if (nvec_)
N_VDestroy_Serial(nvec_);
nvec_ = vec_.empty()
? nullptr
: N_VMake_Serial(
gsl::narrow<long int>(vec_.size()), vec_.data(), sunctx
);
if (sunctx) {
nvec_ = N_VMake_Serial(
gsl::narrow<long int>(vec_.size()), vec_.data(), sunctx
);
}
}

AmiVector::~AmiVector() {