Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Static Public Member Functions | Static Private Member Functions | Static Private Attributes | List of all members
Teuchos::DefaultComm< OrdinalType > Class Template Reference

Return a default global communicator appropriate for the build. More...

#include <Teuchos_DefaultComm.hpp>

Static Public Member Functions

static Teuchos::RCP< const
Comm< OrdinalType > > 
getComm ()
 Return the default global communicator. More...
 
static Teuchos::RCP< const
Comm< OrdinalType > > 
getDefaultSerialComm (const Teuchos::RCP< const Comm< OrdinalType > > &comm)
 Return a serial Comm if the input Comm is null. More...
 

Static Private Member Functions

static void freeDefaultComm ()
 Free the default Comm object. More...
 
static void freeDefaultSerialComm ()
 Free the default serial Comm object. More...
 

Static Private Attributes

static const Comm< OrdinalType > * comm_ = NULL
 The default global communicator. More...
 
static const Comm< OrdinalType > * defaultSerialComm_ = NULL
 A "serial" communicator (containing one process, whose rank is zero). More...
 

Detailed Description

template<typename OrdinalType>
class Teuchos::DefaultComm< OrdinalType >

Return a default global communicator appropriate for the build.

Use this class to get a Comm instance representing the default global communicator. If Teuchos was built with MPI (i.e., if the HAVE_MPI macro is defined), then the default communicator wraps MPI_COMM_WORLD. Otherwise, it is a "serial" communicator (containing one process, whose rank is zero).

Template Parameters
OrdinalTypeThe ordinal type for the Comm communicator wrapper template class. Comm uses OrdinalType to represent things like array lengths and indices.
Note
(mfh 19 Jul 2011, 22 Dec 2011) OrdinalType is called OrdinalType and not Ordinal, because of a bug in Intel's C++ compiler (version 11.1). This compiler confuses the Ordinal template parameter of DefaultComm with the Teuchos::Ordinal typedef. The Ordinal template parameter should actually shadow the typedef in Teuchos, and it does with GCC 4.5.1, but does not with Intel's compiler. This may be the case with other compilers as well, but I haven't tested them yet. If this class' template parameter were named Ordinal, then the following line of code would result in a compile error:
RCP<const Comm<int> pComm = DefaultComm<int>::getDefaultSerialComm (null);

Definition at line 94 of file Teuchos_DefaultComm.hpp.

Member Function Documentation

template<typename OrdinalType >
Teuchos::RCP< const Teuchos::Comm< OrdinalType > > Teuchos::DefaultComm< OrdinalType >::getComm ( )
static

Return the default global communicator.

Warning
When running with MPI, do not call this function until after MPI_Init has been called. You can use GlobalMPISesssion to initialize MPI without explicitly depending on the MPI interface or the mpi.h header file. (If Trilinos was not built with MPI, GlobalMPISession will do the right thing, so you can use it unconditionally.)
Do not use or refer to the returned object after MPI_Finalize has been called. In a non-MPI build, do not use or refer to the returned object after main() has returned.

Definition at line 212 of file Teuchos_DefaultComm.hpp.

template<typename OrdinalType >
Teuchos::RCP< const Teuchos::Comm< OrdinalType > > Teuchos::DefaultComm< OrdinalType >::getDefaultSerialComm ( const Teuchos::RCP< const Comm< OrdinalType > > &  comm)
static

Return a serial Comm if the input Comm is null.

If the input communicator comm is null, return the default serial communicator. Otherwise, just return the input.

Warning
The same warnings as for getComm() apply here.

Definition at line 334 of file Teuchos_DefaultComm.hpp.

template<typename OrdinalType >
static void Teuchos::DefaultComm< OrdinalType >::freeDefaultComm ( )
inlinestaticprivate

Free the default Comm object.

Definition at line 143 of file Teuchos_DefaultComm.hpp.

template<typename OrdinalType >
static void Teuchos::DefaultComm< OrdinalType >::freeDefaultSerialComm ( )
inlinestaticprivate

Free the default serial Comm object.

Definition at line 151 of file Teuchos_DefaultComm.hpp.

Member Data Documentation

template<typename OrdinalType >
const Teuchos::Comm< OrdinalType > * Teuchos::DefaultComm< OrdinalType >::comm_ = NULL
staticprivate

The default global communicator.

If Teuchos was built with MPI, this is a wrapper for MPI_COMM_WORLD. Otherwise, this is a "serial" communicator (containing one process, whose rank is zero).

Definition at line 125 of file Teuchos_DefaultComm.hpp.

template<typename OrdinalType >
const Teuchos::Comm< OrdinalType > * Teuchos::DefaultComm< OrdinalType >::defaultSerialComm_ = NULL
staticprivate

A "serial" communicator (containing one process, whose rank is zero).

Definition at line 128 of file Teuchos_DefaultComm.hpp.


The documentation for this class was generated from the following file: