fei_VectorReducer.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_VectorReducer_hpp_
00010 #define _fei_VectorReducer_hpp_
00011 
00012 #include <fei_iosfwd.hpp>
00013 #include <fei_VectorSpace.hpp>
00014 #include <fei_Reducer.hpp>
00015 #include <fei_Vector.hpp>
00016 
00017 #undef fei_file
00018 #define fei_file "fei_VectorReducer.hpp"
00019 
00020 #include <fei_ErrMacros.hpp>
00021 
00022 namespace fei {
00023 
00024   class VectorReducer : public fei::Vector {
00025   public:
00026 
00028     VectorReducer(fei::SharedPtr<fei::Reducer> reducer,
00029                   fei::SharedPtr<fei::Vector> target,
00030             bool isSolutionVector=false);
00031 
00033     virtual ~VectorReducer();
00034 
00036     fei::SharedPtr<fei::Vector> getTargetVector()
00037       { return(target_); }
00038 
00042     const char* typeName() const { return(target_->typeName()); }
00043 
00046     int update(double a,
00047          const fei::Vector* x,
00048          double b);
00049 
00056     int scatterToOverlap();
00057 
00061     int gatherFromOverlap(bool accumulate = true);
00062 
00064     int putScalar(double scalar);
00065 
00069     int sumIn(int numValues, const int* indices, const double* values,
00070         int vectorIndex=0);
00071 
00075     int copyIn(int numValues, const int* indices, const double* values,
00076          int vectorIndex=0);
00077 
00080     fei::SharedPtr<fei::VectorSpace> getVectorSpace() const
00081       { return(target_->getVectorSpace()); }
00082 
00085     void setVectorSpace(fei::SharedPtr<fei::VectorSpace> vecSpace)
00086     { target_->setVectorSpace( vecSpace ); }
00087 
00094     int sumInFieldData(int fieldID,
00095            int idType,
00096            int numIDs,
00097            const int* IDs,
00098            const double* data,
00099            int vectorIndex=0);
00100 
00107     int copyInFieldData(int fieldID,
00108       int idType,
00109       int numIDs,
00110       const int* IDs,
00111       const double* data,
00112       int vectorIndex=0);
00113 
00120     int copyOutFieldData(int fieldID,
00121        int idType,
00122        int numIDs,
00123        const int* IDs,
00124        double* data,
00125        int vectorIndex=0);
00126 
00127     int writeToFile(const char* filename,
00128         bool matrixMarketFormat=true);
00129 
00130     int writeToStream(FEI_OSTREAM& ostrm,
00131           bool matrixMarketFormat=true);
00132 
00133     int copyOut(int numValues,
00134     const int* indices,
00135     double* values,
00136     int vectorIndex=0) const;
00137 
00138   private:
00141     int copyOut_FE(int nodeNumber, int dofOffset, double& value);
00142 
00143     int giveToUnderlyingVector(int numValues,
00144              const int* indices,
00145              const double* values,
00146              bool sumInto=true,
00147              int vectorIndex=0);
00148 
00149     int sumIntoFEVector(int blockID,
00150       int connOffset,
00151       int numNodes,
00152       const int* nodeNumbers,
00153       const int* numIndicesPerNode,
00154       const double* values);
00155 
00156     fei::SharedPtr<fei::Reducer> reducer_;
00157     fei::SharedPtr<fei::Vector> target_;
00158     bool isSolution_;
00159 
00160     int localProc_;
00161     int numProcs_;
00162   };//class VectorReducer
00163 
00164 } //namespace fei
00165 
00166 #endif // _fei_VectorReducer_hpp_
00167 
 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