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_ConfigDefs.h>
00048 #include <Epetra_CombineMode.h>
00049 #include <Epetra_Map.h>
00050 #include <Epetra_MultiVector.h>
00051 
00052 #include <vector>
00053 
00054 class Epetra_IntSerialDenseVector;
00055 
00056 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
00057 class Epetra_LongLongSerialDenseVector;
00058 #endif
00059 
00060 class Epetra_SerialDenseVector;
00061 
00062 
00078 class EPETRA_LIB_DLL_EXPORT Epetra_FEVector : public Epetra_MultiVector {
00079  public:
00095    Epetra_FEVector(const Epetra_BlockMap& Map,
00096                    int numVectors=1,
00097        bool ignoreNonLocalEntries=false);
00098 
00100 
00119   Epetra_FEVector(Epetra_DataAccess CV, const Epetra_BlockMap& Map,
00120          double *A, int MyLDA, int NumVectors,
00121         bool ignoreNonLocalEntries=false);
00122 
00124 
00139   Epetra_FEVector(Epetra_DataAccess CV, const Epetra_BlockMap& Map,
00140          double **ArrayOfPointers, int NumVectors,
00141             bool ignoreNonLocalEntries=false);
00142 
00144   Epetra_FEVector(const Epetra_FEVector& source);
00145 
00147    virtual ~Epetra_FEVector();
00148 
00152 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00153    int SumIntoGlobalValues(int numIDs,
00154                            const int* GIDs, const double* values,
00155                            int vectorIndex=0);
00156 #endif
00157 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
00158    int SumIntoGlobalValues(int numIDs,
00159                            const long long* GIDs, const double* values,
00160                            int vectorIndex=0);
00161 #endif
00162 
00172    int SumIntoGlobalValues(const Epetra_IntSerialDenseVector& GIDs,
00173          const Epetra_SerialDenseVector& values,
00174                            int vectorIndex=0);
00175 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
00176    int SumIntoGlobalValues(const Epetra_LongLongSerialDenseVector& GIDs,
00177          const Epetra_SerialDenseVector& values,
00178                            int vectorIndex=0);
00179 #endif
00180 
00184 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00185    int ReplaceGlobalValues(int numIDs, const int* GIDs, const double* values,
00186                            int vectorIndex=0);
00187 #endif
00188 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
00189    int ReplaceGlobalValues(int numIDs, const long long* GIDs, const double* values,
00190                            int vectorIndex=0);
00191 #endif
00192 
00202    int ReplaceGlobalValues(const Epetra_IntSerialDenseVector& GIDs,
00203          const Epetra_SerialDenseVector& values,
00204                            int vectorIndex=0);
00205 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
00206    int ReplaceGlobalValues(const Epetra_LongLongSerialDenseVector& GIDs,
00207          const Epetra_SerialDenseVector& values,
00208                            int vectorIndex=0);
00209 #endif
00210 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00211    int SumIntoGlobalValues(int numIDs,
00212                            const int* GIDs,
00213          const int* numValuesPerID,
00214          const double* values,
00215                            int vectorIndex=0);
00216 #endif
00217 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
00218    int SumIntoGlobalValues(int numIDs,
00219                            const long long* GIDs,
00220          const int* numValuesPerID,
00221          const double* values,
00222                            int vectorIndex=0);
00223 #endif
00224 
00225 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00226    int ReplaceGlobalValues(int numIDs, const int* GIDs,
00227          const int* numValuesPerID,
00228          const double* values,
00229                            int vectorIndex=0);
00230 #endif
00231 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
00232    int ReplaceGlobalValues(int numIDs, const long long* GIDs,
00233          const int* numValuesPerID,
00234          const double* values,
00235                            int vectorIndex=0);
00236 #endif
00237 
00255    int GlobalAssemble(Epetra_CombineMode mode = Add,
00256                       bool reuse_map_and_exporter = false);
00257 
00260    void setIgnoreNonLocalEntries(bool flag) {
00261      ignoreNonLocalEntries_ = flag;
00262    }
00263 
00264    Epetra_FEVector& operator=(const Epetra_FEVector& source);
00265 
00266  protected:
00267   template<typename int_type>
00268   int inputValues(int numIDs,
00269                   const int_type* GIDs, const double* values,
00270                   bool suminto,
00271                   int vectorIndex);
00272 
00273   template<typename int_type>
00274   int inputValues(int numIDs,
00275                   const int_type* GIDs, const int* numValuesPerID,
00276       const double* values,
00277                   bool suminto,
00278                   int vectorIndex);
00279 
00280   template<typename int_type>
00281   int inputNonlocalValue(int_type GID, double value, bool suminto,
00282                          int vectorIndex);
00283 
00284   template<typename int_type>
00285   int inputNonlocalValues(int_type GID, int numValues, const double* values,
00286         bool suminto, int vectorIndex);
00287 
00289   template<typename int_type>
00290   void createNonlocalMapAndExporter();
00291 
00293   void destroyNonlocalMapAndExporter();
00294 
00296   template<typename int_type>
00297   void zeroNonlocalData();
00298 
00303   void destroyNonlocalData();
00304 
00305   long long myFirstID_;
00306   int myNumIDs_;
00307 
00308 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00309   std::vector<int> nonlocalIDs_int_;
00310 #endif
00311 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
00312   std::vector<long long> nonlocalIDs_LL_;
00313 #endif
00314 
00315   template<typename int_type> std::vector<int_type>& nonlocalIDs();
00316 
00317   std::vector<int> nonlocalElementSize_;
00318 
00330   std::vector<std::vector<double> > nonlocalCoefs_;
00331 
00333   Epetra_BlockMap* nonlocalMap_;
00334 
00336   Epetra_Export* exporter_;
00337 
00339   Epetra_MultiVector* nonlocalVector_;
00340 
00341   bool ignoreNonLocalEntries_;
00342 
00343 private:
00344   template<typename int_type>
00345   int GlobalAssemble(Epetra_CombineMode mode, bool reuse_map_and_exporter);
00346 };
00347 
00348 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00349 template<> inline std::vector<int>& Epetra_FEVector::nonlocalIDs<int>()
00350 {
00351    return nonlocalIDs_int_;
00352 }
00353 #endif
00354 
00355 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
00356 template<> inline std::vector<long long>& Epetra_FEVector::nonlocalIDs<long long>()
00357 {
00358   return nonlocalIDs_LL_;
00359 }
00360 #endif
00361 
00362 #endif
00363 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines