libmesh.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 
20 #ifndef LIBMESH_LIBMESH_H
21 #define LIBMESH_LIBMESH_H
22 
23 
24 // Local includes
25 #include "libmesh/libmesh_common.h"
26 #include "libmesh/libmesh_base.h"
27 #include "libmesh/parallel.h"
28 
29 #ifdef LIBMESH_FORWARD_DECLARE_ENUMS
30 namespace libMesh
31 {
32 enum SolverPackage : int;
33 }
34 #else
36 #endif
37 
38 // C++ includes
39 #include <string>
40 #include <vector>
41 
42 // For dealing with MPI stuff in VTK.
43 #if defined(LIBMESH_HAVE_MPI) && defined(LIBMESH_HAVE_VTK)
44 class vtkMPIController;
45 #endif
46 
56 namespace libMesh
57 {
58 
80 {
81 public:
82 #ifdef LIBMESH_HAVE_MPI
83 
96  LibMeshInit(int argc, const char * const * argv,
97  MPI_Comm COMM_WORLD_IN=MPI_COMM_WORLD);
98 #else
99  LibMeshInit(int argc, const char * const * argv);
100 #endif
101 
110  virtual ~LibMeshInit();
111 
118  const Parallel::Communicator & comm() const { return _comm; }
119 
121 
122 private:
124 
125 #if defined(LIBMESH_HAVE_MPI) && defined(LIBMESH_HAVE_VTK)
126  // VTK object for dealing with MPI stuff in VTK.
127  // This can't be a std::unique_ptr because VTK makes the destructor
128  // protected and forces us to use a named destructor manually
129  vtkMPIController * _vtk_mpi_controller;
130 #endif
131 };
132 
139 bool initialized ();
140 
147 bool closed ();
148 
152 void enableFPE(bool on);
153 
157 void enableSEGV(bool on);
158 
172 bool on_command_line (std::string arg);
173 
182 template <typename T>
183 T command_line_value (const std::string &, T);
184 template <typename T>
185 T command_line_value (const std::vector<std::string> &, T);
186 
200 template <typename T>
201 T command_line_next (std::string name, T default_value);
202 
210 template <typename T>
211 void command_line_vector (const std::string &, std::vector<T> &);
212 
216 #ifdef LIBMESH_USE_COMPLEX_NUMBERS
217 extern const Number imaginary;
218 #endif
219 
229 
233 const Real pi =
234  static_cast<Real>(3.1415926535897932384626433832795029L);
235 
239 const Number zero = 0.;
240 
245 const unsigned int invalid_uint = static_cast<unsigned int>(-1);
246 
247 } // namespace libMesh
248 
249 #endif // LIBMESH_LIBMESH_H
std::string name(const ElemQuality q)
Definition: elem_quality.C:42
bool closed()
Definition: libmesh.C:265
const unsigned int invalid_uint
Definition: libmesh.h:245
void enableSEGV(bool on)
Definition: libmesh.C:846
Parallel::Communicator _comm
Definition: libmesh.h:123
const Number zero
Definition: libmesh.h:239
vtkMPIController * _vtk_mpi_controller
Definition: libmesh.h:129
const Number imaginary
const Parallel::Communicator & comm() const
Definition: libmesh.h:118
SolverPackage default_solver_package()
Definition: libmesh.C:971
LibMeshInit(int argc, const char *const *argv, MPI_Comm COMM_WORLD_IN=MPI_COMM_WORLD)
T command_line_next(std::string name, T value)
Definition: libmesh.C:941
void enableFPE(bool on)
Definition: libmesh.C:800
void command_line_vector(const std::string &name, std::vector< T > &vec)
Definition: libmesh.C:954
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Parallel::Communicator & comm()
Definition: libmesh.h:120
bool initialized()
Definition: libmesh.C:258
bool on_command_line(std::string arg)
Definition: libmesh.C:876
T command_line_value(const std::string &name, T value)
Definition: libmesh.C:909
const Real pi
Definition: libmesh.h:233