1 #ifndef SimTK_SIMMATH_CPODES_H_
2 #define SimTK_SIMMATH_CPODES_H_
56 virtual int explicitODE(Real t,
const Vector& y,
Vector& fout)
const;
57 virtual int implicitODE(Real t,
const Vector& y,
const Vector& yp,
60 virtual int constraint(Real t,
const Vector& y,
62 virtual int project(Real t,
const Vector& ycur,
Vector& corr,
63 Real epsProj,
Vector& err)
const;
64 virtual int quadrature(Real t,
const Vector& y,
66 virtual int root(Real t,
const Vector& y,
const Vector& yp,
68 virtual int weight(
const Vector& y,
Vector& weights)
const;
69 virtual void errorHandler(
int error_code,
const char* module,
70 const char*
function,
char* msg)
const;
95 {
return sys.
project(t,ycur,corr,epsProj,err); }
103 {
return sys.
root(t,y,yp,gout); }
107 {
return sys.
weight(y,weights); }
110 int error_code,
const char* module,
111 const char*
function,
char* msg)
128 UnspecifiedODEType=0,
134 UnspecifiedLinearMultistepMethod=0,
140 UnspecifiedNonlinearSystemIterationType=0,
146 UnspecifiedToleranceType=0,
153 UnspecifiedProjectionNorm=0,
159 UnspecifiedConstraintLinearity=0,
165 UnspecifiedProjectionFactorizationType=0,
173 UnspecifiedStepMode=0,
186 librarySideCPodesConstructor(ode, lmm, nls);
188 clientSideCPodesConstructor();
194 static const int Success = 0;
195 static const int TstopReturn = 1;
196 static const int RootReturn = 2;
197 static const int Warning = 99;
198 static const int TooMuchWork = -1;
199 static const int TooClose = -27;
207 static const int RecoverableError = 9999;
208 static const int UnrecoverableError = -9999;
235 int quadInit(
const Vector& q0);
236 int quadReInit(
const Vector& q0);
240 int rootInit(
int nrtfn);
244 int setErrHandlerFn();
253 int dlsSetJacFn(
void* jac,
void* jac_data);
254 int dlsProjSetJacFn(
void* jacP,
void* jacP_data);
257 int step(Real tout, Real* tret,
260 int setErrFile(FILE* errfp);
261 int setMaxOrd(
int maxord);
262 int setMaxNumSteps(
int mxsteps);
263 int setMaxHnilWarns(
int mxhnil);
264 int setStabLimDet(
bool stldet) ;
265 int setInitStep(Real hin);
266 int setMinStep(Real hmin);
267 int setMaxStep(Real hmax);
268 int setStopTime(Real tstop);
269 int setMaxErrTestFails(
int maxnef);
271 int setMaxNonlinIters(
int maxcor);
272 int setMaxConvFails(
int maxncf);
273 int setNonlinConvCoef(Real nlscoef);
275 int setProjUpdateErrEst(
bool proj_err);
276 int setProjFrequency(
int proj_freq);
277 int setProjTestCnstr(
bool test_cnstr);
278 int setProjLsetupFreq(
int proj_lset_freq);
279 int setProjNonlinConvCoef(Real prjcoef);
281 int setQuadErrCon(
bool errconQ,
282 int tol_typeQ, Real reltolQ,
void* abstolQ);
284 int setTolerances(
int tol_type, Real reltol,
void* abstol);
288 int getDky(Real t,
int k,
Vector& dky);
290 int getQuad(Real t,
Vector& yQout);
291 int getQuadDky(Real t,
int k,
Vector& dky);
293 int getWorkSpace(
int* lenrw,
int* leniw);
294 int getNumSteps(
int* nsteps);
295 int getNumFctEvals(
int* nfevals);
296 int getNumLinSolvSetups(
int* nlinsetups);
297 int getNumErrTestFails(
int* netfails);
298 int getLastOrder(
int* qlast);
299 int getCurrentOrder(
int* qcur);
300 int getNumStabLimOrderReds(
int* nslred);
301 int getActualInitStep(Real* hinused);
302 int getLastStep(Real* hlast);
303 int getCurrentStep(Real* hcur);
304 int getCurrentTime(Real* tcur);
305 int getTolScaleFactor(Real* tolsfac);
306 int getErrWeights(
Vector& eweight);
307 int getEstLocalErrors(
Vector& ele) ;
308 int getNumGEvals(
int* ngevals);
309 int getRootInfo(
int* rootsfound);
310 int getRootWindow(Real* tLo, Real* tHi);
311 int getIntegratorStats(
int* nsteps,
312 int* nfevals,
int* nlinsetups,
313 int* netfails,
int* qlast,
314 int* qcur, Real* hinused, Real* hlast,
315 Real* hcur, Real* tcur);
317 int getNumNonlinSolvIters(
int* nniters);
318 int getNumNonlinSolvConvFails(
int* nncfails);
319 int getNonlinSolvStats(
int* nniters,
int* nncfails);
320 int getProjNumProj(
int* nproj);
321 int getProjNumCnstrEvals(
int* nce);
322 int getProjNumLinSolvSetups(
int* nsetupsP);
323 int getProjNumFailures(
int* nprf) ;
324 int getProjStats(
int* nproj,
325 int* nce,
int* nsetupsP,
327 int getQuadNumFunEvals(
int* nqevals);
328 int getQuadErrWeights(
Vector& eQweight);
329 char* getReturnFlagName(
int flag);
332 int dlsGetWorkSpace(
int* lenrwLS,
int* leniwLS);
333 int dlsGetNumJacEvals(
int* njevals);
334 int dlsGetNumFctEvals(
int* nfevalsLS);
335 int dlsGetLastFlag(
int* flag);
336 char* dlsGetReturnFlagName(
int flag);
338 int dlsProjGetNumJacEvals(
int* njPevals);
339 int dlsProjGetNumFctEvals(
int* ncevalsLS);
341 int lapackDense(
int N);
342 int lapackBand(
int N,
int mupper,
int mlower);
358 Real epsProj,
Vector& err);
367 int error_code,
const char* module,
368 const char*
function,
char* msg);
378 void registerExplicitODEFunc(ExplicitODEFunc);
379 void registerImplicitODEFunc(ImplicitODEFunc);
380 void registerConstraintFunc(ConstraintFunc);
381 void registerProjectFunc(ProjectFunc);
382 void registerQuadratureFunc(QuadratureFunc);
383 void registerRootFunc(RootFunc);
384 void registerWeightFunc(WeightFunc);
385 void registerErrorHandlerFunc(ErrorHandlerFunc);
395 void clientSideCPodesConstructor() {
408 class CPodesRep* rep;
409 friend class CPodesRep;
411 const CPodesRep& getRep()
const {assert(rep);
return *rep;}
412 CPodesRep& updRep() {assert(rep);
return *rep;}
415 CPodes(
const CPodes&);
416 CPodes& operator=(
const CPodes&);
421 #endif // SimTK_CPODES_H_
ODEType
Definition: SimTKcpodes.h:127
static int explicitODE_static(const CPodesSystem &sys, Real t, const Vector &y, Vector &fout)
Definition: SimTKcpodes.h:80
Definition: SimTKcpodes.h:176
static int weight_static(const CPodesSystem &sys, const Vector &y, Vector &weights)
Definition: SimTKcpodes.h:105
This abstract class defines the system to be integrated with SimTK CPodes.
Definition: SimTKcpodes.h:49
virtual int quadrature(Real t, const Vector &y, Vector &qout) const
Definition: SimTKcpodes.h:135
static int project_static(const CPodesSystem &sys, Real t, const Vector &ycur, Vector &corr, Real epsProj, Vector &err)
Definition: SimTKcpodes.h:92
Definition: SimTKcpodes.h:167
static int quadrature_static(const CPodesSystem &sys, Real t, const Vector &y, Vector &qout)
Definition: SimTKcpodes.h:97
LinearMultistepMethod
Definition: SimTKcpodes.h:133
ProjectionNorm
Definition: SimTKcpodes.h:152
static int constraint_static(const CPodesSystem &sys, Real t, const Vector &y, Vector &cout)
Definition: SimTKcpodes.h:88
virtual int implicitODE(Real t, const Vector &y, const Vector &yp, Vector &fout) const
Definition: SimTKcpodes.h:160
Definition: SimTKcpodes.h:141
ConstraintLinearity
Definition: SimTKcpodes.h:158
Definition: SimTKcpodes.h:147
Includes internal headers providing declarations for the basic SimTK Core classes, including Simmatrix.
virtual int explicitODE(Real t, const Vector &y, Vector &fout) const
virtual int weight(const Vector &y, Vector &weights) const
virtual ~CPodesSystem()
Definition: SimTKcpodes.h:51
This is a straightforward translation of the Sundials CPODES C interface into C++.
Definition: SimTKcpodes.h:122
virtual int root(Real t, const Vector &y, const Vector &yp, Vector &gout) const
StepMode
Definition: SimTKcpodes.h:172
NonlinearSystemIterationType
Definition: SimTKcpodes.h:139
Definition: SimTKcpodes.h:148
This is the header file that every Simmath compilation unit should include first. ...
Definition: SimTKcpodes.h:129
Definition: SimTKcpodes.h:168
Definition: SimTKcpodes.h:174
virtual int project(Real t, const Vector &ycur, Vector &corr, Real epsProj, Vector &err) const
Definition: SimTKcpodes.h:154
ToleranceType
Definition: SimTKcpodes.h:145
Definition: SimTKcpodes.h:175
static int implicitODE_static(const CPodesSystem &sys, Real t, const Vector &y, const Vector &yp, Vector &fout)
Definition: SimTKcpodes.h:84
ProjectionFactorizationType
Definition: SimTKcpodes.h:164
#define SimTK_SIMMATH_EXPORT
Definition: SimTKmath/include/simmath/internal/common.h:64
static int root_static(const CPodesSystem &sys, Real t, const Vector &y, const Vector &yp, Vector &gout)
Definition: SimTKcpodes.h:101
virtual void errorHandler(int error_code, const char *module, const char *function, char *msg) const
static void errorHandler_static(const CPodesSystem &sys, int error_code, const char *module, const char *function, char *msg)
Definition: SimTKcpodes.h:109
virtual int constraint(Real t, const Vector &y, Vector &cout) const
Definition: SimTKcpodes.h:166