Skip to content

Commit

Permalink
err
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed Sep 27, 2024
1 parent dd0b97f commit b21c408
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 33 deletions.
73 changes: 41 additions & 32 deletions src/solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include <sundials/sundials_context.h>

#include <cstdio>
#include <memory>
#include <filesystem>
#include <memory>

namespace amici {

Expand All @@ -32,40 +32,49 @@ void wrapErrHandlerFn(
auto file_stem = path.stem().string();

switch (err_code) {
// TODO
/*
case 99:
snprintf(buffid, BUF_SIZE, "%s:%s:WARNING", module, function);
snprintf(buffid, BUF_SIZE, "%s:%s:WARNING", file_stem.c_str(), func);
break;

case AMICI_TOO_MUCH_WORK:
snprintf(
buffid, BUF_SIZE, "%s:%s:TOO_MUCH_WORK", file_stem.c_str(), func
);
break;

case AMICI_TOO_MUCH_ACC:
snprintf(
buffid, BUF_SIZE, "%s:%s:TOO_MUCH_ACC", file_stem.c_str(), func
);
break;

case AMICI_ERR_FAILURE:
snprintf(
buffid, BUF_SIZE, "%s:%s:ERR_FAILURE", file_stem.c_str(), func
);
break;

case AMICI_TOO_MUCH_WORK:
snprintf(buffid, BUF_SIZE, "%s:%s:TOO_MUCH_WORK", module, function);
break;
case AMICI_TOO_MUCH_ACC:
snprintf(buffid, BUF_SIZE, "%s:%s:TOO_MUCH_ACC", module, function);
break;
case AMICI_ERR_FAILURE:
snprintf(buffid, BUF_SIZE, "%s:%s:ERR_FAILURE", module, function);
break;
case AMICI_CONV_FAILURE:
snprintf(buffid, BUF_SIZE, "%s:%s:CONV_FAILURE", module, function);
break;
case AMICI_RHSFUNC_FAIL:
snprintf(buffid, BUF_SIZE, "%s:%s:RHSFUNC_FAIL", module, function);
break;
case AMICI_FIRST_RHSFUNC_ERR:
snprintf(buffid, BUF_SIZE, "%s:%s:FIRST_RHSFUNC_ERR", module,
function); break;
*/
default:
snprintf(buffid, BUF_SIZE, "%s:%s:OTHER", file_stem.c_str(), func);
break;
}
case AMICI_CONV_FAILURE:
snprintf(
buffid, BUF_SIZE, "%s:%s:CONV_FAILURE", file_stem.c_str(), func
);
break;

case AMICI_RHSFUNC_FAIL:
snprintf(
buffid, BUF_SIZE, "%s:%s:RHSFUNC_FAIL", file_stem.c_str(), func
);
break;

case AMICI_FIRST_RHSFUNC_ERR:
snprintf(
buffid, BUF_SIZE, "%s:%s:FIRST_RHSFUNC_ERR", file_stem.c_str(), func
);
break;
default:
snprintf(buffid, BUF_SIZE, "%s:%s:OTHER", file_stem.c_str(), func);
break;
}

if (!err_user_data) {
throw std::runtime_error("eh_data unset");
Expand Down
3 changes: 2 additions & 1 deletion src/solver_cvodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,8 @@ void CVodeSolver::solveB(realtype const tBout, int const itaskB) const {
if (force_reinit_postprocess_B_)
reInitPostProcessB(tBout);
int status = CVodeB(solver_memory_.get(), tBout, itaskB);
// This does not seem to be documented, but CVodeB may also return CV_TSTOP_RETURN
// This does not seem to be documented, but CVodeB may also return
// CV_TSTOP_RETURN
if (status != CV_SUCCESS && status != CV_TSTOP_RETURN)
throw IntegrationFailureB(status, tBout);
solver_was_called_B_ = true;
Expand Down

0 comments on commit b21c408

Please sign in to comment.