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 #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_Object.h"
57 #include "Epetra_Directory.h"
58 #include "Epetra_Map.h"
59 
61 
71 class Epetra_BasicDirectory: public virtual Epetra_Directory {
72 
73  public:
74 
76 
79 
81 
83 
85 
86  virtual ~Epetra_BasicDirectory(void);
88 
90 
91 
120 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
121  int GetDirectoryEntries( const Epetra_BlockMap& Map,
122  const int NumEntries,
123  const int * GlobalEntries,
124  int * Procs,
125  int * LocalEntries,
126  int * EntrySizes,
127  bool high_rank_sharing_procs=false) const;
128 #endif
129 
130 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
131  int GetDirectoryEntries( const Epetra_BlockMap& Map,
132  const int NumEntries,
133  const long long * GlobalEntries,
134  int * Procs,
135  int * LocalEntries,
136  int * EntrySizes,
137  bool high_rank_sharing_procs=false) const;
138 #endif
139 
141 
143  bool GIDsAllUniquelyOwned() const;
145 
147 
148  virtual void Print(std::ostream & os) const;
151 
152  private:
154 
155  void create_ProcListArrays();
156 
157  void addProcToList(int proc, int LID);
158 
160  template<typename int_type>
161  int Generate(const Epetra_BlockMap& Map);
162 
164  const Epetra_Map & DirectoryMap() const {return(*DirectoryMap_);};
165 
167 
168  //ProcList_ is a list containing the associated processor for each
169  //directory entry. If any directory entry has more than one associated
170  //processor, then the corresponding ProcList_ entry will be the lowest-
171  //numbered of those processors. In that case, refer to ProcListLists_
172  //for more info.
173 
174  int * ProcList_;
175 
176  //ProcListLists_ will usually be unallocated, and set to NULL. But if
177  //at least one directory entry is associcated with more than one proc,
178  //then ProcListLists_ is a list of lists -- it holds, for each
179  //directory-entry, a list of processors.
180  //But even then, it will have a NULL list for all directory entries that
181  //are associated with only one processor.
182  //
183  //Each list's length will be stored in ProcListLens_.
184  //Example:
185  //
186  //if (numProcLists_ > 0) {
187  // int entry_LID = DirectoryMap_->LID(GID);
188  //
189  // for(int i=0; i<ProcListLens_[entry_LID]; ++i) {
190  // cout << "entry "<<GID<<" associated with proc "
191  // <<ProcListLists_[entry_LID][i]<<endl;
192  // }
193  //}
197 
198  //true if any directory entry appears on multiple processors
200 
202  int * SizeList_;
204 
205 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
207 #endif
208 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
209  long long * AllMinGIDs_LL_;
210 #endif
211 
212  template<typename int_type>
213  const int_type * AllMinGIDs() const;
214 
215  template<typename int_type>
216  int GetDirectoryEntries( const Epetra_BlockMap& Map,
217  const int NumEntries,
218  const int_type * GlobalEntries,
219  int * Procs,
220  int * LocalEntries,
221  int * EntrySizes,
222  bool high_rank_sharing_procs) const;
223 
224 };
225 
226 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
227 template<> inline const int * Epetra_BasicDirectory::AllMinGIDs() const
228 {
229  return AllMinGIDs_int_;
230 }
231 #endif
232 
233 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
234 template<> inline const long long * Epetra_BasicDirectory::AllMinGIDs() const
235 {
236  return AllMinGIDs_LL_;
237 }
238 #endif
239 
240 #endif /* EPETRA_BASICDIRECTORY_H */
Epetra_Map: A class for partitioning vectors and matrices.
Definition: Epetra_Map.h:127
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