Epetra Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Epetra_LongLongVector.h
Go to the documentation of this file.
1 /*
2 //@HEADER
3 // ************************************************************************
4 //
5 // Epetra: Linear Algebra Services Package
6 // Copyright 2011 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
39 //
40 // ************************************************************************
41 //@HEADER
42 */
43 
44 #ifndef EPETRA_LONGLONGVECTOR_H
45 #define EPETRA_LONGLONGVECTOR_H
46 
47 #if defined(Epetra_SHOW_DEPRECATED_WARNINGS)
48 #ifdef __GNUC__
49 #warning "The Epetra package is deprecated"
50 #endif
51 #endif
52 
53 
54 
55 #include "Epetra_ConfigDefs.h"
56 #include "Epetra_DistObject.h"
57 #include "Epetra_BlockMap.h"
58 #include "Epetra_Distributor.h"
59 class Epetra_Map;
60 
61 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
62 
64 
133 //=========================================================================
134 class EPETRA_LIB_DLL_EXPORT Epetra_LongLongVector : public Epetra_DistObject {
135 
136  public:
137 
139 
140 
157  Epetra_LongLongVector(const Epetra_BlockMap& Map, bool zeroOut = true);
158 
160 
162 
164 
176  Epetra_LongLongVector(Epetra_DataAccess CV, const Epetra_BlockMap& Map, long long *V);
177 
179  virtual ~Epetra_LongLongVector ();
181 
182 
184 
185  int PutValue(long long Value);
188 
189 
191 
192 
193 
195 
201  int ExtractCopy(long long *V) const;
202 
204 
210  int ExtractView(long long **V) const;
212 
214 
215 
219  long long MaxValue();
220 
222 
225  long long MinValue();
226 
228 
230 
231 
233 
240 
242 
245  long long& operator [] (int index) { return Values_[index]; }
247 
250  const long long& operator [] (int index) const { return Values_[index]; }
252 
254 
255 
257  long long * Values() const {return(Values_);};
258 
260  int MyLength() const {return(Map().NumMyPoints());};
261 
263  long long GlobalLength64() const {return(Map().NumGlobalPoints64());};
265 
267 
268 
270  virtual void Print(std::ostream & os) const;
272  private:
273 
274  int AllocateForCopy();
275  int DoCopy(long long * V);
276  int AllocateForView();
277  int DoView(long long * V);
278 
279  // Routines to implement Epetra_DistObject virtual methods
280  int CheckSizes(const Epetra_SrcDistObject& A);
281 
282  int CopyAndPermute(const Epetra_SrcDistObject & Source,
283  int NumSameIDs,
284  int NumPermuteIDs,
285  int * PermuteToLIDs,
286  int * PermuteFromLIDs,
287  const Epetra_OffsetIndex * Indexor,
288  Epetra_CombineMode CombineMode = Zero);
289 
290  int PackAndPrepare(const Epetra_SrcDistObject & Source,
291  int NumExportIDs,
292  int * ExportLIDs,
293  int & LenExports,
294  char * & Exports,
295  int & SizeOfPacket,
296  int * Sizes,
297  bool& VarSizes,
298  Epetra_Distributor & Distor);
299 
300  int UnpackAndCombine(const Epetra_SrcDistObject & Source,
301  int NumImportIDs,
302  int * ImportLIDs,
303  int LenImports,
304  char * Imports,
305  int & SizeOfPacket,
306  Epetra_Distributor & Distor,
307  Epetra_CombineMode CombineMode,
308  const Epetra_OffsetIndex * Indexor);
309 
310  long long * Values_;
313 };
314 
315 #endif // EPETRA_NO_64BIT_GLOBAL_INDICES
316 
317 #endif /* EPETRA_LONGLONGVECTOR_H */
Epetra_Map: A class for partitioning vectors and matrices.
Definition: Epetra_Map.h:127
Epetra_LongLongVector: A class for constructing and using dense integer vectors on a parallel compute...
Epetra_Distributor: The Epetra Gather/Scatter Setup Base Class.
virtual int CopyAndPermute(const Epetra_SrcDistObject &Source, int NumSameIDs, int NumPermuteIDs, int *PermuteToLIDs, int *PermuteFromLIDs, const Epetra_OffsetIndex *Indexor, Epetra_CombineMode CombineMode=Zero)=0
Perform ID copies and permutations that are on processor.
Epetra_OffsetIndex: This class builds index for efficient mapping of data from one Epetra_CrsGraph ba...
virtual void Print(std::ostream &os) const
Print method.
virtual int CheckSizes(const Epetra_SrcDistObject &Source)=0
Allows the source and target (this) objects to be compared for compatibility, return nonzero if not...
int MyLength() const
Returns the local vector length on the calling processor of vectors in the multi-vector.
virtual int UnpackAndCombine(const Epetra_SrcDistObject &Source, int NumImportIDs, int *ImportLIDs, int LenImports, char *Imports, int &SizeOfPacket, Epetra_Distributor &Distor, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor)=0
Perform any unpacking and combining after call to DoTransfer().
Epetra_BlockMap: A class for partitioning block element vectors and matrices.
Epetra_DistObject & operator=(const Epetra_DistObject &src)
Epetra_CombineMode
long long GlobalLength64() const
Returns the global vector length of vectors in the multi-vector.
Epetra_SrcDistObject: A class for supporting flexible source distributed objects for import/export op...
Epetra_DataAccess
long long * Values() const
Returns a pointer to an array containing the values of this vector.
Epetra_DistObject: A class for constructing and using dense multi-vectors, vectors and matrices in pa...
virtual int PackAndPrepare(const Epetra_SrcDistObject &Source, int NumExportIDs, int *ExportLIDs, int &LenExports, char *&Exports, int &SizeOfPacket, int *Sizes, bool &VarSizes, Epetra_Distributor &Distor)=0
Perform any packing or preparation required for call to DoTransfer().
const Epetra_BlockMap & Map() const
Returns the address of the Epetra_BlockMap for this multi-vector.