SundanceOut.hpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 // ************************************************************************
00003 // 
00004 //                              Sundance
00005 //                 Copyright (2005) Sandia Corporation
00006 // 
00007 // Copyright (year first published) Sandia Corporation.  Under the terms 
00008 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government 
00009 // retains certain rights in this software.
00010 // 
00011 // This library is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Lesser General Public License as
00013 // published by the Free Software Foundation; either version 2.1 of the
00014 // License, or (at your option) any later version.
00015 //  
00016 // This library is distributed in the hope that it will be useful, but
00017 // WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 // Lesser General Public License for more details.
00020 //                                                                                 
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License along with this library; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024 // USA                                                                                
00025 // Questions? Contact Kevin Long (krlong@sandia.gov), 
00026 // Sandia National Laboratories, Livermore, California, USA
00027 // 
00028 // ************************************************************************
00029 /* @HEADER@ */
00030 
00031 #ifndef SUNDANCE_OUT_H
00032 #define SUNDANCE_OUT_H
00033 
00034 #include "SundanceDefs.hpp"
00035 #include "Teuchos_Assert.hpp"
00036 #include "SundanceObjectWithVerbosity.hpp"
00037 #include "PlayaOut.hpp"
00038 #include "PlayaTabs.hpp"
00039 #include "Teuchos_RefCountPtr.hpp"
00040 #include "Teuchos_FancyOStream.hpp"
00041 #include "PlayaMPIComm.hpp"
00042 
00043 using Playa::Out;
00044 using Playa::Tabs;
00045 
00046 #define SUNDANCE_OUT(test, msg) PLAYA_OUT(test, msg)
00047 
00048 
00049 #define SUNDANCE_VERB_EXTREME(msg) PLAYA_MSG4(this->verb(), msg)
00050 #define SUNDANCE_VERB_HIGH(msg) PLAYA_MSG3(this->verb(), msg)
00051 #define SUNDANCE_VERB_MEDIUM(msg) PLAYA_MSG2(this->verb(), msg)
00052 #define SUNDANCE_VERB_LOW(msg) PLAYA_MSG1(this->verb(), msg)
00053 
00054 #define SUNDANCE_HEADER_LINE "\n------------------------------------------------------------------\n"
00055 
00056 #define SUNDANCE_MSG(context, level, msg) PLAYA_OUT(this->verbLevel(context) >= level, msg)
00057 
00058 #define SUNDANCE_LEVEL1(context, msg) PLAYA_MSG(context, 1, msg)
00059 
00060 #define SUNDANCE_LEVEL2(context, msg) PLAYA_MSG(context, 2, msg)
00061 
00062 #define SUNDANCE_LEVEL3(context, msg) PLAYA_MSG(context, 3, msg)
00063 
00064 #define SUNDANCE_LEVEL4(context, msg) PLAYA_MSG(context, 4, msg)
00065 
00066 #define SUNDANCE_LEVEL5(context, msg) PLAYA_MSG(context, 5, msg)
00067 
00068 
00069 #define SUNDANCE_MSG1(level, msg) PLAYA_OUT(level >= 1, msg)
00070 
00071 #define SUNDANCE_MSG2(level, msg) PLAYA_OUT(level >= 2, msg)
00072 
00073 #define SUNDANCE_MSG3(level, msg) PLAYA_OUT(level >= 3, msg)
00074 
00075 #define SUNDANCE_MSG4(level, msg) PLAYA_OUT(level >= 4, msg)
00076 
00077 #define SUNDANCE_MSG5(level, msg) PLAYA_OUT(level >= 5, msg)
00078 
00079 #define SUNDANCE_BANNER1(level, tab, msg) \
00080   PLAYA_MSG1(level, tab \
00081     << "===================================================================");\
00082   PLAYA_MSG1(level, tab << std::endl << tab \
00083     << "  " << msg); \
00084   PLAYA_MSG1(level, tab << std::endl << tab\
00085     << "===================================================================");
00086 
00087 
00088 #define SUNDANCE_BANNER2(level, tab, msg) \
00089   SUNDANCE_MSG2(level, tab \
00090     << "-------------------------------------------------------------------");\
00091   SUNDANCE_MSG2(level, tab << msg); \
00092   SUNDANCE_MSG2(level, tab\
00093     << "-------------------------------------------------------------------");
00094 
00095 
00096 
00097 #define SUNDANCE_BANNER3(level, tab, msg) \
00098   SUNDANCE_MSG3(level, tab \
00099     << "-------------------------------------------------------------------");\
00100   SUNDANCE_MSG3(level, tab << std::endl << tab \
00101     << msg); \
00102   SUNDANCE_MSG3(level, tab << std::endl << tab\
00103     << "-------------------------------------------------------------------");
00104 
00105 #define SUNDANCE_TRACE(e) \
00106 { \
00107   TeuchosOStringStream omsg; \
00108         omsg << e.what() << std::endl \
00109   << "caught in " << __FILE__ << ":" << __LINE__ << std::endl ; \
00110         throw std::runtime_error(TEUCHOS_OSTRINGSTREAM_GET_C_STR(omsg)); \
00111 }
00112 
00113 #define SUNDANCE_TRACE_MSG(e, msg)                      \
00114 { \
00115   TeuchosOStringStream omsg; \
00116         omsg << e.what() << std::endl \
00117   << "caught in " << __FILE__ << ":" << __LINE__ << std::endl ; \
00118   omsg << msg << std::endl; \
00119   throw std::runtime_error(TEUCHOS_OSTRINGSTREAM_GET_C_STR(omsg)); \
00120 }
00121 
00122 
00123 #define SUNDANCE_ERROR(msg) \
00124 { \
00125   TeuchosOStringStream omsg; \
00126         omsg << __FILE__ << ":" << __LINE__ << ": " \
00127        << ": " << msg; \
00128   const std::string &omsgstr = omsg.str(); \
00129   Teuchos::TestForException_break(omsgstr); \
00130   throw std::runtime_error(TEUCHOS_OSTRINGSTREAM_GET_C_STR(omsg)); \
00131 }
00132 
00133 
00134 #endif

Site Contact