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_Print.cpp

Go to the documentation of this file.
00001 // $Id: APPSPACK_Print.cpp,v 1.10 2006/06/30 01:42:08 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 #include "APPSPACK_Float.hpp"
00041 
00042 int APPSPACK::Print::precision;
00043 unsigned int APPSPACK::Print::debug;
00044 
00045 APPSPACK::Print::Print(Parameter::List& params)
00046 {
00047   // Statics
00048   debug = params.getParameter("Debug", 3);
00049   precision = params.getParameter("Precision", 3);
00050 }
00051 
00052 APPSPACK::Print::~Print()
00053 {
00054 
00055 }
00056 
00057 APPSPACK::Print::PrintablePositiveDouble APPSPACK::Print::formatPositiveDouble(double d, int precision_in)
00058 {
00059   return PrintablePositiveDouble(d, precision_in);
00060 }
00061 
00062 APPSPACK::Print::PrintableDouble APPSPACK::Print::formatDouble(double d, int precision_in)
00063 {
00064   return PrintableDouble(d, precision_in);
00065 }
00066 
00067 bool APPSPACK::Print::doPrint(enum APPSPACK::Print::PrintType type)
00068 {
00069   return (debug >= type);
00070 }
00071 
00072 ostream& operator<< (ostream& stream, const APPSPACK::Print::PrintablePositiveDouble value)
00073 {
00074   stream.setf(ios::scientific);
00075   stream.precision(value.precision);
00076   if (APPSPACK::exists(value.d))
00077     stream << setw(APPSPACK::Print::precision + 6) << value.d;
00078   else
00079   {
00080     stream << " DNE";
00081     for (int i = 0; i < APPSPACK::Print::precision + 2; i ++)
00082       stream << " ";
00083   }
00084   stream.unsetf(ios::scientific);
00085   return stream;
00086 }
00087 
00088 ostream& operator<< (ostream& stream, const APPSPACK::Print::PrintableDouble value)
00089 {
00090   stream.setf(ios::scientific);
00091   stream.precision(value.precision);
00092   if (APPSPACK::exists(value.d))
00093     stream << setw(APPSPACK::Print::precision + 7) << value.d;
00094   else
00095   {
00096     stream << " DNE";
00097     for (int i = 0; i < APPSPACK::Print::precision + 3; i ++)
00098       stream << " ";
00099   }
00100   stream.unsetf(ios::scientific);
00101   return stream;
00102 }
00103 

 

© 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