|
NOX Development
|
An abstract interface for implementing iteration. More...
#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. | |
An abstract interface for implementing iteration.
The LOCA::Abstract::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.
| LOCA::Abstract::Iterator::Iterator | ( | Teuchos::ParameterList & | p | ) |
Constructor.
References Iterator(), iteratorStatus, maxSteps, NotFinished, numFailedSteps, numTotalSteps, resetIterator(), and stepNumber.
Referenced by Iterator(), Iterator(), LOCA::Stepper::Stepper(), and LOCA::Stepper::Stepper().
| LOCA::Abstract::Iterator::Iterator | ( | const Iterator & | it | ) |
Copy Constructor.
References iteratorStatus, maxSteps, numFailedSteps, numTotalSteps, and stepNumber.
|
protected |
Constructor.
References Iterator(), iteratorStatus, maxSteps, NotFinished, numFailedSteps, numTotalSteps, and stepNumber.
|
protectedpure virtual |
Compute step.
Implemented in LOCA::AdaptiveStepper, LOCA::Epetra::AdaptiveStepper, and LOCA::Stepper.
Referenced by iterate().
|
protectedvirtual |
Compute step, iterator status from status of each component of step.
References Failed, iteratorStatus, Provisional, Successful, and Unsuccessful.
Referenced by iterate(), LOCA::AdaptiveStepper::iterate(), LOCA::Epetra::AdaptiveStepper::iterate(), and postprocess().
|
protectedpure virtual |
Finalize iterator.
Implemented in LOCA::AdaptiveStepper, LOCA::Epetra::AdaptiveStepper, and LOCA::Stepper.
Referenced by run().
|
virtual |
Return the status of the iterator.
References iteratorStatus.
|
virtual |
Returns the number of failed steps.
References numFailedSteps.
|
virtual |
Returns the total number of steps attempted.
References numTotalSteps.
|
virtual |
Returns the number of accepted steps.
References stepNumber.
Referenced by LOCA::AdaptiveStepper::postprocess(), LOCA::Epetra::AdaptiveStepper::postprocess(), and LOCA::Stepper::postprocess().
|
protectedvirtual |
Returns true of the iteratorStatus is LastIteration.
References iteratorStatus, and LastIteration.
Referenced by postprocess(), LOCA::AdaptiveStepper::stop(), LOCA::Epetra::AdaptiveStepper::stop(), and LOCA::Stepper::stopDeprecated().
|
protectedvirtual |
Perform iteration.
Reimplemented in LOCA::AdaptiveStepper, and LOCA::Epetra::AdaptiveStepper.
References compute(), computeStepStatus(), Failed, iteratorStatus, NotFinished, numFailedSteps, numTotalSteps, postprocess(), preprocess(), stepNumber, stop(), and Successful.
Referenced by run().
|
protectedpure virtual |
Postprocess step.
Implemented in LOCA::AdaptiveStepper, LOCA::Epetra::AdaptiveStepper, and LOCA::Stepper.
References computeStepStatus(), isLastIteration(), and setLastIteration().
Referenced by iterate().
|
protectedpure virtual |
Preprocess step.
Implemented in LOCA::AdaptiveStepper, LOCA::Epetra::AdaptiveStepper, and LOCA::Stepper.
Referenced by iterate().
|
virtual |
Reset the iterator to start a new iteration.
References iteratorStatus, maxSteps, NotFinished, numFailedSteps, numTotalSteps, and stepNumber.
Referenced by Iterator().
|
virtual |
Run the iterator.
Reimplemented in LOCA::AdaptiveStepper, and LOCA::Epetra::AdaptiveStepper.
References Failed, finish(), iterate(), iteratorStatus, start(), and stepNumber.
|
protectedvirtual |
Set iterator status as LastIteration.
References iteratorStatus, and LastIteration.
Referenced by LOCA::AdaptiveStepper::computeStepSize(), LOCA::Epetra::AdaptiveStepper::computeStepSize(), LOCA::Stepper::computeStepSize(), and postprocess().
|
protectedpure virtual |
Intialize iterator.
Implemented in LOCA::AdaptiveStepper, LOCA::Epetra::AdaptiveStepper, and LOCA::Stepper.
Referenced by run().
|
protectedvirtual |
Check stopping criteria.
Reimplemented in LOCA::AdaptiveStepper, LOCA::Epetra::AdaptiveStepper, and LOCA::Stepper.
References Finished, maxSteps, NotFinished, and numTotalSteps.
Referenced by iterate().
|
protected |
Current status of the iterator.
Referenced by computeStepStatus(), getIteratorStatus(), isLastIteration(), iterate(), LOCA::AdaptiveStepper::iterate(), LOCA::Epetra::AdaptiveStepper::iterate(), Iterator(), Iterator(), Iterator(), resetIterator(), run(), LOCA::AdaptiveStepper::run(), LOCA::Epetra::AdaptiveStepper::run(), and setLastIteration().
|
protected |
Maximum number of continuation steps to take. Defaults to 100.
Referenced by Iterator(), Iterator(), Iterator(), LOCA::AdaptiveStepper::printInitializationInfo(), LOCA::Epetra::AdaptiveStepper::printInitializationInfo(), LOCA::Stepper::printInitializationInfo(), resetIterator(), stop(), LOCA::AdaptiveStepper::stop(), LOCA::Epetra::AdaptiveStepper::stop(), and LOCA::Stepper::stopDeprecated().
|
protected |
Number of continuation steps that have failed.
Referenced by getNumFailedSteps(), iterate(), LOCA::AdaptiveStepper::iterate(), LOCA::Epetra::AdaptiveStepper::iterate(), Iterator(), Iterator(), Iterator(), and resetIterator().
|
protected |
Total number of steps attempeted (includes failed and successful steps).
Referenced by getNumTotalSteps(), iterate(), LOCA::AdaptiveStepper::iterate(), LOCA::Epetra::AdaptiveStepper::iterate(), Iterator(), Iterator(), Iterator(), resetIterator(), stop(), LOCA::AdaptiveStepper::stop(), LOCA::Epetra::AdaptiveStepper::stop(), and LOCA::Stepper::stopDeprecated().
|
protected |
Current step number of continuation algorithm (does not include failed steps).
Referenced by LOCA::AdaptiveStepper::adapt(), getStepNumber(), iterate(), LOCA::AdaptiveStepper::iterate(), LOCA::Epetra::AdaptiveStepper::iterate(), Iterator(), Iterator(), Iterator(), LOCA::AdaptiveStepper::printEndStep(), LOCA::Epetra::AdaptiveStepper::printEndStep(), LOCA::Stepper::printEndStep(), LOCA::AdaptiveStepper::printRelaxationEndStep(), LOCA::Epetra::AdaptiveStepper::printRelaxationEndStep(), LOCA::AdaptiveStepper::printRelaxationStep(), LOCA::Epetra::AdaptiveStepper::printRelaxationStep(), LOCA::AdaptiveStepper::printStartStep(), LOCA::Epetra::AdaptiveStepper::printStartStep(), LOCA::Stepper::printStartStep(), resetIterator(), run(), LOCA::AdaptiveStepper::run(), and LOCA::Epetra::AdaptiveStepper::run().