Epetra Package Browser (Single Doxygen Collection) Development
Epetra_IntVector.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_INTVECTOR_H
00045 #define EPETRA_INTVECTOR_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 
00054 
00123 //=========================================================================
00124 class EPETRA_LIB_DLL_EXPORT Epetra_IntVector : public Epetra_DistObject {
00125 
00126   public:
00127 
00129 
00130 
00131 
00147   Epetra_IntVector(const Epetra_BlockMap& Map, bool zeroOut = true);
00148 
00150 
00151   Epetra_IntVector(const Epetra_IntVector& Source);
00152 
00154 
00166   Epetra_IntVector(Epetra_DataAccess CV, const Epetra_BlockMap& Map, int *V);
00167 
00169   virtual ~Epetra_IntVector ();
00171 
00172 
00174 
00175 
00176   int PutValue(int Value);
00178 
00179 
00181 
00182 
00183 
00185 
00191   int ExtractCopy(int *V) const;
00192 
00194 
00200   int ExtractView(int **V) const;
00202 
00204 
00205 
00206 
00209   int MaxValue();
00210 
00212 
00215   int MinValue();
00216 
00218 
00220 
00221 
00223 
00229   Epetra_IntVector& operator = (const Epetra_IntVector& Source);
00230 
00232 
00235     int& operator [] (int index) { return Values_[index]; }
00237 
00240     const int& operator [] (int index) const { return Values_[index]; }
00242 
00244 
00245 
00247   int * Values() const {return(Values_);};
00248 
00250   int MyLength() const {return(Map().NumMyPoints());};
00251 
00253 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00254   int GlobalLength() const {return (Map().NumGlobalPoints());};
00255 #endif
00256 
00257   long long GlobalLength64() const {return (Map().NumGlobalPoints64());};
00259 
00261 
00262 
00264   virtual void Print(std::ostream & os) const;
00266  private:
00267 
00268   int AllocateForCopy();
00269   int DoCopy(int * V);
00270   int AllocateForView();
00271   int DoView(int * V);
00272 
00273    // Routines to implement Epetra_DistObject virtual methods
00274   int CheckSizes(const Epetra_SrcDistObject& A);
00275 
00276   int CopyAndPermute(const Epetra_SrcDistObject & Source,
00277                      int NumSameIDs,
00278                      int NumPermuteIDs,
00279                      int * PermuteToLIDs,
00280                      int * PermuteFromLIDs,
00281                      const Epetra_OffsetIndex * Indexor);
00282 
00283   int PackAndPrepare(const Epetra_SrcDistObject & Source,
00284                      int NumExportIDs,
00285                      int * ExportLIDs,
00286                      int & LenExports,
00287                      char * & Exports,
00288                      int & SizeOfPacket,
00289                      int * Sizes,
00290                      bool& VarSizes,
00291                      Epetra_Distributor & Distor);
00292 
00293   int UnpackAndCombine(const Epetra_SrcDistObject & Source,
00294                        int NumImportIDs,
00295                        int * ImportLIDs,
00296                        int LenImports,
00297                        char * Imports,
00298                        int & SizeOfPacket,
00299                        Epetra_Distributor & Distor,
00300                        Epetra_CombineMode CombineMode,
00301                        const Epetra_OffsetIndex * Indexor);
00302 
00303   int * Values_;
00304   bool UserAllocated_;
00305   bool Allocated_;
00306 };
00307 
00308 #endif /* EPETRA_INTVECTOR_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines