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 2001 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 
00357   int RemoteIDList(int NumIDs, const int * GIDList, int * PIDList, int * LIDList) const {
00358     return(RemoteIDList(NumIDs, GIDList, PIDList, LIDList, 0));
00359   };
00360 
00362 
00367   int RemoteIDList(int NumIDs, const int * GIDList, int * PIDList, int * LIDList, int * SizeList) const;
00368 
00370   int  LID(int GID) const;
00371   
00373   int  GID(int LID) const; 
00374   
00376   int FindLocalElementID(int PointID, int & ElementID, int & ElementOffset)  const;
00377 
00379   bool  MyGID(int GID_in) const {return(LID(GID_in)!=-1);};
00380    
00382   bool  MyLID(int LID_in) const {return(GID(LID_in)!=BlockMapData_->IndexBase_-1);};
00383   
00385   int  MinAllGID() const {return(BlockMapData_->MinAllGID_);};
00386   
00388   int  MaxAllGID() const {return(BlockMapData_->MaxAllGID_);};
00389   
00391   int  MinMyGID() const {return(BlockMapData_->MinMyGID_);};
00392   
00394   int  MaxMyGID() const {return(BlockMapData_->MaxMyGID_);};
00395   
00397   int  MinLID() const {return(BlockMapData_->MinLID_);};
00398   
00400   int  MaxLID() const {return(BlockMapData_->MaxLID_);};
00402 
00404 
00405 
00406   int  NumGlobalElements() const {return(BlockMapData_->NumGlobalElements_);};
00407   
00409   int  NumMyElements() const {return(BlockMapData_->NumMyElements_);};
00410   
00412   int MyGlobalElements(int * MyGlobalElementList) const;
00413   
00415   int  ElementSize() const {return(BlockMapData_->ElementSize_);};
00416     
00418   int  ElementSize(int LID) const;
00419     
00421 
00424   int  FirstPointInElement(int LID) const;
00425   
00427   int  IndexBase() const {return(BlockMapData_->IndexBase_);};
00428   
00430   int  NumGlobalPoints() const {return(BlockMapData_->NumGlobalPoints_);};
00431   
00433   int  NumMyPoints() const {return(BlockMapData_->NumMyPoints_);};
00434   
00436   int  MinMyElementSize() const {return(BlockMapData_->MinMyElementSize_);};
00437   
00439   int  MaxMyElementSize() const {return(BlockMapData_->MaxMyElementSize_);};
00440   
00442   int  MinElementSize() const {return(BlockMapData_->MinElementSize_);};
00443   
00445   int  MaxElementSize() const {return(BlockMapData_->MaxElementSize_);};
00447 
00449 
00450 
00451 
00456   bool  UniqueGIDs() const {return(IsOneToOne());};
00457 
00459   bool  ConstantElementSize() const {return(BlockMapData_->ConstantElementSize_);};
00460 
00462   bool SameAs(const Epetra_BlockMap & Map) const;
00463 
00465 
00468   bool PointSameAs(const Epetra_BlockMap & Map) const;
00469   
00471   bool  LinearMap() const {return(BlockMapData_->LinearMap_);};
00472 
00474   bool  DistributedGlobal() const {return(BlockMapData_->DistributedGlobal_);};
00476 
00478 
00479 
00481   int * MyGlobalElements() const;
00482 
00484 
00487   int * FirstPointInElementList() const;
00488 
00490   int * ElementSizeList() const;
00491 
00493   int * PointToElementList() const;
00494 
00496   int ElementSizeList(int * ElementSizeList)const;
00497   
00499   int FirstPointInElementList(int * FirstPointInElementList)const;
00500 
00502   int PointToElementList(int * PointToElementList) const;
00503 
00505 
00507 
00508 
00510   virtual void Print(ostream & os) const;
00511 
00513   const Epetra_Comm & Comm() const {return(*BlockMapData_->Comm_);}
00514 
00515   bool IsOneToOne() const {return(BlockMapData_->OneToOne_);}
00516 
00518   Epetra_BlockMap & operator=(const Epetra_BlockMap & map);
00519 
00521 
00523 
00524 
00526 
00527   int ReferenceCount() const {return(BlockMapData_->ReferenceCount());}
00528 
00530 
00531   const Epetra_BlockMapData * DataPtr() const {return(BlockMapData_);}
00532 
00534   
00535  private: // These need to be accessible to derived map classes.
00536   
00537   void GlobalToLocalSetup();
00538   bool DetermineIsOneToOne();
00539   bool IsDistributedGlobal(int NumGlobalElements, int NumMyElements) const;
00540   void CheckValidNGE(int NumGlobalElements);
00541   void EndOfConstructorOps();
00542   void CleanupData();
00543   
00544   Epetra_BlockMapData * BlockMapData_;
00545 
00546 };
00547 
00548 #endif /* EPETRA_BLOCKMAP_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines