fei_Vector_core.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_core_hpp_
00010 #define _fei_Vector_core_hpp_
00011 
00012 #include <fei_iosfwd.hpp>
00013 #include <fei_CSVec.hpp>
00014 #include <fei_VectorSpace.hpp>
00015 #include <fei_Reducer.hpp>
00016 #include <fei_Logger.hpp>
00017 #include <fei_SharedPtr.hpp>
00018 #include <fei_EqnComm.hpp>
00019 
00020 namespace fei {
00021 
00023 class Vector_core : protected fei::Logger {
00024  public:
00026   Vector_core(fei::SharedPtr<fei::VectorSpace> vecSpace, int numLocalEqns);
00027 
00029   virtual ~Vector_core();
00030 
00036   int copyOut(int numValues,
00037         const int* indices,
00038         double* values,
00039         int vectorIndex=0) const;
00040 
00042   virtual int sumIntoFEVector(int blockID,
00043             int connOffset,
00044             int numNodes,
00045             const int* nodeNumbers,
00046             const int* numIndicesPerNode,
00047             const double* values) = 0;
00048 
00050   virtual int copyOut_FE(int nodeNumber, int dofOffset, double& value) = 0;
00051 
00053   int giveToVector(int numValues,
00054        const int* indices,
00055        const double* values,
00056        bool sumInto=true,
00057        int vectorIndex=0);
00058 
00060   virtual int scatterToOverlap();
00061 
00065   void setOverlap(int numRemoteEqns=0, const int* remoteEqns=NULL);
00066 
00067  protected:
00069   int assembleFieldData(int fieldID,
00070       int idType,
00071       int numIDs,
00072       const int* IDs,
00073       const double* data,
00074       bool sumInto=true,
00075       int vectorIndex=0);
00076 
00078   virtual int gatherFromOverlap(bool accumulate = true);
00079 
00081   virtual int copyOutFieldData(int fieldID,
00082              int idType,
00083              int numIDs,
00084              const int* IDs,
00085              double* data,
00086              int vectorIndex=0);
00087 
00089   virtual int giveToUnderlyingVector(int numValues,
00090              const int* indices,
00091              const double* values,
00092              bool sumInto=true,
00093              int vectorIndex=0) = 0;
00094 
00096   virtual int copyOutOfUnderlyingVector(int numValues,
00097           const int* indices,
00098           double* values,
00099           int vectorIndex=0) const = 0;
00100 
00103   virtual int writeToFile(const char* filename,
00104         bool matrixMarketFormat=true);
00105 
00107   virtual int writeToStream(FEI_OSTREAM& ostrm,
00108           bool matrixMarketFormat=true);
00109 
00111   fei::SharedPtr<fei::VectorSpace> get_vector_space()
00112     {
00113       return( vecSpace_ );
00114     }
00115 
00117   void set_vector_space(fei::SharedPtr<fei::VectorSpace> vspace)
00118     {
00119       vecSpace_ = vspace;
00120     }
00121 
00123   int firstLocalOffset() const { return( firstLocalOffset_ ); }
00124 
00126   int lastLocalOffset() const { return( lastLocalOffset_ ); }
00127 
00129   std::vector<int>& work_indices() { return( work_indices_ ); }
00131   std::vector<int>& work_indices2(){ return( work_indices2_); }
00132 
00134   bool haveFEVector() { return( haveFEVector_ ); }
00136   void setFEVector(bool flag) {haveFEVector_ = flag; }
00137 
00139   std::vector<CSVec*>& remotelyOwned() { return( remotelyOwned_ ); }
00140   const std::vector<CSVec*>& remotelyOwned() const { return( remotelyOwned_ ); }
00141 
00142  protected:
00143   fei::SharedPtr<fei::EqnComm> eqnComm_;
00144 
00145  private:
00146   fei::SharedPtr<fei::VectorSpace> vecSpace_;
00147 
00148   MPI_Comm comm_;
00149 
00150   int firstLocalOffset_, lastLocalOffset_, numLocal_;
00151 
00152   std::vector<int> work_indices_;
00153   std::vector<int> work_indices2_;
00154 
00155   bool haveFEVector_;
00156 
00157   std::vector<CSVec*> remotelyOwned_;
00158 
00159   bool overlapAlreadySet_;
00160   std::string dbgprefix_;
00161 };//class Vector_core
00162 
00163 }//namespace fei
00164 
00165 #endif
00166 

Generated on Wed May 12 21:30:41 2010 for FEI by  doxygen 1.4.7