FEI  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Classes | Public Member Functions | List of all members
fei::Vector Class Referenceabstract

#include <fei_Vector.hpp>

Inheritance diagram for fei::Vector:
Inheritance graph
[legend]

Classes

class  Factory
 

Public Member Functions

virtual ~Vector ()
 
virtual const char * typeName () const =0
 
virtual int putScalar (double scalar)=0
 
virtual int sumIn (int numValues, const int *indices, const double *values, int vectorIndex=0)=0
 
virtual int copyIn (int numValues, const int *indices, const double *values, int vectorIndex=0)=0
 
virtual int copyOut (int numValues, const int *indices, double *values, int vectorIndex=0) const =0
 
virtual int update (double a, const fei::Vector *x, double b)=0
 
virtual int scatterToOverlap ()=0
 
virtual void setCommSizes ()=0
 
virtual int gatherFromOverlap (bool accumulate=true)=0
 
virtual fei::SharedPtr
< fei::VectorSpace
getVectorSpace () const =0
 
virtual void setVectorSpace (fei::SharedPtr< fei::VectorSpace > vecSpace)=0
 
virtual int sumInFieldData (int fieldID, int idType, int numIDs, const int *IDs, const double *data, int vectorIndex=0)=0
 
virtual int copyInFieldData (int fieldID, int idType, int numIDs, const int *IDs, const double *data, int vectorIndex=0)=0
 
virtual int copyOutFieldData (int fieldID, int idType, int numIDs, const int *IDs, double *data, int vectorIndex=0)=0
 
virtual int writeToFile (const char *filename, bool matrixMarketFormat=true)=0
 
virtual int writeToStream (FEI_OSTREAM &ostrm, bool matrixMarketFormat=true)=0
 

Detailed Description

Abstract representation of an algebraic multi-vector. This representation may be used with an overlapping data decomposition. The data distribution is defined by the fei::VectorSpace object returned by the method getVectorSpace(). This representation does not require that data be accessed only on the 'owning' processor. Data for any indices that are either shared or owned by the local processor may be passed to, or accessed from, the vector on the local processor. In most cases the underlying library-specific vector will have a non-overlapping data decomposition (each equation uniquely owned by a single processor). Overlapping data (shared by local processor but the equation is owned by another processor) may be assembled into this abstract vector locally, and will be moved into the underlying non-overlapping vector on the correct processor when the gatherFromOverlap() method is called. Conversely, if the user wants to retrieve overlapping data from the vector locally for an equation that resides on another processor, that data is not guaranteed to be available until the scatterToOverlap() method is called. The scatterToOverlap() method does communication necessary to populate shared-but-not-owned data in the fei::Vector from data in the underlying algebraic vector.

From the point of view of fei::Vector, there are two types of data: owned and shared-but-not-owned.

Data Input (passing user data into the vector):
When locally-owned data is input, fei::Vector relays it immediately to the underlying algebraic vector. When shared-but-not-owned data is input, fei::Vector holds it in temporary storage. When gatherToOverlap() is called, fei::Vector moves it to the owning processor and then relays it to the underlying algebraic vector. At that point the temporary storage is deleted.

Data Access (retrieving data from the vector):
When locally-owned data is accessed, fei::Vector retrieves it from the underlying algebraic vector directly. In order to access shared-but-not-owned data (overlapped data), it is necessary first to call the method scatterToOverlap(). This method does the communication necessary to re-create and populate temporary storage with the shared data by retrieving that data from the underlying algebraic vector on the owning processor and sending it to the sharing processors.

Definition at line 57 of file fei_Vector.hpp.

Constructor & Destructor Documentation

virtual fei::Vector::~Vector ( )
inlinevirtual

Virtual destructor.

Definition at line 89 of file fei_Vector.hpp.

Member Function Documentation

virtual const char* fei::Vector::typeName ( ) const
pure virtual
  Return an implementation-dependent name describing the run-time type

of this object.

Implemented in fei::Vector_Impl< T >.

virtual int fei::Vector::putScalar ( double  scalar)
pure virtual

Set a specified scalar throughout the vector.

Implemented in fei::Vector_Impl< T >.

virtual int fei::Vector::sumIn ( int  numValues,
const int *  indices,
const double *  values,
int  vectorIndex = 0 
)
pure virtual
  Accumulate values into the vector, adding them to any values that

already exist for the specified indices.

Implemented in fei::Vector_Impl< T >.

virtual int fei::Vector::copyIn ( int  numValues,
const int *  indices,
const double *  values,
int  vectorIndex = 0 
)
pure virtual
  Copy values into the vector overwriting any values that already exist

