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 
00044     int gatherFromOverlap(bool accumulate = true);
00045 
00047     int putScalar(double scalar);
00048 
00052     int sumIn(int numValues, const int* indices, const double* values,
00053               int vectorIndex=0);
00054 
00058     int copyIn(int numValues, const int* indices, const double* values,
00059                int vectorIndex=0);
00060 
00063     fei::SharedPtr<fei::VectorSpace> getVectorSpace() const;
00064 
00067     void setVectorSpace(fei::SharedPtr<fei::VectorSpace> vecSpace);
00068 
00075     int sumInFieldData(int fieldID,
00076                        int idType,
00077                        int numIDs,
00078                        const int* IDs,
00079                        const double* data,
00080                        int vectorIndex=0);
00081 
00088     int copyInFieldData(int fieldID,
00089                         int idType,
00090                         int numIDs,
00091                         const int* IDs,
00092                         const double* data,
00093                         int vectorIndex=0);
00094 
00101     int copyOutFieldData(int fieldID,
00102                          int idType,
00103                          int numIDs,
00104                          const int* IDs,
00105                          double* data,
00106                          int vectorIndex=0);
00107 
00108     int copyOut(int numValues, const int* indices,
00109                 double* values, int vectorIndex=0) const;
00110 
00111     int writeToFile(const char* filename,
00112                     bool matrixMarketFormat=true);
00113 
00114     int writeToStream(FEI_OSTREAM& ostrm,
00115                       bool matrixMarketFormat=true);
00116 
00117     std::vector<double>& getCoefs();
00118 
00119  private:
00120   int giveToVector(int numValues, const int* indices,
00121                            const double* values,
00122                            bool sumInto, int vectorIndex);
00123 
00124   int assembleFieldData(int fieldID,
00125                        int idType,
00126                        int numIDs,
00127                        const int* IDs,
00128                        const double* data,
00129                        bool sumInto,
00130                        int vectorIndex);
00131 
00132   fei::SharedPtr<fei::VectorSpace> vecSpace_;
00133   std::vector<double> coefs_;
00134   std::map<int,int> global_to_local_;
00135   std::vector<int> work_indices_;
00136 };//class Vector_Local
00137 
00138 }//namespace fei
00139 
00140 #endif
00141 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends
Generated on Wed Apr 13 10:08:24 2011 for FEI by  doxygen 1.6.3