libmesh_base.h
Go to the documentation of this file.00001 // The libMesh Finite Element Library. 00002 // Copyright (C) 2002-2012 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner 00003 00004 // This library is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public 00006 // License as published by the Free Software Foundation; either 00007 // version 2.1 of the License, or (at your option) any later version. 00008 00009 // This library is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 // Lesser General Public License for more details. 00013 00014 // You should have received a copy of the GNU Lesser General Public 00015 // License along with this library; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 00019 00020 #ifndef LIBMESH_LIBMESH_BASE_H 00021 #define LIBMESH_LIBMESH_BASE_H 00022 00023 #include "libmesh/id_types.h" 00024 00025 namespace libMesh { 00026 00030 processor_id_type n_processors(); 00031 00035 processor_id_type processor_id(); 00036 00040 unsigned int n_threads(); 00041 00049 namespace libMeshPrivateData { 00050 #ifdef LIBMESH_HAVE_MPI 00051 00054 extern processor_id_type _n_processors; 00055 00059 extern processor_id_type _processor_id; 00060 #endif 00061 00065 extern int _n_threads; 00066 } 00067 } 00068 00069 00070 00071 // ------------------------------------------------------------ 00072 // libMesh inline member functions 00073 inline 00074 libMesh::processor_id_type libMesh::n_processors() 00075 { 00076 #ifdef LIBMESH_HAVE_MPI 00077 return libMeshPrivateData::_n_processors; 00078 #else 00079 return 1; 00080 #endif 00081 } 00082 00083 00084 00085 inline 00086 libMesh::processor_id_type libMesh::processor_id() 00087 { 00088 #ifdef LIBMESH_HAVE_MPI 00089 return libMeshPrivateData::_processor_id; 00090 #else 00091 return 0; 00092 #endif 00093 } 00094 00095 00096 00097 00098 inline 00099 unsigned int libMesh::n_threads() 00100 { 00101 return static_cast<unsigned int>(libMeshPrivateData::_n_threads); 00102 } 00103 00104 00105 // We now put everything we can into a separate libMesh namespace; 00106 // code which forward declares libMesh classes or which specializes 00107 // libMesh templates may want to know whether it is compiling under 00108 // such conditions, to be backward compatible with older libMesh 00109 // versions: 00110 #define LIBMESH_USE_SEPARATE_NAMESPACE 1 00111 00112 00113 // Unless configured otherwise, we import all of namespace libMesh, 00114 // for backwards compatibility with pre-namespaced codes. 00115 00116 #ifndef LIBMESH_REQUIRE_SEPARATE_NAMESPACE 00117 using namespace libMesh; 00118 #endif 00119 00120 00121 #endif // LIBMESH_LIBMESH_BASE_H
Site Created By: libMesh Developers
Last modified: February 05 2013 19:54:47 UTC
Hosted By: