Epetra Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Epetra_DistObject.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_DISTOBJECT_H
45 #define EPETRA_DISTOBJECT_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 #include "Epetra_ConfigDefs.h"
55 #include "Epetra_Object.h"
56 #include "Epetra_SrcDistObject.h"
57 #include "Epetra_BlockMap.h"
58 class Epetra_Comm;
59 class Epetra_Import;
60 class Epetra_Export;
61 class Epetra_Distributor;
62 class Epetra_OffsetIndex;
63 
65 
87 //==========================================================================
88 class EPETRA_LIB_DLL_EXPORT Epetra_DistObject: public Epetra_Object, public virtual Epetra_SrcDistObject {
89 
90  public:
92 
93 
107 
122  Epetra_DistObject(const Epetra_BlockMap& Map, const char* const Label);
123 
125 
126  Epetra_DistObject(const Epetra_DistObject& Source);
127 
128 
130  virtual ~Epetra_DistObject();
132 
134 
135 
137 
149  int Import(const Epetra_SrcDistObject& A, const Epetra_Import& Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex * Indexor = 0);
150 
152 
164  int Import(const Epetra_SrcDistObject& A, const Epetra_Export& Exporter, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex * Indexor = 0);
165 
167 
179  int Export(const Epetra_SrcDistObject& A, const Epetra_Import & Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex * Indexor = 0);
180 
182 
194  int Export(const Epetra_SrcDistObject& A, const Epetra_Export& Exporter, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex * Indexor = 0);
196 
198 
199  const Epetra_BlockMap& Map() const {return(Map_);};
201 
203  const Epetra_Comm& Comm() const {return(*Comm_);};
204 
206  bool DistributedGlobal() const {return(Map_.DistributedGlobal());};
208 
210 
211  virtual void Print(std::ostream& os) const;
214 
215  protected:
216 
217 
219 
220  virtual int DoTransfer(const Epetra_SrcDistObject& A,
222  Epetra_CombineMode CombineMode,
223  int NumSameIDs,
224  int NumPermuteIDs,
225  int NumRemoteIDs,
226  int NumExportIDs,
227  int* PermuteToLIDs,
228  int* PermuteFromLIDs,
229  int* RemoteLIDs,
230  int* ExportLIDs,
231  int& LenExports,
232  char*& Exports,
233  int& LenImports,
234  char*& Imports,
235  Epetra_Distributor& Distor,
236  bool DoReverse,
237  const Epetra_OffsetIndex * Indexor );
239 
240  // These methods must be implemented by derived class
241 
243 
244  virtual int CheckSizes(const Epetra_SrcDistObject& Source) = 0;
247  virtual int CopyAndPermute(const Epetra_SrcDistObject& Source,
248  int NumSameIDs,
249  int NumPermuteIDs,
250  int * PermuteToLIDs,
251  int * PermuteFromLIDs,
252  const Epetra_OffsetIndex * Indexor,
253  Epetra_CombineMode CombineMode = Zero) = 0;
254 
256  virtual int PackAndPrepare(const Epetra_SrcDistObject& Source,
257  int NumExportIDs,
258  int* ExportLIDs,
259  int& LenExports,
260  char*& Exports,
261  int& SizeOfPacket,
262  int* Sizes,
263  bool & VarSizes,
264  Epetra_Distributor& Distor) = 0;
265 
267  virtual int UnpackAndCombine(const Epetra_SrcDistObject& Source,
268  int NumImportIDs,
269  int* ImportLIDs,
270  int LenImports,
271  char* Imports,
272  int& SizeOfPacket,
273  Epetra_Distributor& Distor,
274  Epetra_CombineMode CombineMode,
275  const Epetra_OffsetIndex * Indexor) = 0;
276 
280  char* Exports_;
281  char* Imports_;
284  int *Sizes_;
285 
286  private:
288 
289 };
290 
291 #endif /* EPETRA_DISTOBJECT_H */
bool DistributedGlobal() const
Returns true if this multi-vector is distributed global, i.e., not local replicated.
virtual void Print(std::ostream &os) const
Print object to an output stream Print method.
const Epetra_Comm & Comm() const
Returns the address of the Epetra_Comm for this multi-vector.
Epetra_Distributor: The Epetra Gather/Scatter Setup Base Class.
Epetra_OffsetIndex: This class builds index for efficient mapping of data from one Epetra_CrsGraph ba...
Epetra_Export: This class builds an export object for efficient exporting of off-processor elements...
Definition: Epetra_Export.h:70
Epetra_Import: This class builds an import object for efficient importing of off-processor elements...
Definition: Epetra_Import.h:71
Epetra_Comm: The Epetra Communication Abstract Base Class.
Definition: Epetra_Comm.h:81
Epetra_Object & operator=(const Epetra_Object &src)
Epetra_Object: The base Epetra class.
Definition: Epetra_Object.h:65
const Epetra_Comm * Comm_
virtual const Epetra_BlockMap & Map() const =0
Returns a reference to the Epetra_BlockMap for this object.
Epetra_BlockMap: A class for partitioning block element vectors and matrices.
Epetra_BlockMap Map_
Epetra_CombineMode
Epetra_SrcDistObject: A class for supporting flexible source distributed objects for import/export op...
Epetra_DistObject: A class for constructing and using dense multi-vectors, vectors and matrices in pa...