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 
28 #ifdef LIBMESH_FORWARD_DECLARE_ENUMS
29 namespace libMesh
30 {
31 enum SolverPackage : int;
32 }
33 #else
34 #include "libmesh/enum_solver_package.h"
35 #endif
36 
37 // C++ includes
38 #include <string>
39 #include <vector>
40 
41 // For dealing with MPI stuff in VTK.
42 #if defined(LIBMESH_HAVE_MPI) && defined(LIBMESH_HAVE_VTK)
43 class vtkMPIController;
44 #endif
45 
55 namespace libMesh
56 {
57 
58 // Forward declarations
59 namespace Parallel {
60  class Communicator;
61 }
62 
84 {
85 public:
86 #ifdef LIBMESH_HAVE_MPI
87 
100  LibMeshInit(int argc, const char * const * argv,
101  MPI_Comm COMM_WORLD_IN=MPI_COMM_WORLD);
102 #else
103  LibMeshInit(int argc, const char * const * argv);
104 #endif
105 
114  virtual ~LibMeshInit();
115 
122  const Parallel::Communicator & comm() const { return *_comm; }
123 
124  Parallel::Communicator & comm() { return *_comm; }
125 
126 private:
127  Parallel::Communicator * _comm;
128 
129 #if defined(LIBMESH_HAVE_MPI) && defined(LIBMESH_HAVE_VTK)
130  // VTK object for dealing with MPI stuff in VTK.
131  // This can't be a std::unique_ptr because VTK makes the destructor
132  // protected and forces us to use a named destructor manually
133  vtkMPIController * _vtk_mpi_controller;
134 #endif
135 };
136 
143 bool initialized ();
144 
151 bool closed ();
152 
156 void enableFPE(bool on);
157 
161 void enableSEGV(bool on);
162 
176 bool on_command_line (std::string arg);
177 
186 template <typename T>
187 T command_line_value (const std::string &, T);
188 template <typename T>
189 T command_line_value (const std::vector<std::string> &, T);
190 
204 template <typename T>
205 T command_line_next (std::string name, T default_value);
206 
214 template <typename T>
215 void command_line_vector (const std::string &, std::vector<T> &);
216 
220 #ifdef LIBMESH_USE_COMPLEX_NUMBERS
221 extern const Number imaginary;
222 #endif
223 
233 
237 const Real pi =
238  static_cast<Real>(3.1415926535897932384626433832795029L);
239 
243 const Number zero = 0.;
244 
249 const unsigned int invalid_uint = static_cast<unsigned int>(-1);
250 
251 } // namespace libMesh
252 
253 #endif // LIBMESH_LIBMESH_H
libMesh::SolverPackage
SolverPackage
Defines an enum for various linear solver packages.
Definition: enum_solver_package.h:34
libMesh::Number
Real Number
Definition: libmesh_common.h:195
libMesh::pi
const Real pi
.
Definition: libmesh.h:237
libMesh::invalid_uint
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value.
Definition: libmesh.h:249
libMesh::command_line_next
T command_line_next(std::string name, T default_value)
Use GetPot's search()/next() functions to get following arguments from the command line.
Definition: libmesh.C:963
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::enableSEGV
void enableSEGV(bool on)
Toggle libMesh reporting of segmentation faults.
Definition: libmesh.C:868
libMesh::default_solver_package
SolverPackage default_solver_package()
Definition: libmesh.C:993
libMesh::LibMeshInit::comm
Parallel::Communicator & comm()
Definition: libmesh.h:124
libMesh::zero
const Number zero
.
Definition: libmesh.h:243
libMesh::imaginary
const Number imaginary
The imaginary unit, .
libMesh::command_line_value
T command_line_value(const std::string &, T)
Definition: libmesh.C:931
libMesh::LibMeshInit
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
Definition: libmesh.h:83
libMesh::enableFPE
void enableFPE(bool on)
Toggle hardware trap floating point exceptions.
Definition: libmesh.C:822
libMesh::initialized
bool initialized()
Checks that library initialization has been done.
Definition: libmesh.C:265
libMesh::command_line_vector
void command_line_vector(const std::string &, std::vector< T > &)
Definition: libmesh.C:976
libMesh::LibMeshInit::_comm
Parallel::Communicator * _comm
Definition: libmesh.h:127
libMesh::LibMeshInit::_vtk_mpi_controller
vtkMPIController * _vtk_mpi_controller
Definition: libmesh.h:133
libMesh::on_command_line
bool on_command_line(std::string arg)
Definition: libmesh.C:898
libMesh::LibMeshInit::~LibMeshInit
virtual ~LibMeshInit()
Destructor.
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::LibMeshInit::comm
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:122
libMesh::LibMeshInit::LibMeshInit
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.
int
void ErrorVector unsigned int
Definition: adjoints_ex3.C:360
libMesh::Quality::name
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
libMesh::closed
bool closed()
Checks that the library has been closed.
Definition: libmesh.C:272