Show CVODE error codes when integration fails

This commit is contained in:
Ray Speth 2012-03-30 23:46:14 +00:00
parent 95700d9641
commit 7f46371653
2 changed files with 6 additions and 5 deletions

View file

@ -8,7 +8,6 @@
#include <iostream>
using namespace std;
// cvode includes
#include "../../ext/cvode/include/llnltyps.h"
#include "../../ext/cvode/include/llnlmath.h"
@ -19,6 +18,8 @@ using namespace std;
#include "../../ext/cvode/include/nvector.h"
#include "../../ext/cvode/include/cvode.h"
#include "cantera/base/stringUtils.h"
inline static N_Vector nv(void* x)
{
return reinterpret_cast<N_Vector>(x);
@ -312,7 +313,7 @@ void CVodeInt::integrate(double tout)
int flag;
flag = CVode(m_cvode_mem, tout, nv(m_y), &t, NORMAL);
if (flag != SUCCESS) {
throw CVodeErr(" CVode error encountered.");
throw CVodeErr(" CVode error encountered. Error code: " + int2str(flag));
}
}
@ -322,7 +323,7 @@ double CVodeInt::step(double tout)
int flag;
flag = CVode(m_cvode_mem, tout, nv(m_y), &t, ONE_STEP);
if (flag != SUCCESS) {
throw CVodeErr(" CVode error encountered.");
throw CVodeErr(" CVode error encountered. Error code: " + int2str(flag));
}
return t;
}

View file

@ -497,7 +497,7 @@ void CVodesIntegrator::integrate(double tout)
int flag;
flag = CVode(m_cvode_mem, tout, nv(m_y), &t, CV_NORMAL);
if (flag != CV_SUCCESS) {
throw CVodesErr(" CVodes error encountered.");
throw CVodesErr(" CVodes error encountered. Error code: " + int2str(flag));
}
#if defined(SUNDIALS_VERSION_22) || defined(SUNDIALS_VERSION_23)
if (m_np > 0) {
@ -520,7 +520,7 @@ double CVodesIntegrator::step(double tout)
int flag;
flag = CVode(m_cvode_mem, tout, nv(m_y), &t, CV_ONE_STEP);
if (flag != CV_SUCCESS) {
throw CVodesErr(" CVodes error encountered.");
throw CVodesErr(" CVodes error encountered. Error code: " + int2str(flag));
}
return t;
}