19 #ifndef GEOSX_COMMON_LOGGER_HPP 20 #define GEOSX_COMMON_LOGGER_HPP 27 #if defined(GEOSX_USE_MPI) 35 #define GEOSX_LOG( ... ) LVARRAY_LOG( __VA_ARGS__ ) 41 #define GEOSX_LOG_VAR( ... ) LVARRAY_LOG_VAR( __VA_ARGS__ ) 48 #define GEOSX_LOG_RANK_0_IF( EXP, msg ) \ 50 if( ::geosx::logger::internal::rank == 0 && EXP ) \ 52 std::ostringstream oss; \ 54 std::cout << oss.str() << std::endl; \ 62 #define GEOSX_LOG_RANK_0( msg ) GEOSX_LOG_RANK_0_IF( true, msg ) 69 #if defined(__CUDA_ARCH__) 70 #define GEOSX_LOG_RANK_IF( EXP, msg ) 72 #define GEOSX_LOG_RANK_IF( EXP, msg ) \ 76 std::ostringstream oss; \ 77 oss << "Rank " << ::geosx::logger::internal::rankString << ": " << msg; \ 78 *logger::internal::rankStream << oss.str() << std::endl; \ 87 #define GEOSX_LOG_RANK( msg ) GEOSX_LOG_RANK_IF( true, msg ) 93 #define GEOSX_LOG_RANK_VAR( var ) GEOSX_LOG_RANK( #var " = " << var ) 100 #if defined(__CUDA_ARCH__) 101 #define GEOSX_ERROR_IF( EXP, msg ) LVARRAY_ERROR_IF( EXP, msg ) 103 #define GEOSX_ERROR_IF( EXP, msg ) LVARRAY_ERROR_IF( EXP, "***** Rank " << ::geosx::logger::internal::rankString << ": " << msg ) 110 #define GEOSX_ERROR( msg ) GEOSX_ERROR_IF( true, msg ) 117 #define GEOSX_ASSERT_MSG( EXP, msg ) LVARRAY_ASSERT_MSG( EXP, "***** Rank " << ::geosx::logger::internal::rankString << ": " << msg ) 123 #define GEOSX_ASSERT( EXP ) GEOSX_ASSERT_MSG( EXP, "" ) 130 #define GEOSX_WARNING_IF( EXP, msg ) LVARRAY_WARNING_IF( EXP, msg ) 136 #define GEOSX_WARNING( msg ) LVARRAY_WARNING( msg ) 143 #define GEOSX_INFO_IF( EXP, msg ) LVARRAY_INFO_IF( EXP, msg ) 149 #define GEOSX_INFO( msg ) LVARRAY_INFO( msg ) 157 #define GEOSX_ERROR_IF_EQ_MSG( lhs, rhs, msg ) LVARRAY_ERROR_IF_EQ_MSG( lhs, rhs, "***** Rank " << ::geosx::logger::internal::rankString << ": " << msg ) 164 #define GEOSX_ERROR_IF_EQ( lhs, rhs ) GEOSX_ERROR_IF_EQ_MSG( lhs, rhs, "" ) 172 #define GEOSX_ERROR_IF_NE_MSG( lhs, rhs, msg ) LVARRAY_ERROR_IF_NE_MSG( lhs, rhs, "***** Rank " << ::geosx::logger::internal::rankString << ": " << msg ) 179 #define GEOSX_ERROR_IF_NE( lhs, rhs ) GEOSX_ERROR_IF_NE_MSG( lhs, rhs, "" ) 187 #define GEOSX_ERROR_IF_GT_MSG( lhs, rhs, msg ) LVARRAY_ERROR_IF_GT_MSG( lhs, rhs, "***** Rank " << ::geosx::logger::internal::rankString << ": " << msg ) 194 #define GEOSX_ERROR_IF_GT( lhs, rhs ) GEOSX_ERROR_IF_GT_MSG( lhs, rhs, "" ) 202 #define GEOSX_ERROR_IF_GE_MSG( lhs, rhs, msg ) LVARRAY_ERROR_IF_GE_MSG( lhs, rhs, "***** Rank " << ::geosx::logger::internal::rankString << ": " << msg ) 209 #define GEOSX_ERROR_IF_GE( lhs, rhs ) GEOSX_ERROR_IF_GE_MSG( lhs, rhs, "" ) 217 #define GEOSX_ERROR_IF_LT_MSG( lhs, rhs, msg ) LVARRAY_ERROR_IF_LT_MSG( lhs, rhs, "***** Rank " << ::geosx::logger::internal::rankString << ": " << msg ) 224 #define GEOSX_ERROR_IF_LT( lhs, rhs ) GEOSX_ERROR_IF_LT_MSG( lhs, rhs, "" ) 232 #define GEOSX_ERROR_IF_LE_MSG( lhs, rhs, msg ) LVARRAY_ERROR_IF_LE_MSG( lhs, rhs, "***** Rank " << ::geosx::logger::internal::rankString << ": " << msg ) 239 #define GEOSX_ERROR_IF_LE( lhs, rhs ) GEOSX_ERROR_IF_LE_MSG( lhs, rhs, "" ) 247 #define GEOSX_ASSERT_EQ_MSG( lhs, rhs, msg ) LVARRAY_ASSERT_EQ_MSG( lhs, rhs, "***** Rank " << ::geosx::logger::internal::rankString << ": " << msg ) 254 #define GEOSX_ASSERT_EQ( lhs, rhs ) GEOSX_ASSERT_EQ_MSG( lhs, rhs, "" ) 262 #define GEOSX_ASSERT_NE_MSG( lhs, rhs, msg ) LVARRAY_ASSERT_NE_MSG( lhs, rhs, msg ) 269 #define GEOSX_ASSERT_NE( lhs, rhs ) LVARRAY_ASSERT_NE( lhs, rhs ) 277 #define GEOSX_ASSERT_GT_MSG( lhs, rhs, msg ) LVARRAY_ASSERT_GT_MSG( lhs, rhs, "***** Rank " << ::geosx::logger::internal::rankString << ": " << msg ) 284 #define GEOSX_ASSERT_GT( lhs, rhs ) GEOSX_ASSERT_GT_MSG( lhs, rhs, "" ) 292 #define GEOSX_ASSERT_GE_MSG( lhs, rhs, msg ) LVARRAY_ASSERT_GE_MSG( lhs, rhs, "***** Rank " << ::geosx::logger::internal::rankString << ": " << msg ) 299 #define GEOSX_ASSERT_GE( lhs, rhs ) GEOSX_ASSERT_GE_MSG( lhs, rhs, "" ) 306 #define GEOSX_LOG_LEVEL_FN( minLevel, fn ) \ 308 if( this->getLogLevel() >= minLevel ) \ 319 #define GEOSX_LOG_LEVEL( minLevel, msg ) GEOSX_INFO_IF( this->getLogLevel() >= minLevel, msg ); 326 #define GEOSX_LOG_LEVEL_RANK_0( minLevel, msg ) GEOSX_LOG_RANK_0_IF( this->getLogLevel() >= minLevel, msg ) 333 #define GEOSX_LOG_LEVEL_BY_RANK( minLevel, msg ) GEOSX_LOG_RANK_IF( this->getLogLevel() >= minLevel, msg ) 351 extern std::ostream * rankStream;
353 #if defined(GEOSX_USE_MPI) 354 extern MPI_Comm comm;
358 #if defined(GEOSX_USE_MPI) 364 void InitializeLogger( MPI_Comm comm,
const std::string & rank_output_dir=
"" );
371 void InitializeLogger(
const std::string & rank_output_dir=
"" );
376 void FinalizeLogger();
Contains a bunch of macro definitions.
std::string string
String type.