FEI Version of the Day
fei_Vector.hpp
00001 /*--------------------------------------------------------------------*/
00002 /*    Copyright 2005 Sandia Corporation.                              */
00003 /*    Under the terms of Contract DE-AC04-94AL85000, there is a       */
00004 /*    non-exclusive license for use of this work by or on behalf      */
00005 /*    of the U.S. Government.  Export of this program may require     */
00006 /*    a license from the United States Government.                    */
00007 /*--------------------------------------------------------------------*/
00008 
00009 #ifndef _fei_Vector_hpp_
00010 #define _fei_Vector_hpp_
00011 
00012 #include <fei_iosfwd.hpp>
00013 #include <fei_SharedPtr.hpp>
00014 #include <fei_Reducer.hpp>
00015 
00016 namespace fei {
00057   class Vector {
00058   public:
00060     class Factory {
00061     public:
00063       virtual ~Factory(){}
00064 
00066       virtual fei::SharedPtr<fei::Vector>
00067   createVector(fei::SharedPtr<fei::VectorSpace> vecSpace,
00068          int numVectors=1) = 0;
00069 
00071       virtual fei::SharedPtr<fei::Vector>
00072   createVector(fei::SharedPtr<fei::VectorSpace> vecSpace,
00073          bool isSolutionVector,
00074          int numVectors=1) = 0;
00075 
00077       virtual fei::SharedPtr<fei::Vector>
00078   createVector(fei::SharedPtr<fei::MatrixGraph> matrixGraph,
00079          int numVectors=1) = 0;
00080 
00082       virtual fei::SharedPtr<fei::Vector>
00083   createVector(fei::SharedPtr<fei::MatrixGraph> matrixGraph,
00084          bool isSolutionVector,
00085          int numVectors=1) = 0;
00086     };
00087 
00089     virtual ~Vector(){}
00090 
00094     virtual const char* typeName() const = 0;
00095 
00097     virtual int putScalar(double scalar) = 0;
00098 
00102     virtual int sumIn(int numValues, const int* indices, const double* values,
00103           int vectorIndex=0) = 0;
00104 
00108     virtual int copyIn(int numValues, const int* indices, const double* values,
00109            int vectorIndex=0) = 0;
00110 
00116     virtual int copyOut(int numValues, const int* indices, double* values,
00117       int vectorIndex=0) const = 0;
00118 
00121     virtual int update(double a,
00122            const fei::Vector* x,
00123            double b) = 0;
00124 
00129     virtual int scatterToOverlap() = 0;
00130 
00136     virtual void setCommSizes() = 0;
00137 
00141     virtual int gatherFromOverlap(bool accumulate = true) = 0;
00142 
00144     virtual fei::SharedPtr<fei::VectorSpace> getVectorSpace() const = 0;
00145 
00147     virtual void setVectorSpace(fei::SharedPtr<fei::VectorSpace> vecSpace) = 0;
00148 
00155     virtual int sumInFieldData(int fieldID,
00156              int idType,
00157              int numIDs,
00158              const int* IDs,
00159              const double* data,
00160              int vectorIndex=0) = 0;
00161 
00168     virtual int copyInFieldData(int fieldID,
00169         int idType,
00170         int numIDs,
00171         const int* IDs,
00172         const double* data,
00173         int vectorIndex=0) = 0;
00174 
00175     virtual int copyInFieldDataLocalIDs(int fieldID,
00176         int idType,
00177         int numIDs,
00178         const int* localIDs,
00179         const double* data,
00180         int vectorIndex=0) = 0;
00181 
00187     virtual int copyOutFieldData(int fieldID,
00188          int idType,
00189          int numIDs,
00190          const int* IDs,
00191          double* data,
00192          int vectorIndex=0) = 0;
00193 
00207     virtual int writeToFile(const char* filename,
00208           bool matrixMarketFormat=true) = 0;
00209 
00221     virtual int writeToStream(FEI_OSTREAM& ostrm,
00222             bool matrixMarketFormat=true) = 0;
00223 
00224   };//class Vector
00225 }//namespace fei
00226 
00227 #ifndef _fei_ostream_ops_hpp_
00228 #include <fei_ostream_ops.hpp>
00229 #endif
00230 
00231 #endif // _fei_Vector_hpp_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends