AbstractOneStepIvpOdeSolver Class Reference

#include <AbstractOneStepIvpOdeSolver.hpp>

Inheritance diagram for AbstractOneStepIvpOdeSolver:

Inheritance graph
[legend]
Collaboration diagram for AbstractOneStepIvpOdeSolver:

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual OdeSolution Solve (AbstractOdeSystem *pAbstractOdeSystem, std::vector< double > &rYValues, double startTime, double endTime, double timeStep, double timeSampling)
virtual void Solve (AbstractOdeSystem *pAbstractOdeSystem, std::vector< double > &rYValues, double startTime, double endTime, double timeStep)

Protected Member Functions

virtual void InternalSolve (AbstractOdeSystem *pAbstractOdeSystem, std::vector< double > &rCurrentYValues, std::vector< double > &rWorkingMemory, double startTime, double endTime, double timeStep)
virtual void CalculateNextYValue (AbstractOdeSystem *pAbstractOdeSystem, double timeStep, double time, std::vector< double > &currentYValues, std::vector< double > &nextYValues)=0

Private Attributes

std::vector< double > mWorkingMemory


Detailed Description

Abstract One Step Ode Solver class. Sets up variables and functions for all the ODE solvers that only have one timestep.

Definition at line 39 of file AbstractOneStepIvpOdeSolver.hpp.


Member Function Documentation

void AbstractOneStepIvpOdeSolver::InternalSolve ( AbstractOdeSystem pAbstractOdeSystem,
std::vector< double > &  rCurrentYValues,
std::vector< double > &  rWorkingMemory,
double  startTime,
double  endTime,
double  timeStep 
) [protected, virtual]

Method that actually performs the solving on behalf of the public Solve methods.

Parameters:
pAbstractOdeSystem the system to solve
rCurrentYValues the current (initial) state; results will also be returned in here
rWorkingMemory working memory; same size as rCurrentYValues
startTime initial time
endTime time to solve to
timeStep dt

Reimplemented in MockEulerIvpOdeSolver.

Definition at line 111 of file AbstractOneStepIvpOdeSolver.cpp.

References CalculateNextYValue(), AbstractOdeSystem::CalculateStoppingEvent(), AbstractIvpOdeSolver::mStoppingEventOccurred, and AbstractIvpOdeSolver::mStoppingTime.

Referenced by MockEulerIvpOdeSolver::InternalSolve(), and Solve().

virtual void AbstractOneStepIvpOdeSolver::CalculateNextYValue ( AbstractOdeSystem pAbstractOdeSystem,
double  timeStep,
double  time,
std::vector< double > &  currentYValues,
std::vector< double > &  nextYValues 
) [protected, pure virtual]

Calculate the next time step. Concrete subclasses should provide this method.

Implemented in EulerIvpOdeSolver, RungeKutta2IvpOdeSolver, and RungeKutta4IvpOdeSolver.

Referenced by InternalSolve().

OdeSolution AbstractOneStepIvpOdeSolver::Solve ( AbstractOdeSystem pAbstractOdeSystem,
std::vector< double > &  rYValues,
double  startTime,
double  endTime,
double  timeStep,
double  timeSampling 
) [virtual]

Solves a system of ODEs using a specified one-step ODE solver

Parameters:
pAbstractOdeSystem points to the concrete ODE system to be solved
rYValues a standard vector specifying the intial condition of each solution variable in the system (this can be the initial conditions vector stored in the ode system)
startTime the time at which the initial conditions are specified
endTime the time to which the system should be solved and the solution returned
timeStep the time interval to be used by the solver
timeSampling the times at which the solution is returned
Returns:
OdeSolution is an object containing an integer of the number of equations, a std::vector of times and a std::vector of std::vectors where each of those vectors contains the solution for one variable of the ODE system at those times.
EXAMPLE, which returns the solution every 0.1 seconds using dt=0.01:

MyOdeSystem ode;

std::vector<double> init_cond = ode_system.GetInitialConditions();

OdeSolution solution = solver.Solve(&ode, init_cond, 0, 1, 0.01, 0.1);

Implements AbstractIvpOdeSolver.

Definition at line 38 of file AbstractOneStepIvpOdeSolver.cpp.

References AbstractOdeSystem::CalculateStoppingEvent(), AbstractOdeSystem::GetNumberOfStateVariables(), InternalSolve(), AbstractIvpOdeSolver::mStoppingEventOccurred, AbstractIvpOdeSolver::mStoppingTime, mWorkingMemory, OdeSolution::rGetSolutions(), OdeSolution::rGetTimes(), and OdeSolution::SetNumberOfTimeSteps().

void AbstractOneStepIvpOdeSolver::Solve ( AbstractOdeSystem pAbstractOdeSystem,
std::vector< double > &  rYValues,
double  startTime,
double  endTime,
double  timeStep 
) [virtual]

Second version of Solve. See comments for the first version of Solve. This method does not return the solution and therefore does not take in a sampling time. Instead, the mStateVariables component in the ode object is updated.

Parameters:
pAbstractOdeSystem points to the concrete ODE system to be solved
rYValues a standard vector specifying the intial condition of each solution variable in the system (this can be the initial conditions vector stored in the ode system)
startTime the time at which the initial conditions are specified
endTime the time to which the system should be solved and the solution returned
timeStep the time interval to be used by the solver
EXAMPLE:

std::vector<double> init_cond = ode_system.GetInitialConditions();

solver.Solve(&ode, init_cond, 0, 1, 0.01);

state_variables = ode_system.rGetStateVariables(); // solution at t=1 found here

Implements AbstractIvpOdeSolver.

Definition at line 88 of file AbstractOneStepIvpOdeSolver.cpp.

References AbstractOdeSystem::CalculateStoppingEvent(), AbstractOdeSystem::GetNumberOfStateVariables(), InternalSolve(), AbstractIvpOdeSolver::mStoppingEventOccurred, and mWorkingMemory.


Member Data Documentation

std::vector<double> AbstractOneStepIvpOdeSolver::mWorkingMemory [private]

Working memory

Definition at line 45 of file AbstractOneStepIvpOdeSolver.hpp.

Referenced by Solve().


The documentation for this class was generated from the following files:

Generated on Wed Mar 18 12:52:09 2009 for Chaste by  doxygen 1.5.5