libMesh
libmesh.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2019 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
35 #include "libmesh/enum_solver_package.h"
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)
T command_line_next(std::string name, T default_value)
Use GetPot&#39;s search()/next() functions to get following arguments from the command line...
bool closed()
Checks that the library has been closed.
Encapsulates the MPI_Comm object.
Definition: communicator.h:92
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value.
Definition: libmesh.h:245
void enableSEGV(bool on)
Toggle libMesh reporting of segmentation faults.
Parallel::Communicator _comm
Definition: libmesh.h:123
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
Definition: libmesh.h:79
The libMesh namespace provides an interface to certain functionality in the library.
const Number zero
.
Definition: libmesh.h:239
vtkMPIController * _vtk_mpi_controller
Definition: libmesh.h:129
const Number imaginary
The imaginary unit, .
const Parallel::Communicator & comm() const
Returns the Communicator created by this libMesh object, which will be a compatibility shim if MPI is...
Definition: libmesh.h:118
SolverPackage default_solver_package()
LibMeshInit(int argc, const char *const *argv, MPI_Comm COMM_WORLD_IN=MPI_COMM_WORLD)
Initialize the library for use, with the command line options provided.
virtual ~LibMeshInit()
Destructor.
T command_line_value(const std::string &, T)
void enableFPE(bool on)
Toggle hardware trap floating point exceptions.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void command_line_vector(const std::string &, std::vector< T > &)
Parallel::Communicator & comm()
Definition: libmesh.h:120
bool initialized()
Checks that library initialization has been done.
bool on_command_line(std::string arg)
SolverPackage
Defines an enum for various linear solver packages.
const Real pi
.
Definition: libmesh.h:233