FEI Version of the Day
fei_Vector.hpp
00001 /*
00002 // @HEADER
00003 // ************************************************************************
00004 //             FEI: Finite Element Interface to Linear Solvers
00005 //                  Copyright (2005) Sandia Corporation.
00006 //
00007 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the
00008 // U.S. Government retains certain rights in this software.
00009 //
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Alan Williams (william@sandia.gov) 
00038 //
00039 // ************************************************************************
00040 // @HEADER
00041 */
00042 
00043 
00044 #ifndef _fei_Vector_hpp_
00045 #define _fei_Vector_hpp_
00046 
00047 #include <fei_iosfwd.hpp>
00048 #include <fei_SharedPtr.hpp>
00049 #include <fei_Reducer.hpp>
00050 
00051 namespace fei {
00092   class Vector {
00093   public:
00095     class Factory {
00096     public:
00098       virtual ~Factory(){}
00099 
00101       virtual fei::SharedPtr<fei::Vector>
00102   createVector(fei::SharedPtr<fei::VectorSpace> vecSpace,
00103          int numVectors=1) = 0;
00104 
00106       virtual fei::SharedPtr<fei::Vector>
00107   createVector(fei::SharedPtr<fei::VectorSpace> vecSpace,
00108          bool isSolutionVector,
00109          int numVectors=1) = 0;
00110 
00112       virtual fei::SharedPtr<fei::Vector>
00113   createVector(fei::SharedPtr<fei::MatrixGraph> matrixGraph,
00114          int numVectors=1) = 0;
00115 
00117       virtual fei::SharedPtr<fei::Vector>
00118   createVector(fei::SharedPtr<fei::MatrixGraph> matrixGraph,
00119          bool isSolutionVector,
00120          int numVectors=1) = 0;
00121     };
00122 
00124     virtual ~Vector(){}
00125 
00129     virtual const char* typeName() const = 0;
00130 
00132     virtual int putScalar(double scalar) = 0;
00133 
00137     virtual int sumIn(int numValues, const int* indices, const double* values,
00138           int vectorIndex=0) = 0;
00139 
00143     virtual int copyIn(int numValues, const int* indices, const double* values,
00144            int vectorIndex=0) = 0;
00145 
00151     virtual int copyOut(int numValues, const int* indices, double* values,
00152       int vectorIndex=0) const = 0;
00153 
00156     virtual int update(double a,
00157            const fei::Vector* x,
00158            double b) = 0;
00159 
00164     virtual int scatterToOverlap() = 0;
00165 
00171     virtual void setCommSizes() = 0;
00172 
00176     virtual int gatherFromOverlap(bool accumulate = true) = 0;
00177 
00179     virtual fei::SharedPtr<fei::VectorSpace> getVectorSpace() const = 0;
00180 
00182     virtual void setVectorSpace(fei::SharedPtr<fei::VectorSpace> vecSpace) = 0;
00183 
00190     virtual int sumInFieldData(int fieldID,
00191              int idType,
00192              int numIDs,
00193              const int* IDs,
00194              const double* data,
00195              int vectorIndex=0) = 0;
00196 
00203     virtual int copyInFieldData(int fieldID,
00204         int idType,
00205         int numIDs,
00206         const int* IDs,
00207         const double* data,
00208         int vectorIndex=0) = 0;
00209 
00210     virtual int copyInFieldDataLocalIDs(int fieldID,
00211         int idType,
00212         int numIDs,
00213         const int* localIDs,
00214         const double* data,
00215         int vectorIndex=0) = 0;
00216 
00222     virtual int copyOutFieldData(int fieldID,
00223          int idType,
00224          int numIDs,
00225          const int* IDs,
00226          double* data,
00227          int vectorIndex=0) = 0;
00228 
00242     virtual int writeToFile(const char* filename,
00243           bool matrixMarketFormat=true) = 0;
00244 
00256     virtual int writeToStream(FEI_OSTREAM& ostrm,
00257             bool matrixMarketFormat=true) = 0;
00258 
00259   };//class Vector
00260 }//namespace fei
00261 
00262 #ifndef _fei_ostream_ops_hpp_
00263 #include <fei_ostream_ops.hpp>
00264 #endif
00265 
00266 #endif // _fei_Vector_hpp_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends