libMesh
Public Member Functions | Protected Attributes | List of all members
libMesh::Parallel::StandardType< Point > Class Template Reference

#include <parallel_algebra.h>

Inheritance diagram for libMesh::Parallel::StandardType< Point >:
[legend]

Public Member Functions

 StandardType (const Point *example=nullptr)
 
 StandardType (const StandardType< Point > &libmesh_mpi_var(t))
 
 ~StandardType ()
 
 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 176 of file parallel_algebra.h.

Constructor & Destructor Documentation

◆ StandardType() [1/2]

libMesh::Parallel::StandardType< Point >::StandardType ( const Point example = nullptr)
explicit

Definition at line 180 of file parallel_algebra.h.

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

181  {
182  // Prevent unused variable warnings when !LIBMESH_HAVE_MPI
183  libmesh_ignore(example);
184 
185 #ifdef LIBMESH_HAVE_MPI
186 
187  // We need an example for MPI_Address to use
188  Point * ex;
189 
190  std::unique_ptr<Point> temp;
191  if (example)
192  ex = const_cast<Point *>(example);
193  else
194  {
195  temp.reset(new Point());
196  ex = temp.get();
197  }
198 
199  StandardType<Real> T_type(&((*ex)(0)));
200 
201  int blocklength = LIBMESH_DIM;
202  MPI_Aint displs, start;
203  MPI_Datatype tmptype, type = T_type;
204 
205  libmesh_call_mpi
206  (MPI_Get_address (ex, &start));
207  libmesh_call_mpi
208  (MPI_Get_address (&((*ex)(0)), &displs));
209 
210  // subtract off offset to first value from the beginning of the structure
211  displs -= start;
212 
213  // create a prototype structure
214  libmesh_call_mpi
215  (MPI_Type_create_struct (1, &blocklength, &displs, &type,
216  &tmptype));
217  libmesh_call_mpi
218  (MPI_Type_commit (&tmptype));
219 
220  // resize the structure type to account for padding, if any
221  libmesh_call_mpi
222  (MPI_Type_create_resized (tmptype, 0, sizeof(Point),
223  &_datatype));
224 
225  libmesh_call_mpi
226  (MPI_Type_commit (&_datatype));
227 
228  libmesh_call_mpi
229  (MPI_Type_free (&tmptype));
230 #endif // #ifdef LIBMESH_HAVE_MPI
231  }
void libmesh_ignore(const Args &...)

◆ StandardType() [2/2]

Definition at line 233 of file parallel_algebra.h.

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

234  : DataType()
235  {
236  libmesh_call_mpi (MPI_Type_dup (t._datatype, &_datatype));
237  }

◆ ~StandardType()

Definition at line 239 of file parallel_algebra.h.

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

239 { this->free(); }

Member Function Documentation

◆ commit()

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

◆ free()

void libMesh::Parallel::DataType::free ( )
inherited

◆ operator const data_type &()

libMesh::Parallel::DataType::operator const data_type & ( ) const
inherited

Definition at line 91 of file data_type.h.

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

92  { return _datatype; }

◆ operator data_type &()

libMesh::Parallel::DataType::operator data_type & ( )
inherited

Definition at line 94 of file data_type.h.

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

95  { return _datatype; }

Member Data Documentation

◆ _datatype

data_type libMesh::Parallel::DataType::_datatype
protectedinherited

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