00001 // $Id: LOCA_Abstract_Iterator.H,v 1.10 2007/01/22 20:07:53 etphipp Exp $ 00002 // $Source: /space/CVS/Trilinos/packages/nox/src-loca/src/LOCA_Abstract_Iterator.H,v $ 00003 00004 //@HEADER 00005 // ************************************************************************ 00006 // 00007 // NOX: An Object-Oriented Nonlinear Solver Package 00008 // Copyright (2002) Sandia Corporation 00009 // 00010 // LOCA: Library of Continuation Algorithms Package 00011 // Copyright (2005) Sandia Corporation 00012 // 00013 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00014 // license for use of this work by or on behalf of the U.S. Government. 00015 // 00016 // This library is free software; you can redistribute it and/or modify 00017 // it under the terms of the GNU Lesser General Public License as 00018 // published by the Free Software Foundation; either version 2.1 of the 00019 // License, or (at your option) any later version. 00020 // 00021 // This library is distributed in the hope that it will be useful, but 00022 // WITHOUT ANY WARRANTY; without even the implied warranty of 00023 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00024 // Lesser General Public License for more details. 00025 // 00026 // You should have received a copy of the GNU Lesser General Public 00027 // License along with this library; if not, write to the Free Software 00028 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00029 // USA 00030 // 00031 // Questions? Contact Roger Pawlowski (rppawlo@sandia.gov) or 00032 // Eric Phipps (etphipp@sandia.gov), Sandia National Laboratories. 00033 // ************************************************************************ 00034 // CVS Information 00035 // $Source: /space/CVS/Trilinos/packages/nox/src-loca/src/LOCA_Abstract_Iterator.H,v $ 00036 // $Author: etphipp $ 00037 // $Date: 2007/01/22 20:07:53 $ 00038 // $Revision: 1.10 $ 00039 // ************************************************************************ 00040 //@HEADER 00041 00042 #ifndef LOCA_ABSTRACT_ITERATOR_H 00043 #define LOCA_ABSTRACT_ITERATOR_H 00044 00045 namespace Teuchos { 00046 class ParameterList; 00047 } 00048 00049 namespace LOCA { 00050 00051 namespace Abstract { 00052 00087 class Iterator { 00088 00089 public: 00090 00092 enum IteratorStatus { 00093 LastIteration = 2, 00094 Finished = 1, 00095 Failed = 0, 00096 NotFinished = -1 00097 }; 00098 00100 enum StepStatus { 00101 Successful = 1, 00102 Unsuccessful = 0, 00103 Provisional = -1 00104 }; 00105 00107 Iterator(Teuchos::ParameterList& p); 00108 00110 Iterator(const Iterator& it); 00111 00113 virtual ~Iterator(); 00114 00116 virtual bool resetIterator(Teuchos::ParameterList& p); 00117 00119 virtual IteratorStatus getIteratorStatus() const; 00120 00122 virtual int getStepNumber() const; 00123 00125 virtual int getNumFailedSteps() const; 00126 00128 virtual int getNumTotalSteps() const; 00129 00131 virtual IteratorStatus run(); 00132 00133 protected: 00134 00136 Iterator(); 00137 00139 virtual IteratorStatus iterate(); 00140 00142 virtual IteratorStatus stop(StepStatus); 00143 00145 virtual IteratorStatus start() = 0; 00146 00148 virtual IteratorStatus finish(IteratorStatus) = 0; 00149 00151 virtual StepStatus preprocess(StepStatus) = 0; 00152 00154 virtual StepStatus compute(StepStatus) = 0; 00155 00157 virtual StepStatus postprocess(StepStatus) = 0; 00158 00160 virtual void setLastIteration(); 00161 00163 virtual bool isLastIteration(); 00164 00166 virtual StepStatus computeStepStatus(StepStatus preStatus, 00167 StepStatus compStatus, 00168 StepStatus postStatus); 00169 00170 protected: 00171 00173 int stepNumber; 00174 00176 int numFailedSteps; 00177 00179 int numTotalSteps; 00180 00182 int maxSteps; 00183 00185 IteratorStatus iteratorStatus; 00186 00187 }; 00188 00189 } // end namespace Abstract 00190 } // end namespace LOCA 00191 00192 #endif 00193