Skip to content

Commit

Permalink
Merge pull request #301 from ICB-DCM/fixes_ff
Browse files Browse the repository at this point in the history
Fixes for incorrectly passing tests
  • Loading branch information
Fabian Fröhlich authored May 9, 2018
2 parents 6e828d9 + 55e2ae9 commit 4bc7cd2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
23 changes: 10 additions & 13 deletions src/rdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,24 +113,24 @@ void ReturnData::invalidate(const realtype t) {

for (int it = it_start; it < nt; it++){
for (int ix = 0; ix < nx; ix++)
x.at(ix * nt + it) = getNaN();
x.at(ix + nx * it) = getNaN();
for (int iy = 0; iy < ny; iy++)
y.at(iy * nt + it) = getNaN();
y.at(iy + ny * it) = getNaN();
}

if (sx.size()) {
for (int it = it_start; it < nt; it++){
for (int ip = 0; ip < nplist; ip++) {
for (int ix = 0; ix < nx; ix++)
sx.at((ip*nx + ix) * nt + it) = getNaN();
sx.at(ix + nx*(ip + it*nplist)) = getNaN();
}
}
}
if(sy.size()) {
for (int it = it_start; it < nt; it++){
for (int ip = 0; ip < nplist; ip++) {
for (int iy = 0; iy < ny; iy++)
sy.at((ip*ny + iy) * nt + it) = getNaN();
sy.at(iy + ny*(ip + it*nplist)) = getNaN();
}
}
}
Expand Down Expand Up @@ -200,23 +200,20 @@ void ReturnData::applyChainRuleFactorToSimulationResults(const Model *model) {
for (int ip = 0; ip < nplist; ++ip)
for (int ix = 0; ix < nxtrue; ++ix)
for (int it = 0; it < nt; ++it)
sx.at((ip * nxtrue + ix) * nt + it) =
x.at((nxtrue + ip * nxtrue + ix) * nt +
it);
sx.at(ix + nxtrue*(ip + it*nplist)) =
x.at(it * nx + nxtrue + ip * nxtrue + ix);

for (int ip = 0; ip < nplist; ++ip)
for (int iy = 0; iy < nytrue; ++iy)
for (int it = 0; it < nt; ++it)
sy.at((ip * nytrue + iy) * nt + it) =
y.at((nytrue + ip * nytrue + iy) * nt +
it);
sy.at(iy + nytrue*(ip + it*nplist)) =
y.at(it * ny + nytrue + ip * nytrue + iy);

for (int ip = 0; ip < nplist; ++ip)
for (int iz = 0; iz < nztrue; ++iz)
for (int it = 0; it < nt; ++it)
sz.at((ip * nztrue + iz) * nt + it) =
z.at((nztrue + ip * nztrue + iz) * nt +
it);
sz.at(iz + nztrue*(ip + it*nplist)) =
z.at(it * nz + nztrue + ip * nztrue + iz);
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ void Solver::setupAMI(ForwardProblem *fwd, Model *model) {

model->fsdx0();

if (sensi_meth == AMICI_SENSI_FSA) {
auto plist = model->getParameterList();

if (sensi_meth == AMICI_SENSI_FSA && plist.size() > 0) {
/* Set sensitivity analysis optional inputs */
auto plist = model->getParameterList();
auto par = model->getUnscaledParameters();

/* Activate sensitivity calculations */
Expand Down
Binary file modified tests/cpputest/expectedResults.h5
Binary file not shown.
4 changes: 2 additions & 2 deletions tests/cpputest/testfunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ void simulateVerifyWrite(const std::string hdffileOptions, const std::string hdf
// simulate & verify
auto rdata = runAmiciSimulation(*solver, edata.get(), *model);
std::string resultPath = path + "/results";
verifyReturnData(hdffileResults.c_str(), resultPath.c_str(), rdata.get(), model.get(), atol, rtol);


// write
// delete destination group
H5::H5File in(hdffileOptions, H5F_ACC_RDONLY);
Expand All @@ -61,6 +60,7 @@ void simulateVerifyWrite(const std::string hdffileOptions, const std::string hdf
hdf5::writeReturnData(*rdata, out, writePath);

// verify
verifyReturnData(hdffileResults.c_str(), resultPath.c_str(), rdata.get(), model.get(), atol, rtol);
verifyReturnData(hdffilewrite, writePath, rdata.get(), model.get(), atol, rtol);
//remove(hdffilewrite.c_str());
}
Expand Down

0 comments on commit 4bc7cd2

Please sign in to comment.