for the specified indices.

Implemented in fei::Vector_Impl< T >.

virtual int fei::Vector::copyOut ( int  numValues,
const int *  indices,
double *  values,
int  vectorIndex = 0 
) const
pure virtual
  Retrieve a copy of values from the vector for the specified indices.

Note that if the specified indices are not local in the underlying non-overlapping data decomposition, these values are not guaranteed to be correct until after the scatterToOverlap() method has been called.

Implemented in fei::Vector_Impl< T >.

virtual int fei::Vector::update ( double  a,
const fei::Vector x,
double  b 
)
pure virtual

Update 'this' = b*'this' + a*x

Implemented in fei::Vector_Impl< T >.

virtual int fei::Vector::scatterToOverlap ( )
pure virtual
  Scatter data from the underlying non-overlapping data decomposition to

the overlapping data decomposition. In other words, update values for shared indices from underlying uniquely owned data.

Implemented in fei::Vector_Impl< T >.

virtual void fei::Vector::setCommSizes ( )
pure virtual

perform initial communication to establish message sizes that will be needed for exchanging shared-node data. Called from within gatherFromOverlap usually, doesn't usually need to be explicitly called by client code. (Power users only...)

Implemented in fei::Vector_Impl< T >.

virtual int fei::Vector::gatherFromOverlap ( bool  accumulate = true)
pure virtual
  Gather data from the overlapping data decomposition into the underlying

non-overlapping data decomposition.

Implemented in fei::Vector_Impl< T >.

virtual fei::SharedPtr<fei::VectorSpace> fei::Vector::getVectorSpace ( ) const
pure virtual

Query for the VectorSpace object associated with this vector.

Implemented in fei::Vector_Impl< T >.

virtual void fei::Vector::setVectorSpace ( fei::SharedPtr< fei::VectorSpace vecSpace)
pure virtual

Set the VectorSpace object associated with this vector.

Implemented in fei::Vector_Impl< T >.

virtual int fei::Vector::sumInFieldData ( int  fieldID,
int  idType,
int  numIDs,
const int *  IDs,
const double *  data,
int  vectorIndex = 0 
)
pure virtual

Sum field data into the vector, adding it to any data that may already be present at the specified locations. If the specified fieldID doesn't exist at one or more of the specified IDs, then the corresponding positions in the data array will simply not be used.

Implemented in fei::Vector_Impl< T >.

virtual int fei::Vector::copyInFieldData ( int  fieldID,
int  idType,
int  numIDs,
const int *  IDs,
const double *  data,
int  vectorIndex = 0 
)
pure virtual

Copy field data into the vector, overwriting any data that may already be present at the specified locations. If the specified fieldID doesn't exist at one or more of the specified IDs, then the corresponding positions in the data array will simply not be used.

Implemented in fei::Vector_Impl< T >.

virtual int fei::Vector::copyOutFieldData ( int  fieldID,
int  idType,
int  numIDs,
const int *  IDs,
double *  data,
int  vectorIndex = 0 
)
pure virtual

Copy field data out of the vector into the user-allocated data array. If the specified fieldID doesn't exist at one or more of the specified IDs, then the corresponding positions in the data array will simply not be referenced.

Implemented in fei::Vector_Impl< T >.

virtual int fei::Vector::writeToFile ( const char *  filename,
bool  matrixMarketFormat = true 
)
pure virtual
  Write the vector's contents into the specified file.
Parameters
filenameText name of the file to be created or overwritten. If in a parallel environment, each processor will take turns writing into the file.
matrixMarketFormatOptional argument, defaults to true. If true the contents of the file will be MatrixMarket real array format. If not true, the contents of the file will contain the vector's global dimension on the first line, and all following lines will contain a space-separated pair with global index first and coefficient value second.
Returns
error-code 0 if successful, -1 if some error occurs such as failure to open file.

Implemented in fei::Vector_Impl< T >.

virtual int fei::Vector::writeToStream ( FEI_OSTREAM &  ostrm,
bool  matrixMarketFormat = true 
)
pure virtual
  Write the vector's contents to the specified ostream.
Parameters
ostrmostream to be written to.
matrixMarketFormatOptional argument, defaults to true. If true the contents of the vector will be written in MatrixMarket real array format. If not true, the stream will be given the vector's global dimension on the first line, and all following lines will contain a space-separated pair with global index first and coefficient value second.
Returns
error-code 0 if successful, -1 if some error occurs such as failure to open file.

Implemented in fei::Vector_Impl< T >.


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