00001 // $Id: APPSPACK_Print.cpp,v 1.7 2003/11/26 16:27:11 tgkolda Exp $ 00002 // $Source: /space/CVS-Acro/acro/packages/appspack/appspack/src/APPSPACK_Print.cpp,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 #include "APPSPACK_Print.hpp" 00039 #include "APPSPACK_Parameter_List.hpp" 00040 00041 int APPSPACK::Print::precision; 00042 unsigned int APPSPACK::Print::debug; 00043 00044 APPSPACK::Print::Print(Parameter::List& params) 00045 { 00046 // Statics 00047 debug = params.getParameter("Debug", 3); 00048 precision = params.getParameter("Precision", 3); 00049 } 00050 00051 APPSPACK::Print::~Print() 00052 { 00053 00054 } 00055 00056 APPSPACK::Print::PrintablePositiveDouble APPSPACK::Print::formatPositiveDouble(double d, int precision_in) 00057 { 00058 return PrintablePositiveDouble(d, precision_in); 00059 } 00060 00061 APPSPACK::Print::PrintableDouble APPSPACK::Print::formatDouble(double d, int precision_in) 00062 { 00063 return PrintableDouble(d, precision_in); 00064 } 00065 00066 /* 00067 APPSPACK::Print::PrintableValue APPSPACK::Print::formatValue(Value v, int precision_in) 00068 { 00069 return PrintableValue(v, precision_in); 00070 } 00071 */ 00072 00073 bool APPSPACK::Print::doPrint(enum APPSPACK::Print::PrintType type) 00074 { 00075 return (debug >= type); 00076 } 00077 00078 ostream& operator<< (ostream& stream, const APPSPACK::Print::PrintablePositiveDouble value) 00079 { 00080 stream.setf(ios::scientific); 00081 stream.precision(value.precision); 00082 stream << setw(APPSPACK::Print::precision + 6) << value.d; 00083 stream.unsetf(ios::scientific); 00084 return stream; 00085 } 00086 00087 ostream& operator<< (ostream& stream, const APPSPACK::Print::PrintableDouble value) 00088 { 00089 stream.setf(ios::scientific); 00090 stream.precision(value.precision); 00091 stream << setw(APPSPACK::Print::precision + 7) << value.d; 00092 stream.unsetf(ios::scientific); 00093 return stream; 00094 } 00095 00096 /* 00097 ostream& operator<< (ostream& stream, const APPSPACK::Print::PrintableValue value) 00098 { 00099 if (value.v.getIsValue()) 00100 stream << APPSPACK::Print::formatDouble(value.v.getValue(), value.precision); 00101 else 00102 { 00103 stream << "<null>"; 00104 for (int i = 0; i < value.precision + 1; i ++) 00105 stream << " "; 00106 } 00107 return stream; 00108 } 00109 */ 00110 00111 /* 00112 ostream& operator<< (ostream& os, const APPSPACK::PrintablePositiveDouble value) 00113 { 00114 ostringstream s; 00115 s.setf(ios::scientific); 00116 s.precision(APPSPACK::Print::precision); 00117 s << setw(APPSPACK::Print::precision + 6) << value.d; 00118 return os << s.str(); 00119 } 00120 00121 ostream& operator<< (ostream& os, const APPSPACK::PrintableDouble value) 00122 { 00123 ostringstream s; 00124 s.setf(ios::scientific); 00125 s.precision(APPSPACK::Print::precision); 00126 os << setw(APPSPACK::Print::precision + 7) << value.d; 00127 return os << s.str(); 00128 } 00129 */ 00130 00131
© Sandia Corporation | Site Contact | Privacy and Security
Generated on Wed Dec 14 18:41:04 2005 for APPSPACK 4.0.2 by
1.3.8 written by Dimitri van Heesch,
© 1997-2002