FEI  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fei_Vector.hpp
1 /*--------------------------------------------------------------------*/
2 /* Copyright 2005 Sandia Corporation. */
3 /* Under the terms of Contract DE-AC04-94AL85000, there is a */
4 /* non-exclusive license for use of this work by or on behalf */
5 /* of the U.S. Government. Export of this program may require */
6 /* a license from the United States Government. */
7 /*--------------------------------------------------------------------*/
8 
9 #ifndef _fei_Vector_hpp_
10 #define _fei_Vector_hpp_
11 
12 #include <fei_iosfwd.hpp>
13 #include <fei_SharedPtr.hpp>
14 #include <fei_Reducer.hpp>
15 
16 namespace fei {
57  class Vector {
58  public:
60  class Factory {
61  public:
63  virtual ~Factory(){}
64 
67  createVector(fei::SharedPtr<fei::VectorSpace> vecSpace,
68  int numVectors=1) = 0;
69 
72  createVector(fei::SharedPtr<fei::VectorSpace> vecSpace,
73  bool isSolutionVector,
74  int numVectors=1) = 0;
75 
78  createVector(fei::SharedPtr<fei::MatrixGraph> matrixGraph,
79  int numVectors=1) = 0;
80 
83  createVector(fei::SharedPtr<fei::MatrixGraph> matrixGraph,
84  bool isSolutionVector,
85  int numVectors=1) = 0;
86  };
87 
89  virtual ~Vector(){}
90 
94  virtual const char* typeName() const = 0;
95 
97  virtual int putScalar(double scalar) = 0;
98 
102  virtual int sumIn(int numValues, const int* indices, const double* values,
103  int vectorIndex=0) = 0;
104 
108  virtual int copyIn(int numValues, const int* indices, const double* values,
109  int vectorIndex=0) = 0;
110 
116  virtual int copyOut(int numValues, const int* indices, double* values,
117  int vectorIndex=0) const = 0;
118 
121  virtual int update(double a,
122  const fei::Vector* x,
123  double b) = 0;
124 
129  virtual int scatterToOverlap() = 0;
130 
136  virtual void setCommSizes() = 0;
137 
141  virtual int gatherFromOverlap(bool accumulate = true) = 0;
142 
145 
147  virtual void setVectorSpace(fei::SharedPtr<fei::VectorSpace> vecSpace) = 0;
148 
155  virtual int sumInFieldData(int fieldID,
156  int idType,
157  int numIDs,
158  const int* IDs,
159  const double* data,
160  int vectorIndex=0) = 0;
161 
168  virtual int copyInFieldData(int fieldID,
169  int idType,
170  int numIDs,
171  const int* IDs,
172  const double* data,
173  int vectorIndex=0) = 0;
174 
175  virtual int copyInFieldDataLocalIDs(int fieldID,
176  int idType,
177  int numIDs,
178  const int* localIDs,
179  const double* data,
180  int vectorIndex=0) = 0;
181 
187  virtual int copyOutFieldData(int fieldID,
188  int idType,
189  int numIDs,
190  const int* IDs,
191  double* data,
192  int vectorIndex=0) = 0;
193 
207  virtual int writeToFile(const char* filename,
208  bool matrixMarketFormat=true) = 0;
209 
221  virtual int writeToStream(FEI_OSTREAM& ostrm,
222  bool matrixMarketFormat=true) = 0;
223 
224  };//class Vector
225 }//namespace fei
226 
227 #ifndef _fei_ostream_ops_hpp_
228 #include <fei_ostream_ops.hpp>
229 #endif
230 
231 #endif // _fei_Vector_hpp_
virtual int writeToFile(const char *filename, bool matrixMarketFormat=true)=0
virtual fei::SharedPtr< fei::VectorSpace > getVectorSpace() const =0
virtual int copyIn(int numValues, const int *indices, const double *values, int vectorIndex=0)=0
virtual int copyOutFieldData(int fieldID, int idType, int numIDs, const int *IDs, double *data, int vectorIndex=0)=0
virtual int gatherFromOverlap(bool accumulate=true)=0
virtual void setVectorSpace(fei::SharedPtr< fei::VectorSpace > vecSpace)=0
virtual int scatterToOverlap()=0
virtual int putScalar(double scalar)=0
virtual int update(double a, const fei::Vector *x, double b)=0
virtual int sumIn(int numValues, const int *indices, const double *values, int vectorIndex=0)=0
virtual ~Vector()
virtual int copyInFieldData(int fieldID, int idType, int numIDs, const int *IDs, const double *data, int vectorIndex=0)=0
virtual const char * typeName() const =0
virtual void setCommSizes()=0
virtual int copyOut(int numValues, const int *indices, double *values, int vectorIndex=0) const =0
virtual int writeToStream(FEI_OSTREAM &ostrm, bool matrixMarketFormat=true)=0
virtual int sumInFieldData(int fieldID, int idType, int numIDs, const int *IDs, const double *data, int vectorIndex=0)=0