libMesh Namespace Reference


Namespaces

namespace  libMeshPrivateData

Classes

class  LogicError
class  NotImplemented
class  FileError
class  ConvergenceFailure
class  DynamicCastFailure

Functions

void _init (int &argc, char **&argv) void _init(int &argc
void init (int &argc, char **&argv)
void init (int &argc, char **&argv, MPI_Comm COMM_WORLD_IN=MPI_COMM_WORLD)
bool initialized ()
int close ()
bool closed ()
bool on_command_line (const std::string &arg)
template<typename T >
command_line_value (const std::string &, T)
SolverPackage default_solver_package ()
unsigned int n_processors ()
unsigned int processor_id ()
unsigned int n_threads ()

Variables

void char **& argv
PerfLog perflog
const Number imaginary
const Real pi = 3.1415926535897932384626433832795029L
const Number zero = 0.
const unsigned int invalid_uint = static_cast<unsigned int>(-1)
MPI_Comm COMM_WORLD = MPI_COMM_NULL

Detailed Description

The libMesh namespace provides an interface to certain functionality in the library. It provides a uniform init() method that initializes any other dependent libraries (e.g. MPI or PETSC), and a close() method for closing those libraries. It also provides a centralized place for performance logging and other functionality.


Function Documentation

void libMesh::_init ( int &  argc,
char **&  argv 
)

Referenced by init(), and LibMeshInit::LibMeshInit().

int libMesh::close (  ) 

Stop using the mesh library. This will call PetscFinalize() if PETSC is available. This method should be called after all other library objects have gone out of scope, as it interrogates the ReferenceCounter object to look for memory leaks.

libMesh::init() and libMesh::close() are a deprecated method of library initialization. Create a LibMeshInit object to begin using the library; when the LibMeshInit object is destroyed the library will be closed.

Definition at line 368 of file libmesh.C.

00369 {
00370   libmesh_deprecated();  // Use LibMeshInit instead
00371   return libMesh::_close();
00372 }

bool libMesh::closed (  )  [inline]

Checks that the library has been closed. This should always return false when called from a library object. It is useful to libmesh_assert(!libMeshclosed()) in library object destructors.

Definition at line 231 of file libmesh.h.

References initialized().

Referenced by MeshBase::~MeshBase(), System::~System(), and UnstructuredMesh::~UnstructuredMesh().

00232 {
00233   return !libMesh::initialized();
00234 }

template<typename T >
T libMesh::command_line_value ( const std::string &  name,
value 
) [inline]

Returns:
the value associated with name on the command line if it is specified, otherwise return the default, provided value.

Definition at line 423 of file libmesh.C.

References EXTERN_C_FOR_PETSC_END::command_line.

00424 {
00425   // Make sure the command line parser is ready for use
00426   libmesh_assert (command_line.get() != NULL);
00427   
00428     // only if the variable exists in the file
00429     if (command_line->have_variable(name.c_str()))
00430       value = (*command_line)(name.c_str(), value);      
00431 
00432     return value;
00433 }

SolverPackage libMesh::default_solver_package (  ) 

Returns:
the default solver interface to use. The value depends on which solver packages were available when the library was configured. The command-line is also checked, allowing the user to override the compiled default. For example, --use-petsc will force the use of PETSc solvers, and --use-laspack will force the use of LASPACK solvers.

Definition at line 436 of file libmesh.C.

References libMesh::libMeshPrivateData::_solver_package, initialized(), INVALID_SOLVER_PACKAGE, LASPACK_SOLVERS, on_command_line(), libMeshEnums::PETSC_SOLVERS, and TRILINOS_SOLVERS.

00437 {
00438   libmesh_assert (libMesh::initialized());
00439   
00440   static bool called = false;
00441 
00442   // Check the command line.  Since the command line is
00443   // unchanging it is sufficient to do this only once.
00444   if (!called)
00445     {
00446       called = true;
00447 
00448 #ifdef LIBMESH_HAVE_PETSC
00449       if (libMesh::on_command_line ("--use-petsc"))
00450         libMeshPrivateData::_solver_package = PETSC_SOLVERS;
00451 #endif
00452 
00453 #ifdef LIBMESH_HAVE_TRILINOS
00454       if (libMesh::on_command_line ("--use-trilinos") ||
00455           libMesh::on_command_line ("--disable-petsc"))
00456         libMeshPrivateData::_solver_package = TRILINOS_SOLVERS;
00457 #endif
00458       
00459 #ifdef LIBMESH_HAVE_LASPACK
00460       if (libMesh::on_command_line ("--use-laspack"  ) ||
00461           libMesh::on_command_line ("--disable-petsc"))
00462         libMeshPrivateData::_solver_package = LASPACK_SOLVERS;
00463 #endif
00464 
00465       if (libMesh::on_command_line ("--disable-laspack") &&
00466           libMesh::on_command_line ("--disable-trilinos") &&
00467           libMesh::on_command_line ("--disable-petsc"))
00468         libMeshPrivateData::_solver_package = INVALID_SOLVER_PACKAGE;
00469     }
00470   
00471   
00472   return libMeshPrivateData::_solver_package;  
00473 }

void libMesh::init ( int &  argc,
char **&  argv,
MPI_Comm  COMM_WORLD_IN = MPI_COMM_WORLD 
)

Initialize the library for use. This will call PetscInitialize if PETSC is available. This method takes an optional parameter

You must perform an initialization before using any of the library functionality, but libMesh::init() is a deprecated way to do so. Create a LibMeshInit object instead.

Definition at line 357 of file libmesh.C.

References _init().

00359 {
00360   libmesh_deprecated();  // Use LibMeshInit instead
00361   libMesh::_init(argc, argv, COMM_WORLD_IN);
00362 }

void libMesh::init ( int &  argc,
char **&  argv 
)

Initialize the library for use. This will call PetscInitialize if PETSC is available.

You must perform an initialization before using any of the library functionality, but libMesh::init() is a deprecated way to do so. Create a LibMeshInit object instead.

Definition at line 351 of file libmesh.C.

References _init().

00352 {
00353   libmesh_deprecated();  // Use LibMeshInit instead
00354   libMesh::_init(argc, argv);
00355 }

bool libMesh::initialized (  )  [inline]

Checks that library initialization has been done. If it hasn't an error message is printed and the code aborts. It is useful to libmesh_assert(libMesh::initialized()) in library object constructors.

Definition at line 223 of file libmesh.h.

References libMesh::libMeshPrivateData::_is_initialized.

Referenced by closed(), default_solver_package(), MeshBase::MeshBase(), and UnstructuredMesh::UnstructuredMesh().

00224 {
00225   return libMeshPrivateData::_is_initialized;
00226 }

unsigned int libMesh::n_processors (  )  [inline]

Returns:
the number of processors used in the current simulation.

Definition at line 76 of file libmesh_base.h.

References libMesh::libMeshPrivateData::_n_processors.

Referenced by ParmetisPartitioner::_do_repartition(), DofMap::add_constraints_to_send_list(), DofMap::allgather_recursive_constraints(), MeshCommunication::assign_global_indices(), ParmetisPartitioner::assign_partitioning(), AztecLinearSolver< T >::AztecLinearSolver(), MeshCommunication::broadcast(), AztecLinearSolver< T >::clear(), PetscLinearSolver< T >::clear(), DofMap::distribute_dofs(), DofMap::distribute_local_dofs_node_major(), DofMap::distribute_local_dofs_var_major(), EnsightIO::EnsightIO(), MeshCommunication::find_global_indices(), PerfLog::get_info_header(), PetscMatrix< T >::init(), EquationSystems::init(), ParmetisPartitioner::initialize(), MeshTools::libmesh_assert_valid_node_procids(), MeshTools::libmesh_assert_valid_refinement_flags(), EpetraVector< T >::localize_to_one(), MeshBase::n_active_elem_on_proc(), MeshBase::n_elem_on_proc(), MeshBase::n_nodes_on_proc(), Partitioner::partition_unpartitioned_elements(), PetscLinearSolver< T >::PetscLinearSolver(), SparseMatrix< T >::print(), MeshTools::processor_bounding_box(), System::project_vector(), Nemesis_IO::read(), System::read_serialized_blocked_dof_objects(), System::read_serialized_vector(), ParallelMesh::renumber_dof_objects(), Partitioner::set_node_processor_ids(), DofMap::set_nonlocal_dof_objects(), Parallel::sync_dofobject_data_by_id(), Parallel::sync_dofobject_data_by_xyz(), Parallel::sync_element_data_by_parent_id(), XdrIO::write_serialized_bcs(), System::write_serialized_blocked_dof_objects(), XdrIO::write_serialized_connectivity(), and XdrIO::write_serialized_nodes().

00077 {
00078 #ifdef LIBMESH_HAVE_MPI
00079   return static_cast<unsigned int>(libMeshPrivateData::_n_processors);
00080 #else
00081   return 1;
00082 #endif
00083 }

unsigned int libMesh::n_threads (  )  [inline]

Returns:
the maximum number of threads used in the simulation.

Definition at line 101 of file libmesh_base.h.

References libMesh::libMeshPrivateData::_n_threads.

Referenced by Threads::parallel_for(), and Threads::parallel_reduce().

00102 {
00103   return static_cast<unsigned int>(libMeshPrivateData::_n_threads);
00104 }

bool libMesh::on_command_line ( const std::string &  arg  ) 

Returns:
true if the argument arg was specified on the command line, false otherwise.

Definition at line 412 of file libmesh.C.

References EXTERN_C_FOR_PETSC_END::command_line.

Referenced by default_solver_package(), DofMap::distribute_dofs(), LibMeshInit::LibMeshInit(), System::read_header(), and DofMap::use_coupled_neighbor_dofs().

00413 {
00414   // Make sure the command line parser is ready for use
00415   libmesh_assert (command_line.get() != NULL);
00416   
00417   return command_line->search (arg);
00418 }

unsigned int libMesh::processor_id (  )  [inline]

Returns:
the index of the local processor.

Definition at line 88 of file libmesh_base.h.

References libMesh::libMeshPrivateData::_processor_id.

Referenced by EquationSystems::_read_impl(), Predicates::ActiveLocal< T >::ActiveLocal(), Predicates::ActiveLocalSubdomain< T >::ActiveLocalSubdomain(), Predicates::ActiveNotLocal< T >::ActiveNotLocal(), ParallelMesh::add_elem(), Patch::add_local_face_neighbors(), Patch::add_local_point_neighbors(), DofMap::add_neighbors_to_send_list(), ParallelMesh::add_node(), DofMap::allgather_recursive_constraints(), MeshCommunication::assign_global_indices(), ParmetisPartitioner::assign_partitioning(), Patch::build_around_element(), ParmetisPartitioner::build_graph(), InfElemBuilder::build_inf_elem(), VTKIO::cells_to_vtk(), DofMap::distribute_dofs(), DofMap::distribute_local_dofs_node_major(), DofMap::distribute_local_dofs_var_major(), EnsightIO::EnsightIO(), MeshCommunication::find_global_indices(), MeshRefinement::flag_elements_by_elem_fraction(), MeshRefinement::flag_elements_by_mean_stddev(), MeshRefinement::flag_elements_by_nelem_target(), Nemesis_IO_Helper::get_cmap_params(), Nemesis_IO_Helper::get_eb_info_global(), Nemesis_IO_Helper::get_elem_cmap(), Nemesis_IO_Helper::get_elem_map(), PerfLog::get_info_header(), Nemesis_IO_Helper::get_init_global(), Nemesis_IO_Helper::get_init_info(), Nemesis_IO_Helper::get_loadbal_param(), Nemesis_IO_Helper::get_node_cmap(), Nemesis_IO_Helper::get_node_map(), Nemesis_IO_Helper::get_ns_param_global(), Nemesis_IO_Helper::get_ss_param_global(), ParmetisPartitioner::initialize(), ParallelMesh::libmesh_assert_valid_parallel_object_ids(), LibMeshInit::LibMeshInit(), Predicates::Local< T >::Local(), local_file_name(), Predicates::LocalLevel< T >::LocalLevel(), Predicates::LocalNotLevel< T >::LocalNotLevel(), MeshRefinement::make_coarsening_compatible(), MeshInput< MT >::MeshInput(), MeshOutput< MT >::MeshOutput(), MeshBase::n_active_local_elem(), BoundaryInfo::n_boundary_conds(), System::n_local_dofs(), DofMap::n_local_dofs(), MeshBase::n_local_elem(), MeshBase::n_local_nodes(), VTKIO::nodes_to_vtk(), Predicates::NotLocal< T >::NotLocal(), StatisticsVector< T >::plot_histogram(), SparseMatrix< T >::print(), NumericVector< T >::print_global(), System::project_vector(), XdrIO::read(), VTKIO::read(), UnstructuredMesh::read(), TetGenIO::read(), Nemesis_IO::read(), LegacyXdrIO::read(), GMVIO::read(), ExodusII_IO_Helper::read_elem_num_map(), System::read_header(), UCDIO::read_implementation(), System::read_legacy_data(), LegacyXdrIO::read_mesh(), GmshIO::read_mesh(), ExodusII_IO_Helper::read_node_num_map(), XdrIO::read_serialized_bcs(), System::read_serialized_blocked_dof_objects(), XdrIO::read_serialized_connectivity(), System::read_serialized_data(), XdrIO::read_serialized_nodes(), System::read_serialized_vector(), OFFIO::read_stream(), MatlabIO::read_stream(), ParallelMesh::renumber_dof_objects(), Partitioner::set_node_processor_ids(), DofMap::set_nonlocal_dof_objects(), VTKIO::solution_to_vtk(), Parallel::sync_dofobject_data_by_id(), Parallel::sync_dofobject_data_by_xyz(), Parallel::sync_element_data_by_parent_id(), VTKIO::system_vectors_to_vtk(), MeshTools::total_weight(), unzip_file(), EpetraMatrix< T >::update_sparsity_pattern(), XdrIO::write(), VTKIO::write(), UnstructuredMesh::write(), TecplotIO::write(), PostscriptIO::write(), MEDITIO::write(), GnuPlotIO::write(), GMVIO::write(), GmshIO::write(), FroIO::write(), EquationSystems::write(), TecplotIO::write_ascii(), GMVIO::write_ascii_old_impl(), TecplotIO::write_binary(), VTKIO::write_equation_systems(), LegacyXdrIO::write_mesh(), TecplotIO::write_nodal_data(), MEDITIO::write_nodal_data(), GnuPlotIO::write_nodal_data(), GMVIO::write_nodal_data(), GmshIO::write_nodal_data(), GmshIO::write_post(), XdrIO::write_serialized_bcs(), System::write_serialized_blocked_dof_objects(), XdrIO::write_serialized_connectivity(), System::write_serialized_data(), XdrIO::write_serialized_nodes(), System::write_serialized_vector(), GnuPlotIO::write_solution(), zip_file(), and ExodusII_IO::~ExodusII_IO().

00089 {
00090 #ifdef LIBMESH_HAVE_MPI
00091   return static_cast<unsigned int>(libMeshPrivateData::_processor_id);
00092 #else
00093   return 0;
00094 #endif
00095 }


Variable Documentation

void char** & libMesh::argv

Definition at line 127 of file libmesh.C.

MPI_Comm libMesh::COMM_WORLD = MPI_COMM_NULL

MPI Communicator to be used in the library.

Definition at line 75 of file libmesh.C.

Referenced by ParmetisPartitioner::_do_repartition(), PetscVector< T >::_get_array(), PetscMatrix< T >::_get_submatrix(), SlepcEigenSolver< T >::_petsc_shell_matrix_get_diagonal(), PetscLinearSolver< T >::_petsc_shell_matrix_get_diagonal(), SlepcEigenSolver< T >::_petsc_shell_matrix_mult(), PetscLinearSolver< T >::_petsc_shell_matrix_mult(), PetscVector< T >::_restore_array(), SlepcEigenSolver< T >::_solve_generalized_helper(), SlepcEigenSolver< T >::_solve_standard_helper(), PetscVector< T >::abs(), PetscVector< T >::add(), PetscMatrix< T >::add(), PetscMatrix< T >::add_matrix(), PetscVector< T >::add_vector(), MeshCommunication::assign_global_indices(), SlepcEigenSolver< T >::attach_deflation_space(), Parallel::Sort< KeyType >::binsort(), SlepcEigenSolver< T >::clear(), PetscVector< T >::clear(), PetscNonlinearSolver< T >::clear(), PetscMatrix< T >::clear(), PetscLinearSolver< T >::clear(), PetscDiffSolver::clear(), PetscVector< T >::close(), PetscMatrix< T >::close(), PetscMatrix< T >::closed(), Parallel::Sort< KeyType >::communicate_bins(), PetscVector< T >::create_subvector(), PetscVector< T >::dot(), MeshCommunication::find_global_indices(), PetscVector< T >::first_local_index(), PetscMatrix< T >::get_diagonal(), SlepcEigenSolver< T >::get_eigenpair(), PetscLinearSolver< T >::get_initial_residual(), SlepcEigenSolver< T >::get_relative_error(), PetscLinearSolver< T >::get_residual_history(), PetscMatrix< T >::get_transpose(), EpetraVector< T >::init(), EpetraMatrix< T >::init(), SlepcEigenSolver< T >::init(), PetscVector< T >::init(), PetscPreconditioner< T >::init(), PetscNonlinearSolver< T >::init(), PetscMatrix< T >::init(), PetscLinearSolver< T >::init(), PetscDiffSolver::init(), DistributedVector< T >::init(), PetscVector< T >::l1_norm(), PetscMatrix< T >::l1_norm(), PetscVector< T >::l2_norm(), PetscVector< T >::last_local_index(), PetscVector< T >::linfty_norm(), PetscMatrix< T >::linfty_norm(), PetscVector< T >::local_size(), PetscVector< T >::localize(), PetscVector< T >::localize_to_one(), PetscVector< T >::map_global_to_local_index(), PetscVector< T >::max(), PetscVector< T >::min(), PetscMatrix< T >::operator()(), PetscVector< T >::operator=(), PetscVector< T >::PetscVector(), PetscVector< T >::pointwise_mult(), PetscVector< T >::print_matlab(), PetscMatrix< T >::print_matlab(), PetscMatrix< T >::print_personal(), PetscMatrix< T >::row_start(), PetscMatrix< T >::row_stop(), PetscVector< T >::scale(), PetscVector< T >::set(), PetscMatrix< T >::set(), PetscPreconditioner< T >::set_petsc_preconditioner_type(), PetscLinearSolver< T >::set_petsc_solver_type(), SlepcEigenSolver< T >::set_slepc_position_of_spectrum(), SlepcEigenSolver< T >::set_slepc_problem_type(), SlepcEigenSolver< T >::set_slepc_solver_type(), PetscVector< T >::size(), PetscNonlinearSolver< T >::solve(), PetscLinearSolver< T >::solve(), PetscDiffSolver::solve(), SlepcEigenSolver< T >::solve_generalized(), SlepcEigenSolver< T >::solve_standard(), PetscVector< T >::sum(), EpetraMatrix< T >::update_sparsity_pattern(), PetscVector< T >::zero(), PetscMatrix< T >::zero(), and PetscMatrix< T >::zero_rows().

The imaginary unit, $ \sqrt{-1} $.

const unsigned int libMesh::invalid_uint = static_cast<unsigned int>(-1)

A number which is used quite often to represent an invalid or uninitialized value.

Definition at line 96 of file libmesh.C.

Referenced by SFCPartitioner::_do_partition(), InfFE< Dim, T_radial, T_map >::compute_node_indices_fast(), FEBase::compute_periodic_constraints(), InfFE< Dim, T_radial, T_map >::compute_shape_indices(), UnstructuredMesh::create_submesh(), Xdr::data_stream(), DofMap::dof_indices(), FEMContext::elem_position_get(), FEMContext::elem_position_set(), FEMContext::elem_reinit(), FEMContext::elem_side_reinit(), FEMSystem::eulerian_residual(), TreeNode< N >::find_element_in_children(), MeshRefinement::flag_elements_by_elem_fraction(), MeshRefinement::flag_elements_by_error_fraction(), MeshRefinement::flag_elements_by_mean_stddev(), DofObject::has_dofs(), MeshTools::Generation::Private::idx(), Elem::is_ancestor_of(), ParallelMesh::libmesh_assert_valid_parallel_flags(), FEMSystem::mesh_position_get(), FEMSystem::mesh_x_position(), FEMSystem::mesh_y_position(), FEMSystem::mesh_z_position(), DofObject::n_dofs(), Quad9::n_second_order_adjacent_vertices(), InfHex18::n_second_order_adjacent_vertices(), Hex27::n_second_order_adjacent_vertices(), FEMSystem::numerical_jacobian(), DofMap::old_dof_indices(), XdrIO::pack_element(), MeshDataUnvHeader::read(), System::read_serialized_blocked_dof_objects(), XdrIO::read_serialized_connectivity(), FEMContext::reinit(), Tet4::reselect_diagonal(), Prism18::second_order_adjacent_vertex(), FE< Dim, T >::shape_second_deriv(), BoundaryInfo::side_with_boundary_id(), Elem::which_neighbor_am_i(), and System::write_serialized_blocked_dof_objects().

A PerfLog object to log performance. If the library is configured with --enable-perflog then it will log key functions.

Referenced by Threads::parallel_for(), and Threads::parallel_reduce().


Site Created By: libMesh Developers
Last modified: November 25 2009 03:45:15.

Hosted By:
SourceForge.net Logo