Teuchos Package Browser (Single Doxygen Collection) Version of the Day
Static Public Member Functions | Static Private Attributes
Teuchos::DefaultComm< OrdinalType > Class Template Reference

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

#include <Teuchos_DefaultComm.hpp>

List of all members.

Static Public Member Functions

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

Static Private Attributes

static Teuchos::RCP< const
Comm< OrdinalType > > 
comm_ = Teuchos::null
 The default global communicator.
static Teuchos::RCP< const
Comm< OrdinalType > > 
defaultSerialComm_ = Teuchos::rcp(new Teuchos::SerialComm<OrdinalType>())
 A "serial" communicator (containing one process, whose rank is zero).

Detailed Description

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

Return a default global communicator appropriate for the build.

Use this class to get a Teuchos::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 you use Ordinal as the template parameter in this class, the following line of code will result in a compile error.
 RCP<const Comm<int> pComm = DefaultComm<int>::getDefaultSerialComm (null); 

Definition at line 80 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 has been initialized! 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.)

Definition at line 116 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.

Definition at line 130 of file Teuchos_DefaultComm.hpp.


Member Data Documentation

template<typename OrdinalType >
Teuchos::RCP< const Teuchos::Comm< OrdinalType > > Teuchos::DefaultComm< OrdinalType >::comm_ = Teuchos::null [static, private]

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 107 of file Teuchos_DefaultComm.hpp.

template<typename OrdinalType >
Teuchos::RCP< const Teuchos::Comm< OrdinalType > > Teuchos::DefaultComm< OrdinalType >::defaultSerialComm_ = Teuchos::rcp(new Teuchos::SerialComm<OrdinalType>()) [static, private]

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

Definition at line 110 of file Teuchos_DefaultComm.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines