FEI Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
fei::VectorReducer Class Reference

#include <fei_VectorReducer.hpp>

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

Public Member Functions

 VectorReducer (fei::SharedPtr< fei::Reducer > reducer, fei::SharedPtr< fei::Vector > target, bool isSolutionVector=false)
 
virtual ~VectorReducer ()
 
fei::SharedPtr< fei::VectorgetTargetVector ()
 
const char * typeName () const
 
int update (double a, const fei::Vector *x, double b)
 
int scatterToOverlap ()
 
void setCommSizes ()
 
int gatherFromOverlap (bool accumulate=true)
 
int putScalar (double scalar)
 
int sumIn (int numValues, const int *indices, const double *values, int vectorIndex=0)
 
int copyIn (int numValues, const int *indices, const double *values, int vectorIndex=0)
 
fei::SharedPtr< fei::VectorSpacegetVectorSpace () const
 
void setVectorSpace (fei::SharedPtr< fei::VectorSpace > vecSpace)
 
int sumInFieldData (int fieldID, int idType, int numIDs, const int *IDs, const double *data, int vectorIndex=0)
 
int copyInFieldData (int fieldID, int idType, int numIDs, const int *IDs, const double *data, int vectorIndex=0)
 
int copyInFieldDataLocalIDs (int fieldID, int idType, int numIDs, const int *localIDs, const double *data, int vectorIndex=0)
 
int copyOutFieldData (int fieldID, int idType, int numIDs, const int *IDs, double *data, int vectorIndex=0)
 
int writeToFile (const char *filename, bool matrixMarketFormat=true)
 
int writeToStream (FEI_OSTREAM &ostrm, bool matrixMarketFormat=true)
 
int copyOut (int numValues, const int *indices, double *values, int vectorIndex=0) const
 
- Public Member Functions inherited from fei::Vector
virtual ~Vector ()
 

Private Member Functions

int copyOut_FE (int nodeNumber, int dofOffset, double &value)
 
int giveToUnderlyingVector (int numValues, const int *indices, const double *values, bool sumInto=true, int vectorIndex=0)
 
int sumIntoFEVector (int blockID, int connOffset, int numNodes, const int *nodeNumbers, const int *numIndicesPerNode, const double *values)
 

Private Attributes

fei::SharedPtr< fei::Reducerreducer_
 
fei::SharedPtr< fei::Vectortarget_
 
bool isSolution_
 
int localProc_
 
int numProcs_
 

Detailed Description

Definition at line 24 of file fei_VectorReducer.hpp.

Constructor & Destructor Documentation

fei::VectorReducer::VectorReducer ( fei::SharedPtr< fei::Reducer reducer,
fei::SharedPtr< fei::Vector target,
bool  isSolutionVector = false 
)
fei::VectorReducer::~VectorReducer ( )
virtual

Destructor

Definition at line 62 of file fei_VectorReducer.cpp.

Member Function Documentation

fei::SharedPtr<fei::Vector> fei::VectorReducer::getTargetVector ( )
inline

Query for underlying target vector.

Definition at line 36 of file fei_VectorReducer.hpp.

References target_.

const char* fei::VectorReducer::typeName ( ) const
inlinevirtual
  Return a name describing the run-time type

of this object.

Implements fei::Vector.

Definition at line 42 of file fei_VectorReducer.hpp.

References target_, and fei::Vector::typeName().

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

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

Implements fei::Vector.

Definition at line 73 of file fei_VectorReducer.cpp.

References target_, and fei::Vector::update().

int fei::VectorReducer::scatterToOverlap ( )
virtual
  Use data in the underlying non-overlapping decomposition to update

any shared data in the overlapping decomposition.

If any data is already held for the shared positions, that data will be replaced by the data from the 'owning' processor.

Implements fei::Vector.

Definition at line 79 of file fei_VectorReducer.cpp.

References fei::Vector::scatterToOverlap(), and target_.

void fei::VectorReducer::setCommSizes ( )
inlinevirtual

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...)

Implements fei::Vector.

Definition at line 58 of file fei_VectorReducer.hpp.

References fei::Vector::setCommSizes(), and target_.

int fei::VectorReducer::gatherFromOverlap ( bool  accumulate = true)
virtual
  Move any shared data from the overlapping decomposition to the

underlying non-overlapping decomposition.

Implements fei::Vector.

Definition at line 85 of file fei_VectorReducer.cpp.

References fei::Reducer::assembleReducedVector(), fei::Vector::gatherFromOverlap(), isSolution_, reducer_, fei::Vector::setCommSizes(), and target_.

int fei::VectorReducer::putScalar ( double  scalar)
virtual

Set a specified scalar throughout the vector.

Implements fei::Vector.

Definition at line 67 of file fei_VectorReducer.cpp.

References fei::Vector::putScalar(), and target_.

int fei::VectorReducer::sumIn ( int  numValues,
const int *  indices,
const double *  values,
int  vectorIndex = 0 
)
virtual
  Sum values into the vector, adding to any

that may already exist at the specified indices.

Implements fei::Vector.

Definition at line 93 of file fei_VectorReducer.cpp.

References fei::Reducer::addVectorValues(), isSolution_, reducer_, and target_.

Referenced by sumInFieldData().

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

at the specified indices.

Implements fei::Vector.

Definition at line 102 of file fei_VectorReducer.cpp.

References fei::Reducer::addVectorValues(), isSolution_, reducer_, and target_.

Referenced by copyInFieldData(), and copyInFieldDataLocalIDs().

fei::SharedPtr<fei::VectorSpace> fei::VectorReducer::getVectorSpace ( ) const
inlinevirtual

Obtain the VectorSpace associated with this vector.

Implements fei::Vector.

Definition at line 82 of file fei_VectorReducer.hpp.

References fei::Vector::getVectorSpace(), and target_.

void fei::VectorReducer::setVectorSpace ( fei::SharedPtr< fei::VectorSpace vecSpace)
inlinevirtual

Set the VectorSpace associated with this vector.

Implements fei::Vector.

Definition at line 87 of file fei_VectorReducer.hpp.

References fei::Vector::setVectorSpace(), and target_.

int fei::VectorReducer::sumInFieldData ( int  fieldID,
int  idType,
int  numIDs,
const int *  IDs,
const double *  data,
int  vectorIndex = 0 
)
virtual
  Sum field data into the vector, adding to any coefficients that may

already exist 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.

Implements fei::Vector.

Definition at line 123 of file fei_VectorReducer.cpp.

References fei::VectorSpace::getFieldSize(), fei::VectorSpace::getGlobalIndices(), fei::Vector::getVectorSpace(), sumIn(), and target_.

int fei::VectorReducer::copyInFieldData ( int  fieldID,
int  idType,
int  numIDs,
const int *  IDs,
const double *  data,
int  vectorIndex = 0 
)
virtual
  Copy field data into the vector, overwriting any coefficients that may

already exist 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.

Implements fei::Vector.

Definition at line 143 of file fei_VectorReducer.cpp.

References copyIn(), fei::VectorSpace::getFieldSize(), fei::VectorSpace::getGlobalIndices(), fei::Vector::getVectorSpace(), and target_.

int fei::VectorReducer::copyInFieldDataLocalIDs ( int  fieldID,
int  idType,
int  numIDs,
const int *  localIDs,
const double *  data,
int  vectorIndex = 0 
)
virtual
int fei::VectorReducer::copyOutFieldData ( int  fieldID,
int  idType,
int  numIDs,
const int *  IDs,
double *  data,
int  vectorIndex = 0 
)
virtual
  Copy field data out of the vector, into the caller-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.

Implements fei::Vector.

Definition at line 190 of file fei_VectorReducer.cpp.

References copyOut(), fei::VectorSpace::getFieldSize(), fei::VectorSpace::getGlobalIndices(), fei::Vector::getVectorSpace(), and target_.

int fei::VectorReducer::writeToFile ( const char *  filename,
bool  matrixMarketFormat = true 
)
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.

Implements fei::Vector.

Definition at line 210 of file fei_VectorReducer.cpp.

References target_, and fei::Vector::writeToFile().

int fei::VectorReducer::writeToStream ( FEI_OSTREAM ostrm,
bool  matrixMarketFormat = true 
)
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.

Implements fei::Vector.

Definition at line 217 of file fei_VectorReducer.cpp.

References target_, and fei::Vector::writeToStream().

int fei::VectorReducer::copyOut ( int  numValues,
const int *  indices,
double *  values,
int  vectorIndex = 0 
) const
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.

Implements fei::Vector.

Definition at line 224 of file fei_VectorReducer.cpp.

References fei::Reducer::copyOutVectorValues(), isSolution_, reducer_, and target_.

Referenced by copyOutFieldData().

int fei::VectorReducer::copyOut_FE ( int  nodeNumber,
int  dofOffset,
double &  value 
)
private

please ignore

Definition at line 183 of file fei_VectorReducer.cpp.

int fei::VectorReducer::giveToUnderlyingVector ( int  numValues,
const int *  indices,
const double *  values,
bool  sumInto = true,
int  vectorIndex = 0 
)
private

Definition at line 111 of file fei_VectorReducer.cpp.

References fei::Reducer::addVectorValues(), isSolution_, reducer_, and target_.

int fei::VectorReducer::sumIntoFEVector ( int  blockID,
int  connOffset,
int  numNodes,
const int *  nodeNumbers,
const int *  numIndicesPerNode,
const double *  values 
)
private

Definition at line 236 of file fei_VectorReducer.cpp.

Member Data Documentation

fei::SharedPtr<fei::Reducer> fei::VectorReducer::reducer_
private
fei::SharedPtr<fei::Vector> fei::VectorReducer::target_
private
bool fei::VectorReducer::isSolution_
private
int fei::VectorReducer::localProc_
private

Definition at line 169 of file fei_VectorReducer.hpp.

Referenced by VectorReducer().

int fei::VectorReducer::numProcs_
private

Definition at line 170 of file fei_VectorReducer.hpp.

Referenced by VectorReducer().


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