1# ifndef _RHEO_DIS_MACRO_H
2# define _RHEO_DIS_MACRO_H
24#include "rheolef/diststream.h"
25#include "rheolef/communicator.h"
28# ifndef _RHEOLEF_HAVE_MPI
29# define dis_warning_macro(message) warning_macro(message)
30# define dis_trace_macro(message) trace_macro(message)
33# define fatal_macro(message) \
35 if (boost::mpi::environment::initialized() && !boost::mpi::environment::finalized()) { \
36 std::cerr << "fatal{" << boost::mpi::communicator().rank() << "}(" \
37 << __FILE__ << "," << __LINE__ << "): " \
38 << message << std::endl << std::flush; \
39 boost::mpi::environment::abort (1); \
41 std::cerr << "fatal(" \
42 << __FILE__ << "," << __LINE__ << "): " \
43 << message << std::endl << std::flush; \
49# define error_macro(message) \
53# define warning_macro(message) \
55 if (boost::mpi::environment::initialized() && !boost::mpi::environment::finalized()) { \
56 std::cerr << "warning{"<< boost::mpi::communicator().rank() << "}(" \
57 << __FILE__ << "," << __LINE__ << "): " \
58 << message << std::endl << std::flush; \
60 std::cerr << "warning(" \
61 << __FILE__ << "," << __LINE__ << "): " \
62 << message << std::endl << std::flush; \
66# define dis_warning_macro(message) \
68 if (boost::mpi::environment::initialized() && !boost::mpi::environment::finalized()) { \
69 boost::mpi::communicator().barrier(); \
70 derr << "warning(" << __FILE__ << "," << __LINE__ \
71 << "): " << message << std::endl << std::flush; \
72 boost::mpi::communicator().barrier(); \
74 std::cerr << "warning(" \
75 << __FILE__ << "," << __LINE__ << "): " \
76 << message << std::endl << std::flush; \
82# ifdef _RHEOLEF_PARANO
83# define trace_macro(message) \
85 if (boost::mpi::environment::initialized() && !boost::mpi::environment::finalized()) { \
86 std::cerr << "trace{"<< boost::mpi::communicator().rank() << "}(" \
87 << __FILE__ << "," << __LINE__ << "): " \
88 << message << std::endl << std::flush; \
90 std::cerr << "trace(" \
91 << __FILE__ << "," << __LINE__ << "): " \
92 << message << std::endl << std::flush; \
95# define dis_trace_macro(message) \
97 if (boost::mpi::environment::initialized() && !boost::mpi::environment::finalized()) { \
98 boost::mpi::communicator().barrier(); \
99 derr << "trace(" << __FILE__ << "," << __LINE__ \
100 << "): " << message << std::endl << std::flush; \
101 boost::mpi::communicator().barrier(); \
103 std::cerr << "trace(" \
104 << __FILE__ << "," << __LINE__ << "): " \
105 << message << std::endl << std::flush; \
108# define assert_macro(ok_condition, message) \
109 { if (!(ok_condition)) fatal_macro(message); }
111# define trace_macro(message)
112# define dis_trace_macro(message)
113# define assert_macro(ok_condition, message)
This file is part of Rheolef.