|
IterationPack: General framework for building iterative algorithms Version of the Day
|
00001 // @HEADER 00002 // *********************************************************************** 00003 // 00004 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization 00005 // Copyright (2003) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 // @HEADER 00028 // 00029 // Change Log: 00030 // 11/18/99: 00031 // * last_updated() Added 00032 // * set_not_updated(k) Added 00033 00034 #ifndef ITER_QUANTITY_H 00035 #define ITER_QUANTITY_H 00036 00037 #include <stdexcept> 00038 #include <string> 00039 #include <iomanip> 00040 #include <limits> 00041 00042 #include "IterationPack_Types.hpp" 00043 00044 namespace IterationPack { 00045 00055 class IterQuantity { 00056 public: 00057 00060 00062 enum { NONE_UPDATED = INT_MIN }; 00063 00065 class NoStorageAvailable : public std::logic_error 00066 {public: NoStorageAvailable(const std::string& what_arg) : std::logic_error(what_arg) {}}; 00067 00069 class QuanityNotSet : public std::logic_error 00070 {public: QuanityNotSet(const std::string& what_arg) : std::logic_error(what_arg) {}}; 00071 00073 00076 00077 // Virtual destructor 00078 virtual ~IterQuantity() {} 00079 00080 // Clone this iteration quantity 00081 virtual IterQuantity* clone() const = 0; 00082 00084 00087 00089 virtual const char* name() const = 0; 00090 00097 virtual bool has_storage_k(int offset) const = 0; 00098 00107 virtual bool updated_k(int offset) const = 0; 00108 00114 virtual int last_updated() const = 0; 00115 00167 virtual bool will_loose_mem(int offset, int set_offset) const = 0; 00168 00170 00173 00184 virtual void set_not_updated_k(int offset) = 0; 00185 00188 virtual void set_all_not_updated() = 0; 00189 00191 00194 00203 virtual void next_iteration() = 0; 00204 00206 00209 00218 virtual void print_concrete_type( std::ostream& out ) const = 0; 00219 00221 00224 00226 void assert_has_storage_k(int offset) const; 00227 00229 void assert_updated_k(int offset) const; 00230 00232 00233 }; // end class IterQuantity 00234 00235 } // end namespace IterationPack 00236 00237 #endif // ITER_QUANTITY_H
1.7.4