libMesh
|
The LibMeshInit
class, when constructed, initializes the dependent libraries (e.g.
More...
#include <libmesh.h>
Public Member Functions | |
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. More... | |
LibMeshInit (int argc, const char *const *argv) | |
virtual | ~LibMeshInit () |
Destructor. More... | |
const Parallel::Communicator & | comm () const |
Returns the Communicator created by this libMesh object, which will be a compatibility shim if MPI is not enabled, or a wrapper for the user-input MPI_Comm if we were constructed with one, or a wrapper for MPI_COMM_WORLD by default. More... | |
Parallel::Communicator & | comm () |
Private Attributes | |
Parallel::Communicator * | _comm |
vtkMPIController * | _vtk_mpi_controller |
The LibMeshInit
class, when constructed, initializes the dependent libraries (e.g.
MPI or PETSC) and does the command line parsing needed by libMesh. The LibMeshInit destructor closes those libraries properly.
For most users, a single LibMeshInit object should be created at the start of your main() function.
All libMesh functionality should be used only when a LibMeshInit object exists. Dependent library functionality, likewise, except in codes which manually initialize those libraries before LibMeshInit creation and finalize them after LibMeshInit destruction.
Since "it is best not to perform much more than a return rc after calling MPI_Finalize", applications which want to do anything after LibMeshInit destruction should manage MPI initialization and finalization manually.
libMesh::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.
This will e.g. call MPI_Init if MPI is available and enabled and has not already been initialized; similar initialization may take place for Petsc, Slepc, multithreading support, libMesh Singleton objects, the libMesh::out/err IO streams, and any libMesh handlers for floating-point exceptions, signals, and/or C++ aborts.
You must create a LibMeshInit object before using any of the library functionality. This method may take an optional parameter to use a user-specified MPI communicator.
libMesh::LibMeshInit::LibMeshInit | ( | int | argc, |
const char *const * | argv | ||
) |
Definition at line 336 of file libmesh.C.
References libMesh::libMeshPrivateData::_is_initialized, libMesh::libMeshPrivateData::_n_processors, libMesh::libMeshPrivateData::_n_threads, libMesh::libMeshPrivateData::_processor_id, libMesh::closed(), libMesh::command_line_value(), libMesh::PerfLog::disable_logging(), libMesh::ReferenceCounter::disable_print_counter_info(), DMCreate_libMesh(), libMesh::enableFPE(), libMesh::enableSEGV(), libMesh::err, libMesh::GLOBAL_COMM_WORLD, libMesh::global_processor_id(), libMesh::ierr, libMesh::initialized(), libMesh::libmesh_assert(), libMesh::libmesh_errhandler, libMesh_MPI_Handler(), libMesh::libmesh_terminate_handler(), libMesh::n_threads(), libMesh::old_terminate_handler, libMesh::on_command_line(), libMesh::out, libMesh::perflog, libMesh::BasicOStreamProxy< charT, traits >::rdbuf(), libMesh::remote_elem, and libMesh::Singleton::setup().
|
virtual |
Destructor.
Cleans up libMesh Singleton objects, and thread manager if threading is in use. Prints reference count and performance logging information if enabled. Restores pre-LibMeshInit terminate handler and floating-point-exception handling. Finalizes any of Slepc, Petsc, and MPI which were initialized by LibMeshInit.
|
inline |
|
inline |
|
private |
|
private |