/[ascend]/trunk/pygtk/integrator.cpp
ViewVC logotype

Diff of /trunk/pygtk/integrator.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 940 by johnpye, Fri Nov 24 06:09:46 2006 UTC revision 941 by johnpye, Fri Nov 24 10:46:32 2006 UTC
# Line 1  Line 1 
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  /**  /**
# Line 104  Integrator::solve(){ Line 105  Integrator::solve(){
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;
# Line 124  Integrator::setEngine(const string &name Line 132  Integrator::setEngine(const string &name
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  /**  /**
# Line 132  Integrator::setEngine(const string &name Line 140  Integrator::setEngine(const string &name
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"));

Legend:
Removed from v.940  
changed lines
  Added in v.941

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22