Flow123d  release_3.0.0-1190-g0f314ad
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
VectorMPI Class Reference

#include <vector_mpi.hh>

Public Types

typedef std::vector< double > VectorData
 
typedef std::shared_ptr< VectorDataVectorDataPtr
 

Public Member Functions

 VectorMPI (MPI_Comm comm=PETSC_COMM_SELF)
 
 VectorMPI (unsigned int local_size, MPI_Comm comm=PETSC_COMM_WORLD)
 Create shared pointer and PETSC vector with given size. COLLECTIVE. More...
 
 VectorMPI (unsigned int local_size, std::vector< LongIdx > &ghost_idx)
 Create PETSc vector with ghost values whose indices are specified in ghost_idx. More...
 
void resize (unsigned int local_size)
 
void resize (unsigned int local_size, std::vector< LongIdx > &ghost_idx)
 
void duplicate (VectorMPI other)
 Return new vector with same parallel structure. More...
 
VectorDataPtr data_ptr ()
 Getter for shared pointer of output data. More...
 
Vec & petsc_vec ()
 Getter for PETSC vector of output data (e.g. can be used by scatters). More...
 
void zero_entries ()
 
VectorDatadata ()
 
const VectorDatadata () const
 
void swap (VectorMPI &other)
 
void copy (VectorMPI &other)
 
void local_to_ghost_begin ()
 local_to_ghost_{begin,end} updates the ghost values on neighbouring processors from local values More...
 
void local_to_ghost_end ()
 local_to_ghost_{begin,end} updates the ghost values on neighbouring processors from local values More...
 
void ghost_to_local_begin ()
 ghost_to_local_{begin,end} updates the local values by adding ghost values from neighbouring processors More...
 
void ghost_to_local_end ()
 ghost_to_local_{begin,end} updates the local values by adding ghost values from neighbouring processors More...
 
unsigned int size () const
 Return size of output data. More...
 
 ~VectorMPI ()
 Destructor. More...
 
double & operator[] (unsigned int idx)
 
double & operator[] (unsigned int idx) const
 

Static Public Member Functions

static VectorMPI sequential (unsigned int size)
 

Private Attributes

VectorDataPtr data_ptr_
 shared pointer to vector of data More...
 
Vec data_petsc_
 stored vector of data in PETSC format More...
 
MPI_Comm communicator_
 communicator More...
 

Detailed Description

Auxiliary class for output elementwise concentration vectors in convection transport, sorptions, dual porosity etc.

Stores data in two formats:

Allows the following functionalities:

Definition at line 42 of file vector_mpi.hh.

Member Typedef Documentation

Definition at line 44 of file vector_mpi.hh.

typedef std::shared_ptr< VectorData > VectorMPI::VectorDataPtr

Definition at line 45 of file vector_mpi.hh.

Constructor & Destructor Documentation

VectorMPI::VectorMPI ( MPI_Comm  comm = PETSC_COMM_SELF)
inline

Definition at line 47 of file vector_mpi.hh.

Here is the caller graph for this function:

VectorMPI::VectorMPI ( unsigned int  local_size,
MPI_Comm  comm = PETSC_COMM_WORLD 
)
inline

Create shared pointer and PETSC vector with given size. COLLECTIVE.

Definition at line 51 of file vector_mpi.hh.

VectorMPI::VectorMPI ( unsigned int  local_size,
std::vector< LongIdx > &  ghost_idx 
)
inline

Create PETSc vector with ghost values whose indices are specified in ghost_idx.

Definition at line 57 of file vector_mpi.hh.

VectorMPI::~VectorMPI ( )
inline

Destructor.

Definition at line 194 of file vector_mpi.hh.

Member Function Documentation

void VectorMPI::copy ( VectorMPI other)
inline

Definition at line 158 of file vector_mpi.hh.

VectorData& VectorMPI::data ( )
inline

Definition at line 129 of file vector_mpi.hh.

Here is the caller graph for this function:

const VectorData& VectorMPI::data ( ) const
inline

Definition at line 135 of file vector_mpi.hh.

VectorDataPtr VectorMPI::data_ptr ( )
inline

Getter for shared pointer of output data.

Definition at line 114 of file vector_mpi.hh.

Here is the caller graph for this function:

void VectorMPI::duplicate ( VectorMPI  other)
inline

Return new vector with same parallel structure.

Definition at line 108 of file vector_mpi.hh.

void VectorMPI::ghost_to_local_begin ( )
inline

ghost_to_local_{begin,end} updates the local values by adding ghost values from neighbouring processors

Definition at line 176 of file vector_mpi.hh.

void VectorMPI::ghost_to_local_end ( )
inline

ghost_to_local_{begin,end} updates the local values by adding ghost values from neighbouring processors

Definition at line 181 of file vector_mpi.hh.

void VectorMPI::local_to_ghost_begin ( )
inline

local_to_ghost_{begin,end} updates the ghost values on neighbouring processors from local values

Definition at line 166 of file vector_mpi.hh.

void VectorMPI::local_to_ghost_end ( )
inline

local_to_ghost_{begin,end} updates the ghost values on neighbouring processors from local values

Definition at line 171 of file vector_mpi.hh.

double& VectorMPI::operator[] ( unsigned int  idx)
inline

Access to the vector element on local index idx.

Definition at line 203 of file vector_mpi.hh.

double& VectorMPI::operator[] ( unsigned int  idx) const
inline

Access to the vector element on local index idx (const version).

Definition at line 213 of file vector_mpi.hh.

Vec& VectorMPI::petsc_vec ( )
inline

Getter for PETSC vector of output data (e.g. can be used by scatters).

Definition at line 120 of file vector_mpi.hh.

Here is the caller graph for this function:

void VectorMPI::resize ( unsigned int  local_size)
inline

Resize the vector to given local size. Operation is allowed only if this object is a unique vector object pointing to the actual data.

Definition at line 76 of file vector_mpi.hh.

Here is the caller graph for this function:

void VectorMPI::resize ( unsigned int  local_size,
std::vector< LongIdx > &  ghost_idx 
)
inline

Resize the vector to given local size with ghost values. Indices of ghost values are in ghost_idx.

Definition at line 94 of file vector_mpi.hh.

static VectorMPI VectorMPI::sequential ( unsigned int  size)
inlinestatic

Helper method creating VectorMPI of given size with serial Petsc communicator.

Method is used for better readability of code.

Definition at line 67 of file vector_mpi.hh.

Here is the caller graph for this function:

unsigned int VectorMPI::size ( ) const
inline

Return size of output data.

Definition at line 186 of file vector_mpi.hh.

Here is the caller graph for this function:

void VectorMPI::swap ( VectorMPI other)
inline

Definition at line 141 of file vector_mpi.hh.

void VectorMPI::zero_entries ( )
inline

Definition at line 125 of file vector_mpi.hh.

Here is the caller graph for this function:

Member Data Documentation

MPI_Comm VectorMPI::communicator_
private

communicator

Definition at line 227 of file vector_mpi.hh.

Vec VectorMPI::data_petsc_
private

stored vector of data in PETSC format

Definition at line 225 of file vector_mpi.hh.

VectorDataPtr VectorMPI::data_ptr_
private

shared pointer to vector of data

Definition at line 223 of file vector_mpi.hh.


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