FEI Version of the Day
fei_Vector_Local.hpp
00001 /*--------------------------------------------------------------------*/
00002 /*    Copyright 2007 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_Local_hpp_
00010 #define _fei_Vector_Local_hpp_
00011 
00012 #include <fei_iosfwd.hpp>
00013 #include <fei_SharedPtr.hpp>
00014 #include <fei_VectorSpace.hpp>
00015 #include <fei_Vector.hpp>
00016 
00017 namespace fei {
00018 
00019 class Vector_Local : public fei::Vector {
00020  public:
00021   Vector_Local(fei::SharedPtr<fei::VectorSpace> vecSpace);
00022 
00023   virtual ~Vector_Local();
00024 
00025   const char* typeName() const { return("fei::Vector_Local"); }
00026 
00029     int update(double a,
00030                const fei::Vector* x,
00031                double b);
00032 
00039     int scatterToOverlap();
00040 
00041     void setCommSizes();
00042 
00046     int gatherFromOverlap(bool accumulate = true);
00047 
00049     int putScalar(double scalar);
00050 
00054     int sumIn(int numValues, const int* indices, const double* values,
00055               int vectorIndex=0);
00056 
00060     int copyIn(int numValues, const int* indices, const double* values,
00061                int vectorIndex=0);
00062 
00065     fei::SharedPtr<fei::VectorSpace> getVectorSpace() const;
00066 
00069     void setVectorSpace(fei::SharedPtr<fei::VectorSpace> vecSpace);
00070 
00077     int sumInFieldData(int fieldID,
00078                        int idType,
00079                        int numIDs,
00080                        const int* IDs,
00081                        const double* data,
00082                        int vectorIndex=0);
00083 
00090     int copyInFieldData(int fieldID,
00091                         int idType,
00092                         int numIDs,
00093                         const int* IDs,
00094                         const double* data,
00095                         int vectorIndex=0);
00096 
00097     int copyInFieldDataLocalIDs(int fieldID,
00098                         int idType,
00099                         int numIDs,
00100                         const int* localIDs,
00101                         const double* data,
00102                         int vectorIndex=0);
00103 
00110     int copyOutFieldData(int fieldID,
00111                          int idType,
00112                          int numIDs,
00113                          const int* IDs,
00114                          double* data,
00115                          int vectorIndex=0);
00116 
00117     int copyOut(int numValues, const int* indices,
00118                 double* values, int vectorIndex=0) const;
00119 
00120     int writeToFile(const char* filename,
00121                     bool matrixMarketFormat=true);
00122 
00123     int writeToStream(FEI_OSTREAM& ostrm,
00124                       bool matrixMarketFormat=true);
00125 
00126     std::vector<double>& getCoefs();
00127 
00128  private:
00129   int giveToVector(int numValues, const int* indices,
00130                            const double* values,
00131                            bool sumInto, int vectorIndex);
00132 
00133   int assembleFieldData(int fieldID,
00134                        int idType,
00135                        int numIDs,
00136                        const int* IDs,
00137                        const double* data,
00138                        bool sumInto,
00139                        int vectorIndex);
00140 
00141   int assembleFieldDataLocalIDs(int fieldID,
00142                        int idType,
00143                        int numIDs,
00144                        const int* localIDs,
00145                        const double* data,
00146                        bool sumInto,
00147                        int vectorIndex);
00148 
00149   fei::SharedPtr<fei::VectorSpace> vecSpace_;
00150   std::vector<double> coefs_;
00151   std::map<int,int> global_to_local_;
00152   std::vector<int> work_indices_;
00153 };//class Vector_Local
00154 
00155 }//namespace fei
00156 
00157 #endif
00158 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends