parallel_only.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2018 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 #ifndef LIBMESH_PARALLEL_ONLY_H
20 #define LIBMESH_PARALLEL_ONLY_H
21 
22 // Macro to identify and debug functions which should only be called in
23 // parallel on every processor at once
24 
25 #ifdef LIBMESH_ENABLE_DEPRECATED
26 #undef parallel_only
27 #ifndef NDEBUG
28 #define parallel_only() do { \
29  libmesh_deprecated(); \
30  libmesh_assert(CommWorld.verify(std::string(__FILE__).size())); \
31  libmesh_assert(CommWorld.verify(std::string(__FILE__))); \
32  libmesh_assert(CommWorld.verify(__LINE__)); } while (0)
33 #else
34 #define parallel_only() ((void) 0)
35 #endif
36 #endif
37 
38 #undef libmesh_parallel_only
39 #ifndef NDEBUG
40 #define libmesh_parallel_only(comm_obj) do { \
41  libmesh_assert((comm_obj).verify(std::string(__FILE__).size())); \
42  libmesh_assert((comm_obj).verify(std::string(__FILE__))); \
43  libmesh_assert((comm_obj).verify(__LINE__)); } while (0)
44 #else
45 #define libmesh_parallel_only(comm_obj) ((void) 0)
46 #endif
47 
48 // Macro to identify and debug functions which should only be called in
49 // parallel on every processor at once
50 
51 #ifdef LIBMESH_ENABLE_DEPRECATED
52 #undef parallel_only_on
53 #ifndef NDEBUG
54 #define parallel_only_on(comm_arg) do { \
55  libmesh_deprecated(); \
56  libmesh_assert(CommWorld.verify(std::string(__FILE__).size(), comm_arg)); \
57  libmesh_assert(CommWorld.verify(std::string(__FILE__), comm_arg)); \
58  libmesh_assert(CommWorld.verify(__LINE__), comm_arg); } while (0)
59 #else
60 #define parallel_only_on(comm_arg) ((void) 0)
61 #endif
62 #endif
63 
64 #undef libmesh_parallel_only_on
65 #ifndef NDEBUG
66 #define libmesh_parallel_only_on(comm_obj,comm_arg) do { \
67  libmesh_assert(comm_obj.verify(std::string(__FILE__).size(), comm_arg)); \
68  libmesh_assert(comm_obj.verify(std::string(__FILE__), comm_arg)); \
69  libmesh_assert(comm_obj.verify(__LINE__), comm_arg); } while (0)
70 #else
71 #define libmesh_parallel_only_on(comm_obj,comm_arg) ((void) 0)
72 #endif
73 
74 #endif // LIBMESH_PARALLEL_ONLY_H