1 # ifndef _RHEO_DIS_MACRO_H
2 # define _RHEO_DIS_MACRO_H
24 #include "rheolef/diststream.h"
25 #include "rheolef/distributed.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 (mpi::environment::initialized() && !mpi::environment::finalized()) { \
36 std::cerr << "fatal{" << mpi::communicator().rank() << "}(" \
37 << __FILE__ << "," << __LINE__ << "): " \
38 << message << std::endl << std::flush; \
39 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 (mpi::environment::initialized() && !mpi::environment::finalized()) { \
56 std::cerr << "warning{"<< 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 (mpi::environment::initialized() && !mpi::environment::finalized()) { \
69 mpi::communicator().barrier(); \
70 derr << "warning(" << __FILE__ << "," << __LINE__ \
71 << "): " << message << std::endl << std::flush; \
72 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 (mpi::environment::initialized() && !mpi::environment::finalized()) { \
86 std::cerr << "trace{"<< 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 (mpi::environment::initialized() && !mpi::environment::finalized()) { \
98 mpi::communicator().barrier(); \
99 derr << "trace(" << __FILE__ << "," << __LINE__ \
100 << "): " << message << std::endl << std::flush; \
101 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.