1 |
#include "integrator.h" |
#include "integrator.h" |
2 |
#include "integratorreporter.h" |
#include "integratorreporter.h" |
3 |
#include <stdexcept> |
#include <stdexcept> |
4 |
|
#include <sstream> |
5 |
using namespace std; |
using namespace std; |
6 |
|
|
7 |
/** |
/** |
105 |
return 1; |
return 1; |
106 |
} |
} |
107 |
|
|
108 |
int |
void |
109 |
Integrator::setEngine(IntegratorEngine engine){ |
Integrator::setEngine(IntegratorEngine engine){ |
110 |
return integrator_set_engine(this->blsys, engine); |
int res = integrator_set_engine(this->blsys, engine); |
111 |
|
if(!res)return; |
112 |
|
if(res==1)throw range_error("Unknown integrator"); |
113 |
|
if(res==2)throw range_error("Invalid integrator"); |
114 |
|
stringstream ss; |
115 |
|
ss << "Unknown error in setEngine (res = " << res << ")"; |
116 |
|
throw runtime_error(ss.str()); |
117 |
} |
} |
118 |
|
|
119 |
int |
void |
120 |
Integrator::setEngine(int engine){ |
Integrator::setEngine(int engine){ |
121 |
return integrator_set_engine(this->blsys, (IntegratorEngine)engine); |
setEngine((IntegratorEngine)engine); |
122 |
} |
} |
123 |
|
|
124 |
int |
void |
125 |
Integrator::setEngine(const string &name){ |
Integrator::setEngine(const string &name){ |
126 |
|
CONSOLE_DEBUG("Setting integration engine to '%s'",name.c_str()); |
127 |
IntegratorEngine engine = INTEG_UNKNOWN; |
IntegratorEngine engine = INTEG_UNKNOWN; |
128 |
#ifdef ASC_WITH_LSODE |
#ifdef ASC_WITH_LSODE |
129 |
if(name=="LSODE")engine = INTEG_LSODE; |
if(name=="LSODE")engine = INTEG_LSODE; |
132 |
if(name=="IDA")engine = INTEG_IDA; |
if(name=="IDA")engine = INTEG_IDA; |
133 |
#endif |
#endif |
134 |
|
|
135 |
return integrator_set_engine(this->blsys, engine); |
setEngine(engine); |
136 |
} |
} |
137 |
|
|
138 |
/** |
/** |
140 |
are available or are in memory. |
are available or are in memory. |
141 |
*/ |
*/ |
142 |
map<int,string> |
map<int,string> |
143 |
Integrator::getEngines() const{ |
Integrator::getEngines(){ |
144 |
map<int,string> m; |
map<int,string> m; |
145 |
#ifdef ASC_WITH_LSODE |
#ifdef ASC_WITH_LSODE |
146 |
m.insert(pair<int,string>(INTEG_LSODE,"LSODE")); |
m.insert(pair<int,string>(INTEG_LSODE,"LSODE")); |