Epetra Package Browser (Single Doxygen Collection) Development
Epetra_FEVector.h
Go to the documentation of this file.
00001 /*
00002 //@HEADER
00003 // ************************************************************************
00004 // 
00005 //               Epetra: Linear Algebra Services Package 
00006 //                 Copyright 2011 Sandia Corporation
00007 // 
00008 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00009 // the U.S. Government retains certain rights in this software.
00010 //
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are
00013 // met:
00014 //
00015 // 1. Redistributions of source code must retain the above copyright
00016 // notice, this list of conditions and the following disclaimer.
00017 //
00018 // 2. Redistributions in binary form must reproduce the above copyright
00019 // notice, this list of conditions and the following disclaimer in the
00020 // documentation and/or other materials provided with the distribution.
00021 //
00022 // 3. Neither the name of the Corporation nor the names of the
00023 // contributors may be used to endorse or promote products derived from
00024 // this software without specific prior written permission.
00025 //
00026 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00027 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00029 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00030 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00031 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00032 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00033 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00034 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00035 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00036 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 //
00038 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00039 // 
00040 // ************************************************************************
00041 //@HEADER
00042 */
00043 
00044 #ifndef EPETRA_FEVECTOR_H
00045 #define EPETRA_FEVECTOR_H
00046 
00047 #include <Epetra_CombineMode.h>
00048 #include <Epetra_Map.h>
00049 #include <Epetra_MultiVector.h>
00050 
00051 #include <vector>
00052 
00053 class Epetra_IntSerialDenseVector;
00054 class Epetra_SerialDenseVector;
00055 
00071 class EPETRA_LIB_DLL_EXPORT Epetra_FEVector : public Epetra_MultiVector {
00072  public:
00088    Epetra_FEVector(const Epetra_BlockMap& Map,
00089                    int numVectors=1,
00090        bool ignoreNonLocalEntries=false);
00091 
00093 
00112   Epetra_FEVector(Epetra_DataAccess CV, const Epetra_BlockMap& Map, 
00113          double *A, int MyLDA, int NumVectors,
00114         bool ignoreNonLocalEntries=false);
00115   
00117 
00132   Epetra_FEVector(Epetra_DataAccess CV, const Epetra_BlockMap& Map, 
00133          double **ArrayOfPointers, int NumVectors,
00134             bool ignoreNonLocalEntries=false);
00135 
00137   Epetra_FEVector(const Epetra_FEVector& source);
00138 
00140    virtual ~Epetra_FEVector();
00141 
00145    int SumIntoGlobalValues(int numIDs,
00146                            const int* GIDs, const double* values,
00147                            int vectorIndex=0);
00148 
00158    int SumIntoGlobalValues(const Epetra_IntSerialDenseVector& GIDs,
00159          const Epetra_SerialDenseVector& values,
00160                            int vectorIndex=0);
00161 
00165    int ReplaceGlobalValues(int numIDs, const int* GIDs, const double* values,
00166                            int vectorIndex=0);
00167 
00177    int ReplaceGlobalValues(const Epetra_IntSerialDenseVector& GIDs,
00178          const Epetra_SerialDenseVector& values,
00179                            int vectorIndex=0);
00180 
00181    int SumIntoGlobalValues(int numIDs,
00182                            const int* GIDs,
00183          const int* numValuesPerID,
00184          const double* values,
00185                            int vectorIndex=0);
00186 
00187    int ReplaceGlobalValues(int numIDs, const int* GIDs,
00188          const int* numValuesPerID,
00189          const double* values,
00190                            int vectorIndex=0);
00191 
00209    int GlobalAssemble(Epetra_CombineMode mode = Add,
00210                       bool reuse_map_and_exporter = false);
00211 
00214    void setIgnoreNonLocalEntries(bool flag) {
00215      ignoreNonLocalEntries_ = flag;
00216    }
00217 
00218    Epetra_FEVector& operator=(const Epetra_FEVector& source);
00219 
00220  protected:
00221   int inputValues(int numIDs,
00222                   const int* GIDs, const double* values,
00223                   bool suminto,
00224                   int vectorIndex);
00225 
00226   int inputValues(int numIDs,
00227                   const int* GIDs, const int* numValuesPerID,
00228       const double* values,
00229                   bool suminto,
00230                   int vectorIndex);
00231 
00232   int inputNonlocalValue(int GID, double value, bool suminto,
00233                          int vectorIndex);
00234 
00235   int inputNonlocalValues(int GID, int numValues, const double* values,
00236         bool suminto, int vectorIndex);
00237 
00239   void createNonlocalMapAndExporter();
00240 
00242   void destroyNonlocalMapAndExporter();
00243 
00245   void zeroNonlocalData();
00246 
00251   void destroyNonlocalData();
00252 
00253   int myFirstID_;
00254   int myNumIDs_;
00255 
00256   std::vector<int> nonlocalIDs_;
00257   std::vector<int> nonlocalElementSize_;
00258 
00270   std::vector<std::vector<double> > nonlocalCoefs_;
00271 
00273   Epetra_BlockMap* nonlocalMap_;
00274 
00276   Epetra_Export* exporter_;
00277 
00279   Epetra_MultiVector* nonlocalVector_;
00280 
00281   bool ignoreNonLocalEntries_;
00282 };
00283 
00284 #endif
00285 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines