libMesh
libmesh_base.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2017 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 
20 #ifndef LIBMESH_LIBMESH_BASE_H
21 #define LIBMESH_LIBMESH_BASE_H
22 
23 #include "libmesh/id_types.h"
24 
25 namespace libMesh {
26 
27 #ifndef LIBMESH_DISABLE_COMMWORLD
28 
32 
37 #endif
38 
43 
49 
53 unsigned int n_threads();
54 
62 namespace libMeshPrivateData {
63 #ifdef LIBMESH_HAVE_MPI
64 
68 
73 #endif
74 
78 extern int _n_threads;
79 }
80 }
81 
82 
83 
84 // ------------------------------------------------------------
85 // libMesh inline member functions
86 #ifndef LIBMESH_DISABLE_COMMWORLD
87 inline
89 {
91 }
92 
93 
94 
95 inline
97 {
99 }
100 #endif // LIBMESH_DISABLE_COMMWORLD
101 
102 
103 inline
105 {
106 #ifdef LIBMESH_HAVE_MPI
108 #else
109  return 1;
110 #endif
111 }
112 
113 inline
115 {
116 #ifdef LIBMESH_HAVE_MPI
118 #else
119  return 0;
120 #endif
121 }
122 
123 
124 inline
125 unsigned int libMesh::n_threads()
126 {
127  return static_cast<unsigned int>(libMeshPrivateData::_n_threads);
128 }
129 
130 
131 // We now put everything we can into a separate libMesh namespace;
132 // code which forward declares libMesh classes or which specializes
133 // libMesh templates may want to know whether it is compiling under
134 // such conditions, to be backward compatible with older libMesh
135 // versions:
136 #define LIBMESH_USE_SEPARATE_NAMESPACE 1
137 
138 
139 // Unless configured otherwise, we import all of namespace libMesh,
140 // for backwards compatibility with pre-namespaced codes.
141 
142 #ifndef LIBMESH_REQUIRE_SEPARATE_NAMESPACE
143 using namespace libMesh;
144 #endif
145 
146 
147 #endif // LIBMESH_LIBMESH_BASE_H
unsigned int n_threads()
Definition: libmesh_base.h:125
processor_id_type global_n_processors()
Definition: libmesh_base.h:104
processor_id_type _n_processors
Total number of processors used.
Definition: libmesh.C:251
uint8_t processor_id_type
Definition: id_types.h:99
The libMesh namespace provides an interface to certain functionality in the library.
int _n_threads
Total number of threads possible.
Definition: libmesh.C:254
processor_id_type _processor_id
The local processor id.
Definition: libmesh.C:252
processor_id_type global_processor_id()
Definition: libmesh_base.h:114
processor_id_type processor_id()
Definition: libmesh_base.h:96
processor_id_type n_processors()
Definition: libmesh_base.h:88