#include <LOCA_Abstract_Iterator.H>
Public Types | |
enum | IteratorStatus { LastIteration = 2, Finished = 1, Failed = 0, NotFinished = -1 } |
Enumerated type for status of the iterator. More... | |
enum | StepStatus { Successful = 1, Unsuccessful = 0, Provisional = -1 } |
Enumerated type for status of each step of iterator. More... | |
Public Member Functions | |
Iterator (Teuchos::ParameterList &p) | |
Constructor. | |
Iterator (const Iterator &it) | |
Copy Constructor. | |
virtual | ~Iterator () |
Destructor. | |
virtual bool | resetIterator (Teuchos::ParameterList &p) |
Reset the iterator to start a new iteration. | |
virtual IteratorStatus | getIteratorStatus () const |
Return the status of the iterator. | |
virtual int | getStepNumber () const |
Returns the number of accepted steps. | |
virtual int | getNumFailedSteps () const |
Returns the number of failed steps. | |
virtual int | getNumTotalSteps () const |
Returns the total number of steps attempted. | |
virtual IteratorStatus | run () |
Run the iterator. | |
Protected Member Functions | |
Iterator () | |
Constructor. | |
virtual IteratorStatus | iterate () |
Perform iteration. | |
virtual IteratorStatus | stop (StepStatus) |
Check stopping criteria. | |
virtual IteratorStatus | start ()=0 |
Intialize iterator. | |
virtual IteratorStatus | finish (IteratorStatus)=0 |
Finalize iterator. | |
virtual StepStatus | preprocess (StepStatus)=0 |
Preprocess step. | |
virtual StepStatus | compute (StepStatus)=0 |
Compute step. | |
virtual StepStatus | postprocess (StepStatus)=0 |
Postprocess step. | |
virtual void | setLastIteration () |
Set iterator status as LastIteration. | |
virtual bool | isLastIteration () |
Returns true of the iteratorStatus is LastIteration. | |
virtual StepStatus | computeStepStatus (StepStatus preStatus, StepStatus compStatus, StepStatus postStatus) |
Compute step, iterator status from status of each component of step. | |
Protected Attributes | |
int | stepNumber |
Current step number of continuation algorithm (does not include failed steps). | |
int | numFailedSteps |
Number of continuation steps that have failed. | |
int | numTotalSteps |
Total number of steps attempeted (includes failed and successful steps). | |
int | maxSteps |
Maximum number of continuation steps to take. Defaults to 100. | |
IteratorStatus | iteratorStatus |
Current status of the iterator. |
The LOCAAbstract::Iterator defines an interface for implementing many kinds of iterative processes. In LOCA, this is used to implement the Stepper which computes points along a continuation curve.
Many iterative processes can be abstracted in the following manner:
The run method of the iterator implements this iterative process with start, finish, preprocess, compute and postprocess left as pure virtual methods to be implemented for the specific iterative process.
The iterator has one parameter, "Max Steps" (default 100) giving the maximum number of steps the iterator should take. The default implementation of stop only stops the iterator when this maximum number of steps has been reached.
Definition at line 87 of file LOCA_Abstract_Iterator.H.
Enumerated type for status of the iterator.
LastIteration | This is the last iteration. |
Finished | The iterator is finished. |
Failed | The iterator has failed. |
NotFinished | The iterator is not finished. |
Definition at line 92 of file LOCA_Abstract_Iterator.H.
Enumerated type for status of each step of iterator.
Successful | The last step was successful. |
Unsuccessful | The last step was unsuccessful. |
Provisional | One more unsuccessful step means failure. |
Definition at line 100 of file LOCA_Abstract_Iterator.H.
LOCA::Abstract::Iterator::Iterator | ( | Teuchos::ParameterList & | p | ) |
LOCA::Abstract::Iterator::Iterator | ( | const Iterator & | it | ) |
LOCA::Abstract::Iterator::~Iterator | ( | ) | [virtual] |
LOCA::Abstract::Iterator::Iterator | ( | ) | [protected] |
bool LOCA::Abstract::Iterator::resetIterator | ( | Teuchos::ParameterList & | p | ) | [virtual] |
Reset the iterator to start a new iteration.
Definition at line 74 of file LOCA_Abstract_Iterator.C.
References iteratorStatus, maxSteps, NotFinished, numFailedSteps, numTotalSteps, and stepNumber.
Referenced by Iterator(), and LOCA::Stepper::reset().
LOCA::Abstract::Iterator::IteratorStatus LOCA::Abstract::Iterator::getIteratorStatus | ( | ) | const [virtual] |
Return the status of the iterator.
Definition at line 87 of file LOCA_Abstract_Iterator.C.
References iteratorStatus.
int LOCA::Abstract::Iterator::getStepNumber | ( | ) | const [virtual] |
Returns the number of accepted steps.
Definition at line 93 of file LOCA_Abstract_Iterator.C.
References stepNumber.
Referenced by LOCA::Stepper::postprocess().
int LOCA::Abstract::Iterator::getNumFailedSteps | ( | ) | const [virtual] |
Returns the number of failed steps.
Definition at line 99 of file LOCA_Abstract_Iterator.C.
References numFailedSteps.
int LOCA::Abstract::Iterator::getNumTotalSteps | ( | ) | const [virtual] |
Returns the total number of steps attempted.
Definition at line 105 of file LOCA_Abstract_Iterator.C.
References numTotalSteps.
LOCA::Abstract::Iterator::IteratorStatus LOCA::Abstract::Iterator::run | ( | ) | [virtual] |
Run the iterator.
Definition at line 111 of file LOCA_Abstract_Iterator.C.
References Failed, finish(), iterate(), iteratorStatus, start(), and stepNumber.
LOCA::Abstract::Iterator::IteratorStatus LOCA::Abstract::Iterator::iterate | ( | ) | [protected, virtual] |
Perform iteration.
Definition at line 127 of file LOCA_Abstract_Iterator.C.
References compute(), computeStepStatus(), Failed, iteratorStatus, NotFinished, numFailedSteps, numTotalSteps, postprocess(), preprocess(), stepNumber, stop(), and Successful.
Referenced by run().
LOCA::Abstract::Iterator::IteratorStatus LOCA::Abstract::Iterator::stop | ( | StepStatus | stepStatus | ) | [protected, virtual] |
Check stopping criteria.
Reimplemented in LOCA::Stepper.
Definition at line 161 of file LOCA_Abstract_Iterator.C.
References Finished, maxSteps, NotFinished, and numTotalSteps.
Referenced by iterate().
virtual IteratorStatus LOCA::Abstract::Iterator::start | ( | ) | [protected, pure virtual] |
virtual IteratorStatus LOCA::Abstract::Iterator::finish | ( | IteratorStatus | ) | [protected, pure virtual] |
virtual StepStatus LOCA::Abstract::Iterator::preprocess | ( | StepStatus | ) | [protected, pure virtual] |
virtual StepStatus LOCA::Abstract::Iterator::compute | ( | StepStatus | ) | [protected, pure virtual] |
virtual StepStatus LOCA::Abstract::Iterator::postprocess | ( | StepStatus | ) | [protected, pure virtual] |
void LOCA::Abstract::Iterator::setLastIteration | ( | ) | [protected, virtual] |
Set iterator status as LastIteration.
Definition at line 170 of file LOCA_Abstract_Iterator.C.
References iteratorStatus, and LastIteration.
Referenced by LOCA::Stepper::computeStepSize().
bool LOCA::Abstract::Iterator::isLastIteration | ( | ) | [protected, virtual] |
Returns true of the iteratorStatus is LastIteration.
Definition at line 177 of file LOCA_Abstract_Iterator.C.
References iteratorStatus, and LastIteration.
Referenced by LOCA::Stepper::stop().
LOCA::Abstract::Iterator::StepStatus LOCA::Abstract::Iterator::computeStepStatus | ( | StepStatus | preStatus, | |
StepStatus | compStatus, | |||
StepStatus | postStatus | |||
) | [protected, virtual] |
Compute step, iterator status from status of each component of step.
Definition at line 183 of file LOCA_Abstract_Iterator.C.
References Failed, iteratorStatus, Provisional, Successful, and Unsuccessful.
Referenced by iterate().
int LOCA::Abstract::Iterator::stepNumber [protected] |
Current step number of continuation algorithm (does not include failed steps).
Definition at line 173 of file LOCA_Abstract_Iterator.H.
Referenced by getStepNumber(), iterate(), LOCA::Stepper::printEndStep(), LOCA::Stepper::printStartStep(), resetIterator(), and run().
int LOCA::Abstract::Iterator::numFailedSteps [protected] |
Number of continuation steps that have failed.
Definition at line 176 of file LOCA_Abstract_Iterator.H.
Referenced by getNumFailedSteps(), iterate(), and resetIterator().
int LOCA::Abstract::Iterator::numTotalSteps [protected] |
Total number of steps attempeted (includes failed and successful steps).
Definition at line 179 of file LOCA_Abstract_Iterator.H.
Referenced by getNumTotalSteps(), iterate(), resetIterator(), LOCA::Stepper::stop(), and stop().
int LOCA::Abstract::Iterator::maxSteps [protected] |
Maximum number of continuation steps to take. Defaults to 100.
Definition at line 182 of file LOCA_Abstract_Iterator.H.
Referenced by LOCA::Stepper::printInitializationInfo(), resetIterator(), LOCA::Stepper::stop(), and stop().
Current status of the iterator.
Definition at line 185 of file LOCA_Abstract_Iterator.H.
Referenced by computeStepStatus(), getIteratorStatus(), isLastIteration(), iterate(), resetIterator(), run(), and setLastIteration().