• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdeedu
  • Sitemap
  • Contact Us
 

step/stepcore

solver.h

Go to the documentation of this file.
00001 /* This file is part of StepCore library.
00002    Copyright (C) 2007 Vladimir Kuznetsov <ks.vladimir@gmail.com>
00003 
00004    StepCore library is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2 of the License, or
00007    (at your option) any later version.
00008 
00009    StepCore library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.
00013 
00014    You should have received a copy of the GNU General Public License
00015    along with StepCore; if not, write to the Free Software
00016    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00017 */
00018 
00023 #ifndef STEPCORE_SOLVER_H
00024 #define STEPCORE_SOLVER_H
00025 
00026 #include "object.h"
00027 
00028 namespace StepCore
00029 {
00030 
00069 class Solver: public Object
00070 {
00071     //Q_OBJECT
00072     STEPCORE_OBJECT(Solver)
00073 
00074 public:
00076     typedef int (*Function)(double t, const double* y, const double* yvar,
00077                              double* f, double* fvar, void* params);
00078 
00080     explicit Solver(int dimension = 0, Function function = NULL,
00081                 void* params = NULL, double stepSize = 0.001);
00083     Solver(double stepSize);
00084 
00085     virtual ~Solver() {}
00086 
00088     QString solverType() const { return metaObject()->className(); }
00089 
00091     int dimension() const { return _dimension; }
00093     virtual void setDimension(int dimension) { _dimension = dimension; }
00094 
00096     Function function() const { return _function; }
00098     virtual void setFunction(Function function) { _function = function; }
00099 
00101     void* params() const { return _params; }
00103     virtual void setParams(void* params) { _params = params; }
00104 
00106     double stepSize() const { return _stepSize; }
00108     virtual void setStepSize(double stepSize) { _stepSize = stepSize; }
00109 
00111     double toleranceAbs() const { return _toleranceAbs; }
00113     virtual void setToleranceAbs(double toleranceAbs) { _toleranceAbs = toleranceAbs; }
00114 
00116     double toleranceRel() const { return _toleranceRel; }
00118     virtual void setToleranceRel(double toleranceRel) { _toleranceRel = toleranceRel; }
00119 
00121     double localError() const { return _localError; }
00123     double localErrorRatio() const { return _localErrorRatio; }
00124 
00126     virtual int doCalcFn(double* t, const double* y, const double* yvar = 0,
00127                             double* f = 0, double* fvar = 0) = 0;
00128 
00137     virtual int doEvolve(double* t, double t1, double* y, double* yvar) = 0;
00138 
00139 public:
00141     enum { OK = 0,
00142            ToleranceError = 2048,
00143            InternalError = 2049,
00144            CollisionDetected = 4096,
00145            IntersectionDetected = 4097,
00146            Aborted = 8192,
00147            CollisionError = 16384,
00148            ConstraintError = 32768
00149     };
00150 
00151 protected:
00152     int      _dimension;
00153     Function _function;
00154     void*    _params;
00155 
00156     double   _stepSize;
00157     double   _toleranceAbs;
00158     double   _toleranceRel;
00159     double   _localError;
00160     double   _localErrorRatio;
00161 };
00162 
00163 inline Solver::Solver(int dimension, Function function, void* params, double stepSize)
00164      : _dimension(dimension), _function(function), _params(params), _stepSize(stepSize),
00165        _toleranceAbs(0.001), _toleranceRel(0.001), _localError(0), _localErrorRatio(0)
00166 {
00167 }
00168 
00169 inline Solver::Solver(double stepSize)
00170      : _dimension(0), _function(0), _params(0), _stepSize(stepSize),
00171        _toleranceAbs(0.001), _toleranceRel(0.001), _localError(0), _localErrorRatio(0)
00172 {
00173 }
00174 
00175 } // namespace StepCore
00176 
00177 #endif
00178 

step/stepcore

Skip menu "step/stepcore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdeedu

Skip menu "kdeedu"
  • kalzium
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  •   docs
  •   src
  • parley
  •   stepcore
Generated for kdeedu by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal