Protected against sundials not being compiled in

This commit is contained in:
Harry Moffat 2011-09-13 23:32:29 +00:00
parent c58697dbd3
commit cf730962a6
3 changed files with 9 additions and 2 deletions

View file

@ -12,12 +12,12 @@
namespace Cantera { namespace Cantera {
DAE_Solver* newDAE_Solver(string itype, ResidJacEval& f) { DAE_Solver* newDAE_Solver(std::string itype, ResidJacEval& f) {
if (itype == "IDA") { if (itype == "IDA") {
#ifdef HAS_SUNDIALS #ifdef HAS_SUNDIALS
return new IDA_Solver(f); return new IDA_Solver(f);
#else #else
raise CanteraError("newDAE_Solver","IDA solver requires sundials" throw CanteraError("newDAE_Solver","IDA solver requires sundials"
" package, but Cantera was not built with sundials."); " package, but Cantera was not built with sundials.");
#endif #endif
} }

View file

@ -10,6 +10,8 @@
#include <iostream> #include <iostream>
#ifdef HAS_SUNDIALS
#ifdef SUNDIALS_VERSION_22 #ifdef SUNDIALS_VERSION_22
#include <sundials_types.h> #include <sundials_types.h>
#include <sundials_math.h> #include <sundials_math.h>
@ -30,6 +32,8 @@
using namespace std; using namespace std;
inline static N_Vector nv(void* x) { inline static N_Vector nv(void* x) {
return reinterpret_cast<N_Vector>(x); return reinterpret_cast<N_Vector>(x);
} }
@ -645,3 +649,4 @@ namespace Cantera {
//==================================================================================================================== //====================================================================================================================
} }
#endif

View file

@ -21,6 +21,7 @@
#include "DAE_Solver.h" #include "DAE_Solver.h"
#include "ctexceptions.h" #include "ctexceptions.h"
#ifdef HAS_SUNDIALS
#ifdef SUNDIALS_VERSION_22 #ifdef SUNDIALS_VERSION_22
#include <nvector_serial.h> #include <nvector_serial.h>
@ -353,4 +354,5 @@ namespace Cantera {
} }
#endif #endif
#endif