libMesh
libmesh.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_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/enum_solver_package.h"
28 #include "libmesh/parallel.h"
29 
30 // C++ includes
31 #include <string>
32 #include <vector>
33 
34 // For dealing with MPI stuff in VTK.
35 #if defined(LIBMESH_HAVE_MPI) && defined(LIBMESH_HAVE_VTK)
36 class vtkMPIController;
37 #endif
38 
47 namespace libMesh
48 {
49 
50 
63 {
64 public:
65 #ifdef LIBMESH_HAVE_MPI
66 
73  LibMeshInit(int argc, const char * const * argv,
74  MPI_Comm COMM_WORLD_IN=MPI_COMM_WORLD);
75 #else
76  LibMeshInit(int argc, const char * const * argv);
77 #endif
78 
79  virtual ~LibMeshInit();
80 
81  const Parallel::Communicator & comm() const { return _comm; }
82 
84 
85 private:
87 
88 #if defined(LIBMESH_HAVE_MPI) && defined(LIBMESH_HAVE_VTK)
89  // VTK object for dealing with MPI stuff in VTK.
90  // This can't be a UniquePtr because VTK makes the destructor
91  // protected and forces us to use a named destructor manually
92  vtkMPIController * _vtk_mpi_controller;
93 #endif
94 };
95 
102 bool initialized ();
103 
110 bool closed ();
111 
115 void enableFPE(bool on);
116 
120 void enableSEGV(bool on);
121 
126 bool on_command_line (const std::string & arg);
127 
133 template <typename T>
134 T command_line_value (const std::string &, T);
135 template <typename T>
136 T command_line_value (const std::vector<std::string> &, T);
137 
142 template <typename T>
143 T command_line_next (const std::string &, T);
144 
149 template <typename T>
150 void command_line_vector (const std::string &, std::vector<T> &);
151 
155 #ifdef LIBMESH_USE_COMPLEX_NUMBERS
156 extern const Number imaginary;
157 #endif
158 
168 
172 const Real pi =
173  static_cast<Real>(3.1415926535897932384626433832795029L);
174 
178 const Number zero = 0.;
179 
184 const unsigned int invalid_uint = static_cast<unsigned int>(-1);
185 
186 } // namespace libMesh
187 
188 #endif // LIBMESH_LIBMESH_H
bool closed()
Checks that the library has been closed.
Definition: libmesh.C:281
Encapsulates the MPI_Comm object.
Definition: parallel.h:657
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value.
Definition: libmesh.h:184
void enableSEGV(bool on)
Toggle libMesh reporting of segmentation faults.
Definition: libmesh.C:891
SolverPackage
Defines an enum for various linear solver packages.
T command_line_next(const std::string &, T)
Use GetPot&#39;s search()/next() functions to get following arguments from the command line...
Definition: libmesh.C:964
Parallel::Communicator _comm
Definition: libmesh.h:86
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
Definition: libmesh.h:62
The libMesh namespace provides an interface to certain functionality in the library.
const Number zero
.
Definition: libmesh.h:178
vtkMPIController * _vtk_mpi_controller
Definition: libmesh.h:92
const Number imaginary
The imaginary unit, .
SolverPackage default_solver_package()
Definition: libmesh.C:995
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.
T command_line_value(const std::string &, T)
Definition: libmesh.C:932
const Parallel::Communicator & comm() const
Definition: libmesh.h:81
void enableFPE(bool on)
Toggle hardware trap floating point exceptions.
Definition: libmesh.C:845
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void command_line_vector(const std::string &, std::vector< T > &)
Definition: libmesh.C:978
bool on_command_line(const std::string &arg)
Definition: libmesh.C:921
Parallel::Communicator & comm()
Definition: libmesh.h:83
bool initialized()
Checks that library initialization has been done.
Definition: libmesh.C:274
const Real pi
.
Definition: libmesh.h:172