Epetra Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Epetra_BasicDirectory.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_BASICDIRECTORY_H
45 #define EPETRA_BASICDIRECTORY_H
46 
47 #include "Epetra_ConfigDefs.h"
48 #include "Epetra_Object.h"
49 #include "Epetra_Directory.h"
50 #include "Epetra_Map.h"
51 
53 
63 class Epetra_BasicDirectory: public virtual Epetra_Directory {
64 
65  public:
66 
68 
71 
73 
75 
77 
78  virtual ~Epetra_BasicDirectory(void);
80 
82 
83 
112 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
113  int GetDirectoryEntries( const Epetra_BlockMap& Map,
114  const int NumEntries,
115  const int * GlobalEntries,
116  int * Procs,
117  int * LocalEntries,
118  int * EntrySizes,
119  bool high_rank_sharing_procs=false) const;
120 #endif
121 
122 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
123  int GetDirectoryEntries( const Epetra_BlockMap& Map,
124  const int NumEntries,
125  const long long * GlobalEntries,
126  int * Procs,
127  int * LocalEntries,
128  int * EntrySizes,
129  bool high_rank_sharing_procs=false) const;
130 #endif
131 
133 
135  bool GIDsAllUniquelyOwned() const;
137 
139 
140  virtual void Print(std::ostream & os) const;
143 
144  private:
146 
147  void create_ProcListArrays();
148 
149  void addProcToList(int proc, int LID);
150 
152  template<typename int_type>
153  int Generate(const Epetra_BlockMap& Map);
154 
156  const Epetra_Map & DirectoryMap() const {return(*DirectoryMap_);};
157 
159 
160  //ProcList_ is a list containing the associated processor for each
161  //directory entry. If any directory entry has more than one associated
162  //processor, then the corresponding ProcList_ entry will be the lowest-
163  //numbered of those processors. In that case, refer to ProcListLists_
164  //for more info.
165 
166  int * ProcList_;
167 
168  //ProcListLists_ will usually be unallocated, and set to NULL. But if
169  //at least one directory entry is associcated with more than one proc,
170  //then ProcListLists_ is a list of lists -- it holds, for each
171  //directory-entry, a list of processors.
172  //But even then, it will have a NULL list for all directory entries that
173  //are associated with only one processor.
174  //
175  //Each list's length will be stored in ProcListLens_.
176  //Example:
177  //
178  //if (numProcLists_ > 0) {
179  // int entry_LID = DirectoryMap_->LID(GID);
180  //
181  // for(int i=0; i<ProcListLens_[entry_LID]; ++i) {
182  // cout << "entry "<<GID<<" associated with proc "
183  // <<ProcListLists_[entry_LID][i]<<endl;
184  // }
185  //}
189 
190  //true if any directory entry appears on multiple processors
192 
194  int * SizeList_;
196 
197 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
199 #endif
200 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
201  long long * AllMinGIDs_LL_;
202 #endif
203 
204  template<typename int_type>
205  const int_type * AllMinGIDs() const;
206 
207  template<typename int_type>
208  int GetDirectoryEntries( const Epetra_BlockMap& Map,
209  const int NumEntries,
210  const int_type * GlobalEntries,
211  int * Procs,
212  int * LocalEntries,
213  int * EntrySizes,
214  bool high_rank_sharing_procs) const;
215 
216 };
217 
218 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
219 template<> inline const int * Epetra_BasicDirectory::AllMinGIDs() const
220 {
221  return AllMinGIDs_int_;
222 }
223 #endif
224 
225 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
226 template<> inline const long long * Epetra_BasicDirectory::AllMinGIDs() const
227 {
228  return AllMinGIDs_LL_;
229 }
230 #endif
231 
232 #endif /* EPETRA_BASICDIRECTORY_H */
Epetra_Map: A class for partitioning vectors and matrices.
Definition: Epetra_Map.h:119
const Epetra_Map & DirectoryMap() const
Returns the Epetra_Map containing the directory.
bool GIDsAllUniquelyOwned() const
GIDsAllUniquelyOwned: returns true if all GIDs appear on just one processor.
Epetra_BasicDirectory(const Epetra_BlockMap &Map)
Epetra_BasicDirectory constructor.
int GetDirectoryEntries(const Epetra_BlockMap &Map, const int NumEntries, const int *GlobalEntries, int *Procs, int *LocalEntries, int *EntrySizes, bool high_rank_sharing_procs=false) const
GetDirectoryEntries : Returns proc and local id info for non-local map entries.
virtual ~Epetra_BasicDirectory(void)
Epetra_BasicDirectory destructor.
Epetra_Directory: This class is a pure virtual class whose interface allows Epetra_Map and Epetr_Bloc...
int Generate(const Epetra_BlockMap &Map)
Generate: Sets up Directory tables.
Epetra_BasicDirectory: This class allows Epetra_Map objects to reference non-local elements...
Epetra_BlockMap: A class for partitioning block element vectors and matrices.
Epetra_BasicDirectory & operator=(const Epetra_BasicDirectory &src)
virtual void Print(std::ostream &os) const
Print method.
void addProcToList(int proc, int LID)
const int_type * AllMinGIDs() const