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_DistObject.h"
00048 #include "Epetra_BlockMap.h"
00049 #include "Epetra_Distributor.h"
00050 class Epetra_Map;
00051 
00053 
00122 //=========================================================================
00123 class EPETRA_LIB_DLL_EXPORT Epetra_IntVector : public Epetra_DistObject {
00124 
00125   public:
00126 
00128 
00129 
00130 
00146   Epetra_IntVector(const Epetra_BlockMap& Map, bool zeroOut = true);
00147 
00149   
00150   Epetra_IntVector(const Epetra_IntVector& Source);
00151   
00153 
00165   Epetra_IntVector(Epetra_DataAccess CV, const Epetra_BlockMap& Map, int *V);
00166 
00168   virtual ~Epetra_IntVector ();
00170   
00171 
00173 
00174 
00175   int PutValue(int Value);
00177   
00178 
00180 
00181 
00182 
00184 
00190   int ExtractCopy(int *V) const;
00191   
00193 
00199   int ExtractView(int **V) const;
00201 
00203 
00204 
00205 
00208   int MaxValue();
00209  
00211 
00214   int MinValue();
00215 
00217   
00219 
00220 
00222 
00228   Epetra_IntVector& operator = (const Epetra_IntVector& Source);
00229   
00231 
00234     int& operator [] (int index) { return Values_[index]; }
00236 
00239     const int& operator [] (int index) const { return Values_[index]; }
00241     
00243 
00244 
00246   int * Values() const {return(Values_);};
00247 
00249   int MyLength() const {return(Map().NumMyPoints());};
00250 
00252   int GlobalLength() const {return(Map().NumGlobalPoints());};
00254 
00256 
00257 
00259   virtual void Print(ostream & os) const;
00261  private:
00262 
00263   int AllocateForCopy();
00264   int DoCopy(int * V);
00265   int AllocateForView();
00266   int DoView(int * V);
00267 
00268    // Routines to implement Epetra_DistObject virtual methods
00269   int CheckSizes(const Epetra_SrcDistObject& A);
00270 
00271   int CopyAndPermute(const Epetra_SrcDistObject & Source,
00272                      int NumSameIDs, 
00273                      int NumPermuteIDs,
00274                      int * PermuteToLIDs,
00275                      int * PermuteFromLIDs,
00276                      const Epetra_OffsetIndex * Indexor);
00277 
00278   int PackAndPrepare(const Epetra_SrcDistObject & Source,
00279                      int NumExportIDs,
00280                      int * ExportLIDs,
00281                      int & LenExports,
00282                      char * & Exports,
00283                      int & SizeOfPacket,
00284                      int * Sizes,
00285                      bool& VarSizes,
00286                      Epetra_Distributor & Distor);
00287   
00288   int UnpackAndCombine(const Epetra_SrcDistObject & Source,
00289                        int NumImportIDs,
00290                        int * ImportLIDs, 
00291                        int LenImports, 
00292                        char * Imports,
00293                        int & SizeOfPacket, 
00294                        Epetra_Distributor & Distor,
00295                        Epetra_CombineMode CombineMode,
00296                        const Epetra_OffsetIndex * Indexor);
00297 
00298   int * Values_;
00299   bool UserAllocated_;
00300   bool Allocated_;
00301 };
00302 
00303 #endif /* EPETRA_INTVECTOR_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines