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

#include <parallel_algebra.h>

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

Public Member Functions

 StandardType (const VectorValue< T > *example=nullptr)
 
 StandardType (const StandardType< VectorValue< T >> &t)
 
 ~StandardType ()
 
 operator const data_type & () const
 
 operator data_type & ()
 
void commit ()
 
void free ()
 

Protected Attributes

data_type _datatype
 

Detailed Description

template<typename T>
class libMesh::Parallel::StandardType< VectorValue< T > >

Definition at line 111 of file parallel_algebra.h.

Constructor & Destructor Documentation

◆ StandardType() [1/2]

template<typename T >
libMesh::Parallel::StandardType< VectorValue< T > >::StandardType ( const VectorValue< T > *  example = nullptr)
explicit

Definition at line 115 of file parallel_algebra.h.

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

115  {
116  // We need an example for MPI_Address to use
117  VectorValue<T> * ex;
118  std::unique_ptr<VectorValue<T>> temp;
119  if (example)
120  ex = const_cast<VectorValue<T> *>(example);
121  else
122  {
123  temp.reset(new VectorValue<T>());
124  ex = temp.get();
125  }
126 
127 #ifdef LIBMESH_HAVE_MPI
128  StandardType<T> T_type(&((*ex)(0)));
129 
130  int blocklength = LIBMESH_DIM;
131  MPI_Aint displs, start;
132  MPI_Datatype tmptype, type = T_type;
133 
134  libmesh_call_mpi
135  (MPI_Get_address (ex, &start));
136  libmesh_call_mpi
137  (MPI_Get_address (&((*ex)(0)), &displs));
138 
139  // subtract off offset to first value from the beginning of the structure
140  displs -= start;
141 
142  // create a prototype structure
143  libmesh_call_mpi
144  (MPI_Type_create_struct (1, &blocklength, &displs, &type,
145  &tmptype));
146  libmesh_call_mpi
147  (MPI_Type_commit (&tmptype));
148 
149  // resize the structure type to account for padding, if any
150  libmesh_call_mpi
151  (MPI_Type_create_resized (tmptype, 0,
152  sizeof(VectorValue<T>),
153  &_datatype));
154 
155  libmesh_call_mpi
156  (MPI_Type_commit (&_datatype));
157 
158  libmesh_call_mpi
159  (MPI_Type_free (&tmptype));
160 #endif // #ifdef LIBMESH_HAVE_MPI
161  }

◆ StandardType() [2/2]

template<typename T >
libMesh::Parallel::StandardType< VectorValue< T > >::StandardType ( const StandardType< VectorValue< T >> &  t)

Definition at line 163 of file parallel_algebra.h.

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

164  : DataType()
165  {
166 #ifdef LIBMESH_HAVE_MPI
167  libmesh_call_mpi (MPI_Type_dup (t._datatype, &_datatype));
168 #endif
169  }

◆ ~StandardType()

template<typename T >
libMesh::Parallel::StandardType< VectorValue< T > >::~StandardType ( )

Definition at line 171 of file parallel_algebra.h.

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

171 { 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: