libMesh::Parallel::StandardType< std::pair< T1, T2 > > Class Template Reference

#include <parallel_implementation.h>

Inheritance diagram for libMesh::Parallel::StandardType< std::pair< T1, T2 > >:

Public Member Functions

 StandardType (const std::pair< T1, T2 > *example=NULL)
 
 ~StandardType ()
 
 operator const data_type & () const
 
 operator data_type & ()
 
void commit ()
 
void free ()
 

Protected Attributes

data_type _datatype
 

Detailed Description

template<typename T1, typename T2>
class libMesh::Parallel::StandardType< std::pair< T1, T2 > >

Definition at line 118 of file parallel_implementation.h.

Constructor & Destructor Documentation

template<typename T1 , typename T2 >
libMesh::Parallel::StandardType< std::pair< T1, T2 > >::StandardType ( const std::pair< T1, T2 > *  example = NULL)
inlineexplicit

Definition at line 122 of file parallel_implementation.h.

References libMesh::Parallel::DataType::_datatype, and libMesh::libmesh_assert().

122  {
123  // We need an example for MPI_Address to use
124  libmesh_assert(example);
125 
126 #ifdef LIBMESH_HAVE_MPI
127  // Get the sub-data-types, and make sure they live long enough
128  // to construct the derived type
129  StandardType<T1> d1(&example->first);
130  StandardType<T2> d2(&example->second);
131  MPI_Datatype types[] = { (data_type)d1, (data_type)d2 };
132  int blocklengths[] = {1,1};
133 
134  MPI_Aint displs[2];
135 #if MPI_VERSION > 1
136  MPI_Get_address (const_cast<T1*>(&example->first), &displs[0]);
137  MPI_Get_address (const_cast<T2*>(&example->second), &displs[1]);
138 #else
139  MPI_Address (const_cast<T1*>(&example->first), &displs[0]);
140  MPI_Address (const_cast<T2*>(&example->second), &displs[1]);
141 #endif
142  displs[1] -= displs[0];
143  displs[0] = 0;
144 
145 #if MPI_VERSION > 1
146  MPI_Type_create_struct (2, blocklengths, displs, types, &_datatype);
147 #else
148  MPI_Type_struct (2, blocklengths, displs, types, &_datatype);
149 #endif // #if MPI_VERSION > 1
150  MPI_Type_commit (&_datatype);
151 #endif // LIBMESH_HAVE_MPI
152  }
template<typename T1 , typename T2 >
libMesh::Parallel::StandardType< std::pair< T1, T2 > >::~StandardType ( )
inline

Definition at line 154 of file parallel_implementation.h.

References libMesh::Parallel::DataType::free().

154 { this->free(); }

Member Function Documentation

void libMesh::Parallel::DataType::commit ( )
inlineinherited

Definition at line 277 of file parallel.h.

References libMesh::Parallel::DataType::_datatype.

Referenced by libMesh::Parallel::DataType::DataType().

278  {
279 #ifdef LIBMESH_HAVE_MPI
280  MPI_Type_commit (&_datatype);
281 #endif
282  }
void libMesh::Parallel::DataType::free ( )
inlineinherited
libMesh::Parallel::DataType::operator const data_type & ( ) const
inlineinherited

Definition at line 265 of file parallel.h.

References libMesh::Parallel::DataType::_datatype.

266  { return _datatype; }
libMesh::Parallel::DataType::operator data_type & ( )
inlineinherited

Definition at line 268 of file parallel.h.

References libMesh::Parallel::DataType::_datatype.

269  { return _datatype; }

Member Data Documentation


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

Site Created By: libMesh Developers
Last modified: February 07 2014 16:58:02 UTC

Hosted By:
SourceForge.net Logo