Epetra Package Browser (Single Doxygen Collection) Development
Epetra_LongLongVector.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_LONGLONGVECTOR_H
00045 #define EPETRA_LONGLONGVECTOR_H
00046 
00047 #include "Epetra_ConfigDefs.h"
00048 #include "Epetra_DistObject.h"
00049 #include "Epetra_BlockMap.h"
00050 #include "Epetra_Distributor.h"
00051 class Epetra_Map;
00052 
00053 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
00054 
00056 
00125 //=========================================================================
00126 class EPETRA_LIB_DLL_EXPORT Epetra_LongLongVector : public Epetra_DistObject {
00127 
00128   public:
00129 
00131 
00132 
00133 
00149   Epetra_LongLongVector(const Epetra_BlockMap& Map, bool zeroOut = true);
00150 
00152 
00153   Epetra_LongLongVector(const Epetra_LongLongVector& Source);
00154 
00156 
00168   Epetra_LongLongVector(Epetra_DataAccess CV, const Epetra_BlockMap& Map, long long *V);
00169 
00171   virtual ~Epetra_LongLongVector ();
00173 
00174 
00176 
00177 
00178   int PutValue(long long Value);
00180 
00181 
00183 
00184 
00185 
00187 
00193   int ExtractCopy(long long *V) const;
00194 
00196 
00202   int ExtractView(long long **V) const;
00204 
00206 
00207 
00208 
00211   long long MaxValue();
00212 
00214 
00217   long long MinValue();
00218 
00220 
00222 
00223 
00225 
00231   Epetra_LongLongVector& operator = (const Epetra_LongLongVector& Source);
00232 
00234 
00237     long long& operator [] (int index) { return Values_[index]; }
00239 
00242     const long long& operator [] (int index) const { return Values_[index]; }
00244 
00246 
00247 
00249   long long * Values() const {return(Values_);};
00250 
00252   int MyLength() const {return(Map().NumMyPoints());};
00253 
00255   long long GlobalLength64() const {return(Map().NumGlobalPoints64());};
00257 
00259 
00260 
00262   virtual void Print(std::ostream & os) const;
00264  private:
00265 
00266   int AllocateForCopy();
00267   int DoCopy(long long * V);
00268   int AllocateForView();
00269   int DoView(long long * V);
00270 
00271    // Routines to implement Epetra_DistObject virtual methods
00272   int CheckSizes(const Epetra_SrcDistObject& A);
00273 
00274   int CopyAndPermute(const Epetra_SrcDistObject & Source,
00275                      int NumSameIDs,
00276                      int NumPermuteIDs,
00277                      int * PermuteToLIDs,
00278                      int * PermuteFromLIDs,
00279                      const Epetra_OffsetIndex * Indexor);
00280 
00281   int PackAndPrepare(const Epetra_SrcDistObject & Source,
00282                      int NumExportIDs,
00283                      int * ExportLIDs,
00284                      int & LenExports,
00285                      char * & Exports,
00286                      int & SizeOfPacket,
00287                      int * Sizes,
00288                      bool& VarSizes,
00289                      Epetra_Distributor & Distor);
00290 
00291   int UnpackAndCombine(const Epetra_SrcDistObject & Source,
00292                        int NumImportIDs,
00293                        int * ImportLIDs,
00294                        int LenImports,
00295                        char * Imports,
00296                        int & SizeOfPacket,
00297                        Epetra_Distributor & Distor,
00298                        Epetra_CombineMode CombineMode,
00299                        const Epetra_OffsetIndex * Indexor);
00300 
00301   long long * Values_;
00302   bool UserAllocated_;
00303   bool Allocated_;
00304 };
00305 
00306 #endif // EPETRA_NO_64BIT_GLOBAL_INDICES
00307 
00308 #endif /* EPETRA_LONGLONGVECTOR_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines