Epetra Package Browser (Single Doxygen Collection) Development
Epetra_BlockMap.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_BLOCKMAP_H
00045 #define EPETRA_BLOCKMAP_H
00046 
00047 #include "Epetra_ConfigDefs.h"
00048 #include "Epetra_Object.h"
00049 #include "Epetra_BlockMapData.h"
00050 
00051 
00053 
00194 class EPETRA_LIB_DLL_EXPORT Epetra_BlockMap: public Epetra_Object {
00195   friend class Epetra_Directory;
00196   friend class Epetra_LocalMap;
00197  public:
00199 
00200 
00201 
00224   Epetra_BlockMap(int NumGlobalElements, int ElementSize, int IndexBase, const Epetra_Comm& Comm);
00225 
00227 
00256   Epetra_BlockMap(int NumGlobalElements, int NumMyElements, 
00257     int ElementSize, int IndexBase, const Epetra_Comm& Comm);
00258 
00260 
00296   Epetra_BlockMap(int NumGlobalElements, int NumMyElements,
00297                   const int *MyGlobalElements,  
00298       int ElementSize, int IndexBase, const Epetra_Comm& Comm);
00299 
00301 
00338   Epetra_BlockMap(int NumGlobalElements, int NumMyElements,
00339                   const int *MyGlobalElements,
00340       const int *ElementSizeList, int IndexBase,
00341                   const Epetra_Comm& Comm);
00342   
00344   Epetra_BlockMap(const Epetra_BlockMap& map);
00345   
00347   virtual ~Epetra_BlockMap(void);
00349   
00351 
00352 
00353 
00360   int RemoteIDList(int NumIDs, const int * GIDList, int * PIDList, int * LIDList) const {
00361     return(RemoteIDList(NumIDs, GIDList, PIDList, LIDList, 0));
00362   };
00363 
00365 
00370   int RemoteIDList(int NumIDs, const int * GIDList, int * PIDList, int * LIDList, int * SizeList) const;
00371 
00373   int  LID(int GID) const;
00374   
00376   int  GID(int LID) const; 
00377   
00379   int FindLocalElementID(int PointID, int & ElementID, int & ElementOffset)  const;
00380 
00382   bool  MyGID(int GID_in) const {return(LID(GID_in)!=-1);};
00383    
00385   bool  MyLID(int LID_in) const {return(GID(LID_in)!=BlockMapData_->IndexBase_-1);};
00386   
00388   int  MinAllGID() const {return(BlockMapData_->MinAllGID_);};
00389   
00391   int  MaxAllGID() const {return(BlockMapData_->MaxAllGID_);};
00392   
00394   int  MinMyGID() const {return(BlockMapData_->MinMyGID_);};
00395   
00397   int  MaxMyGID() const {return(BlockMapData_->MaxMyGID_);};
00398   
00400   int  MinLID() const {return(BlockMapData_->MinLID_);};
00401   
00403   int  MaxLID() const {return(BlockMapData_->MaxLID_);};
00405 
00407 
00408 
00409   int  NumGlobalElements() const {return(BlockMapData_->NumGlobalElements_);};
00410   
00412   int  NumMyElements() const {return(BlockMapData_->NumMyElements_);};
00413   
00415   int MyGlobalElements(int * MyGlobalElementList) const;
00416   
00418   int  ElementSize() const {return(BlockMapData_->ElementSize_);};
00419     
00421   int  ElementSize(int LID) const;
00422     
00424 
00427   int  FirstPointInElement(int LID) const;
00428   
00430   int  IndexBase() const {return(BlockMapData_->IndexBase_);};
00431   
00433   int  NumGlobalPoints() const {return(BlockMapData_->NumGlobalPoints_);};
00434   
00436   int  NumMyPoints() const {return(BlockMapData_->NumMyPoints_);};
00437   
00439   int  MinMyElementSize() const {return(BlockMapData_->MinMyElementSize_);};
00440   
00442   int  MaxMyElementSize() const {return(BlockMapData_->MaxMyElementSize_);};
00443   
00445   int  MinElementSize() const {return(BlockMapData_->MinElementSize_);};
00446   
00448   int  MaxElementSize() const {return(BlockMapData_->MaxElementSize_);};
00450 
00452 
00453 
00454 
00459   bool  UniqueGIDs() const {return(IsOneToOne());};
00460 
00462   bool  ConstantElementSize() const {return(BlockMapData_->ConstantElementSize_);};
00463 
00465   bool SameAs(const Epetra_BlockMap & Map) const;
00466 
00468 
00471   bool PointSameAs(const Epetra_BlockMap & Map) const;
00472   
00474   bool  LinearMap() const {return(BlockMapData_->LinearMap_);};
00475 
00477   bool  DistributedGlobal() const {return(BlockMapData_->DistributedGlobal_);};
00479 
00481 
00482 
00484   int * MyGlobalElements() const;
00485 
00487 
00490   int * FirstPointInElementList() const;
00491 
00493   int * ElementSizeList() const;
00494 
00496   int * PointToElementList() const;
00497 
00499   int ElementSizeList(int * ElementSizeList)const;
00500   
00502   int FirstPointInElementList(int * FirstPointInElementList)const;
00503 
00505   int PointToElementList(int * PointToElementList) const;
00506 
00508 
00510 
00511 
00513   virtual void Print(ostream & os) const;
00514 
00516   const Epetra_Comm & Comm() const {return(*BlockMapData_->Comm_);}
00517 
00518   bool IsOneToOne() const;
00519 
00521   Epetra_BlockMap & operator=(const Epetra_BlockMap & map);
00522 
00524 
00526 
00527 
00529 
00530   int ReferenceCount() const {return(BlockMapData_->ReferenceCount());}
00531 
00533 
00534   const Epetra_BlockMapData * DataPtr() const {return(BlockMapData_);}
00535 
00537   
00538  private: // These need to be accessible to derived map classes.
00539   
00540   void GlobalToLocalSetup();
00541   bool DetermineIsOneToOne() const;
00542   bool IsDistributedGlobal(int NumGlobalElements, int NumMyElements) const;
00543   void CheckValidNGE(int NumGlobalElements);
00544   void EndOfConstructorOps();
00545   void CleanupData();
00546   
00547   Epetra_BlockMapData * BlockMapData_;
00548 
00549 };
00550 
00551 #endif /* EPETRA_BLOCKMAP_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines