libMesh::Parallel::StandardType< Point > Class Template Reference

#include <parallel_algebra.h>

Inheritance diagram for libMesh::Parallel::StandardType< Point >:

List of all members.

Public Member Functions

 StandardType (const Point *example=NULL)
 operator const data_type & () const
 operator data_type & ()
void commit ()
void free ()

Protected Attributes

data_type _datatype

Detailed Description

template<>
class libMesh::Parallel::StandardType< Point >

Definition at line 174 of file parallel_algebra.h.


Constructor & Destructor Documentation

libMesh::Parallel::StandardType< Point >::StandardType ( const Point example = NULL  )  [inline, explicit]

Definition at line 178 of file parallel_algebra.h.

References libMesh::Parallel::DataType::_datatype, libMesh::libMeshPrivateData::_is_initialized, libMesh::AutoPtr< Tp >::get(), and libMesh::AutoPtr< Tp >::reset().

00178                                             {
00179       // We need an example for MPI_Address to use
00180       Point *ex;
00181       AutoPtr<Point> temp;
00182       if (example)
00183         ex = const_cast<Point *>(example);
00184       else
00185         {
00186           temp.reset(new Point());
00187           ex = temp.get();
00188         }
00189 
00190       // _static_type never gets freed, but it only gets committed once
00191       // per T, so it's not a *huge* memory leak...
00192       static data_type _static_type;
00193       static bool _is_initialized = false;
00194       if (!_is_initialized)
00195         {
00196 #ifdef LIBMESH_HAVE_MPI
00197           StandardType<Real> T_type(&((*ex)(0)));
00198           int blocklengths[LIBMESH_DIM+2];
00199           MPI_Aint displs[LIBMESH_DIM+2];
00200           MPI_Datatype types[LIBMESH_DIM+2];
00201           MPI_Aint start, later;
00202 
00203           MPI_Address(ex, &start);
00204           blocklengths[0] = 1;
00205           displs[0] = 0;
00206           types[0] = MPI_LB;
00207           for (unsigned int i=0; i != LIBMESH_DIM; ++i)
00208             {
00209               MPI_Address(&((*ex)(i)), &later);
00210               blocklengths[i+1] = 1;
00211               displs[i+1] = later - start;
00212               types[i+1] = T_type;
00213             }
00214           MPI_Address((ex+1), &later);
00215           blocklengths[LIBMESH_DIM+1] = 1;
00216           displs[LIBMESH_DIM+1] = later - start;
00217           types[LIBMESH_DIM+1] = MPI_UB;
00218 
00219 #if MPI_VERSION > 1
00220           MPI_Type_create_struct (LIBMESH_DIM+2, blocklengths, displs, types, &_static_type);
00221 #else
00222           MPI_Type_struct (LIBMESH_DIM+2, blocklengths, displs, types, &_static_type);
00223 #endif // #if MPI_VERSION > 1
00224 
00225           MPI_Type_commit (&_static_type);
00226 #endif
00227           _is_initialized = true;
00228         }
00229       _datatype = _static_type;
00230     }


Member Function Documentation

void libMesh::Parallel::DataType::commit (  )  [inline, inherited]

Definition at line 255 of file parallel.h.

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

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

00256     {
00257 #ifdef LIBMESH_HAVE_MPI
00258       MPI_Type_commit (&_datatype);
00259 #endif
00260     }

libMesh::Parallel::DataType::operator const data_type & (  )  const [inline, inherited]

Definition at line 243 of file parallel.h.

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

00244     { return _datatype; }

libMesh::Parallel::DataType::operator data_type & (  )  [inline, inherited]

Definition at line 246 of file parallel.h.

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

00247     { return _datatype; }


Member Data Documentation


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

Site Created By: libMesh Developers
Last modified: February 05 2013 19:55:45 UTC

Hosted By:
SourceForge.net Logo