Sandia Home Sandia Home
Main Page | Publications | Downloads | Configuration | Running the Code | Solver Parameters | FAQ | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

APPSPACK_Parameter_List.hpp

Go to the documentation of this file.
00001 // $Id: APPSPACK_Parameter_List.hpp,v 1.14 2006/06/30 01:42:08 tgkolda Exp $ 
00002 // $Source: /space/CVS-Acro/acro/packages/appspack/appspack/src/APPSPACK_Parameter_List.hpp,v $ 
00003 
00004 //@HEADER
00005 // ************************************************************************
00006 // 
00007 //          APPSPACK: Asynchronous Parallel Pattern Search
00008 //                 Copyright (2003) Sandia Corporation
00009 // 
00010 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00011 // license for use of this work by or on behalf of the U.S. Government.
00012 // 
00013 // This library is free software; you can redistribute it and/or modify
00014 // it under the terms of the GNU Lesser General Public License as
00015 // published by the Free Software Foundation; either version 2.1 of the
00016 // License, or (at your option) any later version.
00017 //  
00018 // This library is distributed in the hope that it will be useful, but
00019 // WITHOUT ANY WARRANTY; without even the implied warranty of
00020 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00021 // Lesser General Public License for more details.
00022 //                                                                                 
00023 // You should have received a copy of the GNU Lesser General Public
00024 // License along with this library; if not, write to the Free Software
00025 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00026 // USA.                                                                           .
00027 // 
00028 // Questions? Contact Tammy Kolda (tgkolda@sandia.gov) 
00029 // 
00030 // ************************************************************************
00031 //@HEADER
00032 
00038 #ifndef APPSPACK_PARAMETER_LIST_HPP
00039 #define APPSPACK_PARAMETER_LIST_HPP
00040 
00041 #include "APPSPACK_Common.hpp"
00042 #include "APPSPACK_Parameter_Entry.hpp"
00043 #include "APPSPACK_GCI.hpp"
00044 #include "APPSPACK_Matrix.hpp"
00045 
00046 namespace APPSPACK {
00047 namespace Parameter {
00048 
00056 class List {
00057 
00059   typedef map<string, Entry> Map;
00060 
00062   typedef Map::const_iterator ConstIterator;
00063 
00065   typedef Map::iterator Iterator;
00066 
00067 public:
00068 
00069 
00071   List();
00072 
00074   List(const List& source);
00075 
00077   List& operator=(const List& source);
00078 
00080   ~List();
00081 
00082   //-------------------------
00089 
00091 
00096   List& sublist(const string& name);
00097 
00099 
00103   const List& sublist(const string& name) const;
00105   
00106 
00107   //-------------------------
00130 
00132   void setParameter(const string& name, bool value);
00133 
00135   void setParameter(const string& name, int value);
00136 
00138   void setParameter(const string& name, double value);
00139 
00141   void setParameter(const string& name, const char* value);
00142 
00144   void setParameter(const string& name, const string& value);
00145 
00147   void setParameter(const string& name, const Vector& value);
00148 
00150   void setParameter(const string& name, const Matrix& value);
00152 
00168 
00170   bool getParameter(const string& name, bool nominal);
00171 
00173   int getParameter(const string& name, int nominal);
00174 
00176   double getParameter(const string& name, double nominal);
00177 
00179   const string& getParameter(const string& name, const char* nominal);
00180 
00182   const string& getParameter(const string& name, const string& nominal);
00183 
00185   const Vector& getParameter(const string& name, const Vector& nominal);
00186 
00187 
00189   bool getParameter(const string& name, bool nominal) const;
00190 
00192   int getParameter(const string& name, int nominal) const;
00193 
00195   double getParameter(const string& name, double nominal) const;
00196 
00198   const string& getParameter(const string& name, const char* nominal) const;
00199 
00201   const string& getParameter(const string& name, const string& nominal) const;
00202 
00204   const Vector& getParameter(const string& name, const Vector& nominal) const;
00205 
00207 
00215 
00217   double getDoubleParameter(const string& name) const;
00218 
00220   const Vector& getVectorParameter(const string& name) const;
00221 
00223   const Matrix& getMatrixParameter(const string& name) const;
00225  
00232 
00234   bool isParameter(const string& name) const;
00235 
00237   bool isParameterBool(const string& name) const;
00238 
00240   bool isParameterInt(const string& name) const;
00241 
00243   bool isParameterDouble(const string& name) const;
00244 
00246   bool isParameterString(const string& name) const;
00247 
00249   bool isParameterSublist(const string& name) const;
00250 
00252   bool isParameterValue(const string& name) const;
00253 
00255   bool isParameterVector(const string& name) const;
00256 
00258   bool isParameterMatrix(const string& name) const;
00260 
00267 
00269   bool isParameterEqual(const string& name, bool value) const;
00270 
00272   bool isParameterEqual(const string& name, int value) const;
00273 
00275   bool isParameterEqual(const string& name, double value) const;
00276 
00278   bool isParameterEqual(const string& name, const char* value) const;
00279 
00281   bool isParameterEqual(const string& name, const string& value) const;
00282 
00284   bool isParameterEqual(const string& name, const Vector& value) const;
00285 
00287 
00289 
00291   ostream& print(ostream& stream = cout, int indent = 0) const;
00292 
00294 
00302     
00304   void pack() const;
00305 
00307   void unpack();
00308 
00310 
00311 private:
00312 
00314   bool isRecursive(const List& l) const;
00315 
00317   const string& name(ConstIterator i) const;
00318 
00320   Entry& entry(Iterator i);
00321 
00323   const Entry& entry(ConstIterator i) const;
00324 
00325 private:
00326 
00328   enum PackingCodes 
00329   {
00331     NEW_ENTRY,
00333     END_OF_LIST
00334   };
00335 
00337   Map params;
00338  
00344   mutable vector<string> tmpstrings;
00345 };
00346 }
00347 }
00348 
00349 #endif
00350 
00351 

 

© Sandia Corporation | Site Contact | Privacy and Security

Generated on Fri Feb 16 10:33:35 2007 for APPSPACK 5.0.1 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2002