PSCF v1.1
Public Member Functions | List of all members
Util::MpiLoader< IArchive > Class Template Reference

Provides methods for MPI-aware loading of data from input archive. More...

#include <MpiLoader.h>

Public Member Functions

 MpiLoader (MpiFileIo &mpiFileIo, IArchive &archive)
 Constructor. More...
 
template<typename Data >
void load (Data &value)
 Load and broadcast a single Data value. More...
 
template<typename Data >
void load (Data *value, int n)
 Load and broadcast a C array. More...
 
template<typename Data >
void load (DArray< Data > &array, int n)
 Load and broadcast a DArray < Data > container. More...
 
template<typename Data , int N>
void load (FArray< Data, N > &array)
 Load and broadcast an FArray <Data , N > object. More...
 
template<typename Data >
void load (Data *value, int m, int n, int np)
 Load and broadcast a 2D CArray of Data objects. More...
 
template<typename Data >
void load (DMatrix< Data > &matrix, int m, int n)
 Load and broadcast a DMatrix<Data> object. More...
 

Detailed Description

template<class IArchive>
class Util::MpiLoader< IArchive >

Provides methods for MPI-aware loading of data from input archive.

Each MpiLoader is associated with an IArchive input archive, and with a MpiFileIo, which are passed as arguments to the constructor. The MpiFileIo argument is often a ParamComposite, which is derived from MpiFileIo.

The "load" function templates all load data from the archive and (if appropriate) broadcast data among processors. If MPI is not enabled (i.e., if UTIL_MPI is not defined), then the data is simply loaded from the archive. If MPI is enabled and a parameter communicator is set, data is loaded from the archive by the ioProcessor and then broadcast to all other processors in the IO communicator. If MPI is enabled but no parameter communicator is set, every processor loads data independently.

Definition at line 43 of file MpiLoader.h.

Constructor & Destructor Documentation

◆ MpiLoader()

template<typename IArchive >
Util::MpiLoader< IArchive >::MpiLoader ( MpiFileIo mpiFileIo,
IArchive &  archive 
)

Constructor.

Parameters
mpiFileIoassociated MpiFileIo object
archiveinput archive from which data will be loaded

Definition at line 127 of file MpiLoader.h.

Member Function Documentation

◆ load() [1/6]

template<typename IArchive >
template<typename Data >
void Util::MpiLoader< IArchive >::load ( Data &  value)

Load and broadcast a single Data value.

Parameters
valuereference to a Data

Definition at line 137 of file MpiLoader.h.

Referenced by Util::FileMaster::loadParameters().

◆ load() [2/6]

template<typename IArchive >
template<typename Data >
void Util::MpiLoader< IArchive >::load ( Data *  value,
int  n 
)

Load and broadcast a C array.

Parameters
valuepointer to array
nnumber of elements

Definition at line 154 of file MpiLoader.h.

◆ load() [3/6]

template<typename IArchive >
template<typename Data >
void Util::MpiLoader< IArchive >::load ( DArray< Data > &  array,
int  n 
)

Load and broadcast a DArray < Data > container.

Parameters
arrayDArray object
nnumber of elements

Definition at line 174 of file MpiLoader.h.

References UTIL_THROW.

◆ load() [4/6]

template<typename IArchive >
template<typename Data , int N>
void Util::MpiLoader< IArchive >::load ( FArray< Data, N > &  array)

Load and broadcast an FArray <Data , N > object.

Parameters
arrayFArray object to be loaded

Definition at line 194 of file MpiLoader.h.

◆ load() [5/6]

template<typename IArchive >
template<typename Data >
void Util::MpiLoader< IArchive >::load ( Data *  value,
int  m,
int  n,
int  np 
)

Load and broadcast a 2D CArray of Data objects.

Loads m rows of n elements into array declared as Data array[][np].

Parameters
valuepointer to first element or row in array
mlogical number of rows (1st dimension)
nlogical number of columns (2nd dimension)
npphyscial number of columns (elements allocated per row)

Definition at line 214 of file MpiLoader.h.

◆ load() [6/6]

template<typename IArchive >
template<typename Data >
void Util::MpiLoader< IArchive >::load ( DMatrix< Data > &  matrix,
int  m,
int  n 
)

Load and broadcast a DMatrix<Data> object.

Parameters
matrixDMatrix object
mnumber of rows (1st dimension)
nnumber of columns (2nd dimension)

Definition at line 237 of file MpiLoader.h.


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