GEOS
Logger.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 TotalEnergies
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
20 #ifndef GEOS_COMMON_LOGGER_HPP
21 #define GEOS_COMMON_LOGGER_HPP
22 
23 // Source includes
24 #include "LvArray/src/Macros.hpp"
26 
27 // System includes
28 #include <stdexcept>
29 
30 #if defined(GEOS_USE_MPI)
31  #include <mpi.h>
32 #endif
33 
38 #define GEOS_LOG( ... ) LVARRAY_LOG( __VA_ARGS__ )
39 
44 #define GEOS_LOG_VAR( ... ) LVARRAY_LOG_VAR( __VA_ARGS__ )
45 
46 
52 #if defined(GEOS_DEVICE_COMPILE)
53 #define GEOS_LOG_IF( EXP, msg )
54 #else
55 #define GEOS_LOG_IF( EXP, msg ) \
56  do { \
57  if( EXP ) \
58  { \
59  std::cout<< msg << std::endl; \
60  } \
61  } while( false )
62 #endif
63 
64 
70 #define GEOS_LOG_RANK_0_IF( EXP, msg ) \
71  do { \
72  if( ::geos::logger::internal::g_rank == 0 && EXP ) \
73  { \
74  std::ostringstream oss; \
75  oss << msg; \
76  std::cout << oss.str() << std::endl; \
77  } \
78  } while( false )
79 
85 #define GEOS_LOG_RANK_0_IF_NLR( EXP, msg ) \
86  do { \
87  if( ::geos::logger::internal::g_rank == 0 && EXP ) \
88  { \
89  std::ostringstream oss; \
90  oss << msg; \
91  std::cout << oss.str(); \
92  } \
93  } while( false )
94 
99 #define GEOS_LOG_RANK_0( msg ) GEOS_LOG_RANK_0_IF( true, msg )
100 
106 #if defined(GEOS_DEVICE_COMPILE)
107 #define GEOS_LOG_RANK_IF( EXP, msg )
108 #else
109 #define GEOS_LOG_RANK_IF( EXP, msg ) \
110  do { \
111  if( EXP ) \
112  { \
113  std::ostringstream oss; \
114  oss << "Rank " << ::geos::logger::internal::g_rankString << ": " << msg; \
115  *logger::internal::g_rankStream << oss.str() << std::endl; \
116  } \
117  } while( false )
118 #endif
119 
124 #define GEOS_LOG_RANK( msg ) GEOS_LOG_RANK_IF( true, msg )
125 
130 #define GEOS_LOG_RANK_VAR( var ) GEOS_LOG_RANK( #var " = " << var )
131 
137 #if !defined(GEOS_DEVICE_COMPILE) && !defined(GEOS_GLOBAL_LOGGER)
138 #define GEOS_GLOBAL_LOGGER ErrorLogger::global()
139 #endif
140 
150 #if !defined(GEOS_DEVICE_COMPILE)
151 #define GEOS_ERROR_IF_CAUSE( COND, CAUSE_MESSAGE, ... ) \
152  do \
153  { \
154  if( COND ) \
155  { \
156  std::ostringstream __msgoss; \
157  __msgoss << GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ ); \
158  std::ostringstream __causemsgsoss; \
159  __causemsgsoss << CAUSE_MESSAGE; \
160  GEOS_GLOBAL_LOGGER.initCurrentExceptionMessage( MsgType::Error, __msgoss.str(), \
161  ::geos::logger::internal::g_rank ) \
162  .setCodeLocation( __FILE__, __LINE__ ) \
163  .setCause( __causemsgsoss.str() ) \
164  .addCallStackInfo( LvArray::system::stackTrace( true ) ) \
165  .addContextInfo( GEOS_DETAIL_REST_ARGS( __VA_ARGS__ )); \
166  GEOS_GLOBAL_LOGGER.flushCurrentExceptionMessage(); \
167  LvArray::system::callErrorHandler(); \
168  } \
169  }while( false )
170  #elif __CUDA_ARCH__
171 #define GEOS_ERROR_IF_CAUSE( COND, CAUSE_MESSAGE, ... ) \
172  do \
173  { \
174  if( COND ) \
175  { \
176  constexpr char const * formatString = "***** ERROR\n" \
177  "***** LOCATION" LOCATION "\n" \
178  "***** BLOCK: [%u, %u, %u]\n" \
179  "***** THREAD: [%u, %u, %u]\n" \
180  "***** " STRINGIZE( CAUSE_MESSAGE ) "\n" \
181  "***** " STRINGIZE( GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ ) ) "\n\n"; \
182  printf( formatString, blockIdx.x, blockIdx.y, blockIdx.z, threadIdx.x, threadIdx.y, threadIdx.z ); \
183  asm ( "trap;" ); \
184  } \
185  } while( false )
186 #elif __HIP_DEVICE_COMPILE__
187 #define GEOS_ERROR_IF_CAUSE( COND, CAUSE_MESSAGE, ... ) \
188  do \
189  { \
190  if( COND ) \
191  { \
192  constexpr char const * formatString = "***** ERROR\n" \
193  "***** LOCATION" LOCATION "\n" \
194  "***** BLOCK: [%u, %u, %u]\n" \
195  "***** THREAD: [%u, %u, %u]\n" \
196  "***** %s\n" \
197  "***** %s\n\n"; \
198  printf( formatString, \
199  blockIdx.x, blockIdx.y, blockIdx.z, \
200  threadIdx.x, threadIdx.y, threadIdx.z, \
201  STRINGIZE( CAUSE_MESSAGE ), \
202  STRINGIZE( GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ ) ) \
203  ); \
204  asm volatile ( "s_trap 2" ); \
205  } \
206  } while( false )
207 #endif
208 
216 #define GEOS_ERROR_IF( COND, ... ) \
217  GEOS_ERROR_IF_CAUSE( COND, "Error cause: " STRINGIZE( COND ), __VA_ARGS__ )
218 
225 #define GEOS_ERROR( ... ) GEOS_ERROR_IF_CAUSE( true, "", __VA_ARGS__ )
226 
236 #if !defined(GEOS_DEVICE_COMPILE)
237 #define GEOS_THROW_IF_CAUSE( COND, CAUSE_MESSAGE, MSG, ... ) \
238  do \
239  { \
240  if( COND ) \
241  { \
242  std::ostringstream __msgoss; \
243  __msgoss << MSG; \
244  std::ostringstream __causemsgsoss; \
245  __causemsgsoss << CAUSE_MESSAGE; \
246  DiagnosticMsg exceptionMsg = GEOS_GLOBAL_LOGGER.initCurrentExceptionMessage( MsgType::Exception, __msgoss.str(), \
247  ::geos::logger::internal::g_rank ) \
248  .setCodeLocation( __FILE__, __LINE__ ) \
249  .setCause( __causemsgsoss.str() ) \
250  .addCallStackInfo( LvArray::system::stackTrace( true ) ) \
251  .addContextInfo( GEOS_DETAIL_REST_ARGS( __VA_ARGS__ )) \
252  .getDiagnosticMsg(); \
253  auto ex = GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ )(); \
254  ex.prepareWhat( exceptionMsg ); \
255  throw ex; \
256  } \
257  }while( false )
258 #elif __CUDA_ARCH__
259 #define GEOS_THROW_IF_CAUSE( COND, CAUSE_MESSAGE, MSG, ... ) \
260  do \
261  { \
262  if( COND ) \
263  { \
264  static char const formatString[] = "***** ERROR\n" \
265  "***** LOCATION" LOCATION "\n" \
266  "***** BLOCK: [%u, %u, %u]\n" \
267  "***** THREAD: [%u, %u, %u]\n" \
268  "***** " STRINGIZE( CAUSE_MESSAGE ) "\n" \
269  "***** " STRINGIZE( GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ ) ) "\n\n"; \
270  printf( formatString, blockIdx.x, blockIdx.y, blockIdx.z, threadIdx.x, threadIdx.y, threadIdx.z ); \
271  asm ( "trap;" ); \
272  } \
273  } while( false )
274 #elif __HIP_DEVICE_COMPILE__
275 #define GEOS_THROW_IF_CAUSE( COND, CAUSE_MESSAGE, MSG, ... ) \
276  do \
277  { \
278  if( COND ) \
279  { \
280  static char const formatString[] = "***** ERROR\n" \
281  "***** LOCATION" LOCATION "\n" \
282  "***** BLOCK: [%u, %u, %u]\n" \
283  "***** THREAD: [%u, %u, %u]\n" \
284  "***** %s\n" \
285  "***** %s\n\n"; \
286  printf( formatString, \
287  blockIdx.x, blockIdx.y, blockIdx.z, \
288  threadIdx.x, threadIdx.y, threadIdx.z, \
289  STRINGIZE( CAUSE_MESSAGE ), \
290  STRINGIZE( GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ ) ) \
291  ); \
292  asm volatile ( "s_trap 2" ); \
293  } \
294  } while( false )
295 #endif
296 
305 #define GEOS_THROW_IF( COND, MSG, ... ) \
306  GEOS_THROW_IF_CAUSE( COND, "Error cause: " STRINGIZE( COND ), MSG, __VA_ARGS__ )
307 
315 #define GEOS_THROW( MSG, ... ) GEOS_THROW_IF_CAUSE( true, "", MSG, __VA_ARGS__ )
316 
325 #if !defined(GEOS_DEVICE_COMPILE)
326 #define GEOS_WARNING_IF_CAUSE( COND, CAUSE_MESSAGE, ... ) \
327  do \
328  { \
329  if( COND ) \
330  { \
331  std::ostringstream __msgoss; \
332  __msgoss << GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ ); \
333  std::ostringstream __causemsgsoss; \
334  __causemsgsoss << CAUSE_MESSAGE; \
335  DiagnosticMsg __warningMsg; \
336  GEOS_GLOBAL_LOGGER.flushErrorMsg( DiagnosticMsgBuilder::init( __warningMsg, \
337  MsgType::Warning, __msgoss.str(), \
338  ::geos::logger::internal::g_rank ) \
339  .setCodeLocation( __FILE__, __LINE__ ) \
340  .setCause( __causemsgsoss.str() ) \
341  .addCallStackInfo( LvArray::system::stackTrace( true ) ) \
342  .addContextInfo( GEOS_DETAIL_REST_ARGS( __VA_ARGS__ )) \
343  .getDiagnosticMsg() ); \
344  } \
345  }while( false )
346 #elif __CUDA_ARCH__
347 #define GEOS_WARNING_IF_CAUSE( COND, CAUSE_MESSAGE, ... ) \
348  do \
349  { \
350  if( COND ) \
351  { \
352  static char const formatString[] = "***** WARNING\n" \
353  "***** LOCATION" LOCATION "\n" \
354  "***** BLOCK: [%u, %u, %u]\n" \
355  "***** THREAD: [%u, %u, %u]\n" \
356  "***** " STRINGIZE( CAUSE_MESSAGE ) "\n" \
357  "***** " STRINGIZE( GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ ) ) "\n\n"; \
358  printf( formatString, blockIdx.x, blockIdx.y, blockIdx.z, threadIdx.x, threadIdx.y, threadIdx.z ); \
359  asm ( "trap;" ); \
360  } \
361  } while( false )
362 #elif __HIP_DEVICE_COMPILE__
363 #define GEOS_WARNING_IF_CAUSE( COND, CAUSE_MESSAGE, ... ) \
364  do \
365  { \
366  if( COND ) \
367  { \
368  static char const formatString[] = "***** WARNING\n" \
369  "***** LOCATION" LOCATION "\n" \
370  "***** BLOCK: [%u, %u, %u]\n" \
371  "***** THREAD: [%u, %u, %u]\n" \
372  "***** %s\n" \
373  "***** %s\n\n"; \
374  printf( formatString, \
375  blockIdx.x, blockIdx.y, blockIdx.z, \
376  threadIdx.x, threadIdx.y, threadIdx.z, \
377  STRINGIZE( CAUSE_MESSAGE ), \
378  STRINGIZE( GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ ) ) \
379  ); \
380  asm volatile ( "s_trap 2" ); \
381  } \
382  } while( false )
383 #endif
384 
392 #define GEOS_WARNING_IF( COND, ... ) \
393  GEOS_WARNING_IF_CAUSE( COND, "Warning cause: " STRINGIZE( COND ), __VA_ARGS__ )
394 
401 #define GEOS_WARNING( ... ) GEOS_WARNING_IF_CAUSE( true, "", __VA_ARGS__ )
402 
408 #define GEOS_INFO_IF( EXP, msg ) LVARRAY_INFO_IF( EXP, msg )
409 
414 #define GEOS_INFO( msg ) LVARRAY_INFO( msg )
415 
421 #define GEOS_ERROR_LHS_RHS_DECLS( lhs, rhs ) \
422  GEOS_MAYBE_UNUSED auto const lhsResult = (lhs); \
423  GEOS_MAYBE_UNUSED auto const rhsResult = (rhs)
424 
435 #define GEOS_ERROR_IF_OP_MSG( lhs, OP, NOP, rhs, ... ) \
436  do { \
437  GEOS_ERROR_LHS_RHS_DECLS( lhs, rhs ); \
438  GEOS_ERROR_IF_CAUSE( lhsResult OP rhsResult, \
439  "Expected: " #lhs " " #NOP " " #rhs "\n* " #lhs " = " << lhsResult << "\n* " #rhs " = " << rhsResult << "\n", \
440  __VA_ARGS__ ); \
441  } while(false)
442 
443 
452 #define GEOS_ERROR_IF_EQ_MSG( lhs, rhs, ... ) GEOS_ERROR_IF_OP_MSG( lhs, ==, !=, rhs, __VA_ARGS__ )
453 
459 #define GEOS_ERROR_IF_EQ( lhs, rhs ) GEOS_ERROR_IF_EQ_MSG( lhs, rhs, "" )
460 
469 #define GEOS_ERROR_IF_NE_MSG( lhs, rhs, ... ) GEOS_ERROR_IF_OP_MSG( lhs, !=, ==, rhs, __VA_ARGS__ )
470 
476 #define GEOS_ERROR_IF_NE( lhs, rhs ) GEOS_ERROR_IF_NE_MSG( lhs, rhs, "" )
477 
486 #define GEOS_ERROR_IF_GT_MSG( lhs, rhs, ... ) GEOS_ERROR_IF_OP_MSG( lhs, >, <=, rhs, __VA_ARGS__ )
487 
493 #define GEOS_ERROR_IF_GT( lhs, rhs ) GEOS_ERROR_IF_GT_MSG( lhs, rhs, "" )
494 
503 #define GEOS_ERROR_IF_GE_MSG( lhs, rhs, ... ) GEOS_ERROR_IF_OP_MSG( lhs, >=, <, rhs, __VA_ARGS__ )
504 
510 #define GEOS_ERROR_IF_GE( lhs, rhs ) GEOS_ERROR_IF_GE_MSG( lhs, rhs, "" )
511 
520 #define GEOS_ERROR_IF_LT_MSG( lhs, rhs, ... ) GEOS_ERROR_IF_OP_MSG( lhs, <, >=, rhs, __VA_ARGS__ )
521 
527 #define GEOS_ERROR_IF_LT( lhs, rhs ) GEOS_ERROR_IF_LT_MSG( lhs, rhs, "" )
528 
537 #define GEOS_ERROR_IF_LE_MSG( lhs, rhs, ... ) GEOS_ERROR_IF_OP_MSG( lhs, <=, >, rhs, __VA_ARGS__ )
538 
539 
545 #define GEOS_ERROR_IF_LE( lhs, rhs ) GEOS_ERROR_IF_LE_MSG( lhs, rhs, "" )
546 
557 #define GEOS_WARNING_IF_OP_MSG( lhs, OP, NOP, rhs, ... ) \
558  do { \
559  GEOS_ERROR_LHS_RHS_DECLS( lhs, rhs ); \
560  GEOS_WARNING_IF_CAUSE( lhsResult OP rhsResult, \
561  "Expected: " #lhs " " #NOP " " #rhs "\n* " #lhs " = " << lhsResult << "\n* " #rhs " = " << rhsResult << "\n", \
562  __VA_ARGS__ ); \
563  } while(false)
564 
565 
574 #define GEOS_WARNING_IF_EQ_MSG( lhs, rhs, ... ) GEOS_WARNING_IF_OP_MSG( lhs, ==, !=, rhs, __VA_ARGS__ )
575 
581 #define GEOS_WARNING_IF_EQ( lhs, rhs ) GEOS_WARNING_IF_EQ_MSG( lhs, rhs, "" )
582 
591 #define GEOS_WARNING_IF_NE_MSG( lhs, rhs, ... ) GEOS_WARNING_IF_OP_MSG( lhs, !=, ==, rhs, __VA_ARGS__ )
592 
598 #define GEOS_WARNING_IF_NE( lhs, rhs ) GEOS_WARNING_IF_NE_MSG( lhs, rhs, "" )
599 
608 #define GEOS_WARNING_IF_GT_MSG( lhs, rhs, ... ) GEOS_WARNING_IF_OP_MSG( lhs, >, <=, rhs, __VA_ARGS__ )
609 
615 #define GEOS_WARNING_IF_GT( lhs, rhs ) GEOS_WARNING_IF_GT_MSG( lhs, rhs, "" )
616 
625 #define GEOS_WARNING_IF_GE_MSG( lhs, rhs, ... ) GEOS_WARNING_IF_OP_MSG( lhs, >=, <, rhs, __VA_ARGS__ )
626 
632 #define GEOS_WARNING_IF_GE( lhs, rhs ) GEOS_WARNING_IF_GE_MSG( lhs, rhs, "" )
633 
642 #define GEOS_WARNING_IF_LT_MSG( lhs, rhs, ... ) GEOS_WARNING_IF_OP_MSG( lhs, <, >=, rhs, __VA_ARGS__ )
643 
649 #define GEOS_WARNING_IF_LT( lhs, rhs ) GEOS_WARNING_IF_LT_MSG( lhs, rhs, "" )
650 
659 #define GEOS_WARNING_IF_LE_MSG( lhs, rhs, ... ) GEOS_WARNING_IF_OP_MSG( lhs, <=, >, rhs, __VA_ARGS__ )
660 
666 #define GEOS_WARNING_IF_LE( lhs, rhs ) GEOS_WARNING_IF_LE_MSG( lhs, rhs, "" )
667 
679 #define GEOS_THROW_IF_OP_MSG( lhs, OP, NOP, rhs, MSG, ... ) \
680  do { \
681  GEOS_ERROR_LHS_RHS_DECLS( lhs, rhs ); \
682  GEOS_THROW_IF_CAUSE( lhsResult OP rhsResult, \
683  "Expected: " #lhs " " #NOP " " #rhs "\n* " #lhs " = " << lhsResult << "\n* " #rhs " = " << rhsResult << "\n", \
684  MSG, __VA_ARGS__ ); \
685  } while(false)
686 
687 
688 
698 #define GEOS_THROW_IF_EQ_MSG( lhs, rhs, MSG, ... ) GEOS_THROW_IF_OP_MSG( lhs, ==, !=, rhs, MSG, __VA_ARGS__ )
699 
708 #define GEOS_THROW_IF_EQ( lhs, rhs, ... ) GEOS_THROW_IF_EQ_MSG( lhs, rhs, "", __VA_ARGS__ )
709 
719 #define GEOS_THROW_IF_NE_MSG( lhs, rhs, MSG, ... ) GEOS_THROW_IF_OP_MSG( lhs, !=, ==, rhs, MSG, __VA_ARGS__ )
720 
729 #define GEOS_THROW_IF_NE( lhs, rhs, ... ) GEOS_THROW_IF_NE_MSG( lhs, rhs, "", __VA_ARGS__ )
730 
740 #define GEOS_THROW_IF_GT_MSG( lhs, rhs, MSG, ... ) GEOS_THROW_IF_OP_MSG( lhs, >, <=, rhs, MSG, __VA_ARGS__ )
741 
750 #define GEOS_THROW_IF_GT( lhs, rhs, ... ) GEOS_THROW_IF_GT_MSG( lhs, rhs, "", __VA_ARGS__ )
751 
761 #define GEOS_THROW_IF_GE_MSG( lhs, rhs, MSG, ... ) GEOS_THROW_IF_OP_MSG( lhs, >=, <, rhs, MSG, __VA_ARGS__ )
762 
771 #define GEOS_THROW_IF_GE( lhs, rhs, ... ) GEOS_THROW_IF_GE_MSG( lhs, rhs, "", __VA_ARGS__ )
772 
782 #define GEOS_THROW_IF_LT_MSG( lhs, rhs, MSG, ... ) GEOS_THROW_IF_OP_MSG( lhs, <, >=, rhs, MSG, __VA_ARGS__ )
783 
792 #define GEOS_THROW_IF_LT( lhs, rhs, ... ) GEOS_THROW_IF_LT_MSG( lhs, rhs, "", __VA_ARGS__ )
793 
803 #define GEOS_THROW_IF_LE_MSG( lhs, rhs, MSG, ... ) GEOS_THROW_IF_OP_MSG( lhs, <=, >, rhs, MSG, __VA_ARGS__ )
804 
813 #define GEOS_THROW_IF_LE( lhs, rhs, ... ) GEOS_THROW_IF_LE_MSG( lhs, rhs, "", __VA_ARGS__ )
814 
815 #if !defined(NDEBUG) || defined(GEOS_ASSERT_ENABLED)
816 
820 #define GEOS_ASSERT_ENABLED
821 
834 #define GEOS_ASSERT_MSG( COND, ... ) \
835  GEOS_ERROR_IF_CAUSE( !( COND ), "Expected: " STRINGIZE( COND ), __VA_ARGS__ )
836 
846 #define GEOS_ASSERT_OP_MSG( lhs, OP, rhs, ... ) \
847  { \
848  GEOS_ERROR_LHS_RHS_DECLS( lhs, rhs ); \
849  GEOS_ERROR_IF_CAUSE( !( lhsResult OP rhsResult ), \
850  "Expected: " #lhs " " #OP " " #rhs "\n* " #lhs " = " << lhsResult << "\n* " #rhs " = " << rhsResult << "\n", \
851  __VA_ARGS__ ); \
852  }
853 
854 #else
855 
856 #define GEOS_ASSERT_MSG( ... ) ((void) 0)
857 #define GEOS_ASSERT_OP_MSG( ... ) ((void) 0)
858 
859 #endif
860 
865 #define GEOS_ASSERT( COND ) GEOS_ASSERT_MSG( COND, "" )
866 
875 #define GEOS_ASSERT_EQ_MSG( lhs, rhs, ... ) GEOS_ASSERT_OP_MSG( lhs, ==, rhs, __VA_ARGS__ )
876 
882 #define GEOS_ASSERT_EQ( lhs, rhs ) GEOS_ASSERT_EQ_MSG( lhs, rhs, "" )
883 
892 #define GEOS_ASSERT_NE_MSG( lhs, rhs, ... ) GEOS_ASSERT_OP_MSG( lhs, !=, rhs, __VA_ARGS__ )
893 
899 #define GEOS_ASSERT_NE( lhs, rhs ) GEOS_ASSERT_NE_MSG( lhs, rhs, "" )
900 
909 #define GEOS_ASSERT_GT_MSG( lhs, rhs, ... ) GEOS_ASSERT_OP_MSG( lhs, >, rhs, __VA_ARGS__ )
910 
916 #define GEOS_ASSERT_GT( lhs, rhs ) GEOS_ASSERT_GT_MSG( lhs, rhs, "" )
917 
926 #define GEOS_ASSERT_GE_MSG( lhs, rhs, ... ) GEOS_ASSERT_OP_MSG( lhs, >=, rhs, __VA_ARGS__ )
927 
933 #define GEOS_ASSERT_GE( lhs, rhs ) GEOS_ASSERT_GE_MSG( lhs, rhs, "" )
934 
943 #define GEOS_ASSERT_LT_MSG( lhs, rhs, ... ) GEOS_ASSERT_OP_MSG( lhs, <, rhs, __VA_ARGS__ )
944 
950 #define GEOS_ASSERT_LT( lhs, rhs ) GEOS_ASSERT_LT_MSG( lhs, rhs, "" )
951 
960 #define GEOS_ASSERT_LE_MSG( lhs, rhs, ... ) GEOS_ASSERT_OP_MSG( lhs, <=, rhs, __VA_ARGS__ )
961 
967 #define GEOS_ASSERT_LE( lhs, rhs ) GEOS_ASSERT_LE_MSG( lhs, rhs, "" )
968 
969 namespace geos
970 {
971 
972 namespace logger
973 {
974 
975 namespace internal
976 {
977 
978 extern int g_rank;
979 
980 extern std::string g_rankString;
981 
982 extern std::ostream * g_rankStream;
983 
984 } // namespace internal
985 
986 #if defined(GEOS_USE_MPI)
992 void InitializeLogger( MPI_Comm comm, const std::string & rank_output_dir="" );
993 #endif
994 
999 void InitializeLogger( const std::string & rank_output_dir="" );
1000 
1005 
1006 } // namespace logger
1007 
1008 } // namespace geos
1009 
1010 #endif /* GEOS_COMMON_LOGGER_HPP */
void FinalizeLogger()
Finalize the logger and close the rank streams.
void InitializeLogger(const std::string &rank_output_dir="")
Initialize the logger in a serial build.
std::string string
String type.
Definition: DataTypes.hpp:90