Epetra Package Browser (Single Doxygen Collection) Development
Epetra_BasicDirectory.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_BASICDIRECTORY_H
00045 #define EPETRA_BASICDIRECTORY_H
00046 
00047 #include "Epetra_Object.h"
00048 #include "Epetra_Directory.h"
00049 #include "Epetra_Map.h"
00050 
00052 
00062 class Epetra_BasicDirectory: public virtual Epetra_Directory {
00063     
00064   public:
00065 
00067 
00068 
00069   Epetra_BasicDirectory(const Epetra_BlockMap & Map );
00070   
00072   
00073   Epetra_BasicDirectory(const Epetra_BasicDirectory& Directory);
00074   
00076   
00077   virtual ~Epetra_BasicDirectory(void);
00079   
00081 
00082 
00083 
00111   int GetDirectoryEntries( const Epetra_BlockMap& Map,
00112          const int NumEntries,
00113          const int * GlobalEntries,
00114          int * Procs,
00115          int * LocalEntries,
00116          int * EntrySizes,
00117          bool high_rank_sharing_procs=false) const;
00118 
00120 
00122   bool GIDsAllUniquelyOwned() const;
00124 
00126 
00127 
00128   virtual void Print(ostream & os) const;
00130 
00131  private:
00132   Epetra_BasicDirectory& operator=(const Epetra_BasicDirectory& src);
00133 
00134   void create_ProcListArrays();
00135 
00136   void addProcToList(int proc, int LID);
00137 
00139   int Generate(const Epetra_BlockMap& Map);
00140 
00142   const Epetra_Map & DirectoryMap() const {return(*DirectoryMap_);};
00143 
00144   Epetra_Map* DirectoryMap_;
00145 
00146   //ProcList_ is a list containing the associated processor for each
00147   //directory entry. If any directory entry has more than one associated
00148   //processor, then the corresponding ProcList_ entry will be the lowest-
00149   //numbered of those processors. In that case, refer to ProcListLists_
00150   //for more info.
00151 
00152   int * ProcList_;
00153 
00154   //ProcListLists_ will usually be unallocated, and set to NULL. But if
00155   //at least one directory entry is associcated with more than one proc,
00156   //then ProcListLists_ is a list of lists -- it holds, for each
00157   //directory-entry, a list of processors.
00158   //But even then, it will have a NULL list for all directory entries that
00159   //are associated with only one processor.
00160   //
00161   //Each list's length will be stored in ProcListLens_.
00162   //Example:
00163   //
00164   //if (numProcLists_ > 0) {
00165   //  int entry_LID = DirectoryMap_->LID(GID);
00166   //
00167   //  for(int i=0; i<ProcListLens_[entry_LID]; ++i) {
00168   //    cout << "entry "<<GID<<" associated with proc "
00169   //          <<ProcListLists_[entry_LID][i]<<endl;
00170   //  }
00171   //}
00172   int** ProcListLists_;
00173   int* ProcListLens_;
00174   int numProcLists_;
00175 
00176   //true if any directory entry appears on multiple processors
00177   bool entryOnMultipleProcs_;
00178 
00179   int * LocalIndexList_;
00180   int * SizeList_;
00181   bool SizeIsConst_;
00182 
00183   int * AllMinGIDs_;
00184   
00185 
00186 };
00187 
00188 #endif /* EPETRA_BASICDIRECTORY_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines