44#ifndef EPETRA_BLOCKMAP_H
45#define EPETRA_BLOCKMAP_H
224#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
227#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
262#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
264 int ElementSize,
int IndexBase,
const Epetra_Comm& Comm);
266#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
268 int ElementSize,
int IndexBase,
const Epetra_Comm& Comm);
270 int ElementSize,
long long IndexBase,
const Epetra_Comm& Comm);
310#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
312 const int *MyGlobalElements,
313 int ElementSize,
int IndexBase,
const Epetra_Comm& Comm);
315#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
317 const long long *MyGlobalElements,
318 int ElementSize,
int IndexBase,
const Epetra_Comm& Comm);
320 const long long *MyGlobalElements,
321 int ElementSize,
long long IndexBase,
const Epetra_Comm& Comm);
362#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
364 const int *MyGlobalElements,
365 const int *ElementSizeList,
int IndexBase,
368#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
370 const long long *MyGlobalElements,
371 const int *ElementSizeList,
int IndexBase,
374 const long long *MyGlobalElements,
375 const int *ElementSizeList,
long long IndexBase,
379#if defined(EPETRA_NO_32BIT_GLOBAL_INDICES) && defined(EPETRA_NO_64BIT_GLOBAL_INDICES)
387#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
389 const long long * myGlobalElements,
390 int ElementSize,
int indexBase,
392 bool UserIsDistributedGlobal,
393 long long UserMinAllGID,
long long UserMaxAllGID);
395 const long long * myGlobalElements,
396 int ElementSize,
long long indexBase,
398 bool UserIsDistributedGlobal,
399 long long UserMinAllGID,
long long UserMaxAllGID);
402#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
404 const int * myGlobalElements,
405 int ElementSize,
int indexBase,
407 bool UserIsDistributedGlobal,
408 int UserMinAllGID,
int UserMaxAllGID);
429#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
430 int RemoteIDList(
int NumIDs,
const int * GIDList,
int * PIDList,
int * LIDList)
const {
431 return(RemoteIDList(NumIDs, GIDList, PIDList, LIDList, 0));
434#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
435 int RemoteIDList(
int NumIDs,
const long long * GIDList,
int * PIDList,
int * LIDList)
const {
436 return(RemoteIDList(NumIDs, GIDList, PIDList, LIDList, 0));
446#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
447 int RemoteIDList(
int NumIDs,
const int * GIDList,
int * PIDList,
int * LIDList,
int * SizeList)
const;
449#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
450 int RemoteIDList(
int NumIDs,
const long long * GIDList,
int * PIDList,
int * LIDList,
int * SizeList)
const;
454#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
455 int LID(
int GID)
const;
457#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
458 int LID(
long long GID)
const;
461#if defined(EPETRA_NO_32BIT_GLOBAL_INDICES) && defined(EPETRA_NO_64BIT_GLOBAL_INDICES)
464 int LID(
long long GID)
const {
return -1; }
465 bool MyGID(
long long GID_in)
const {
return false; }
469#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
470 int GID(
int LID)
const;
472 long long GID64(
int LID)
const;
475 int FindLocalElementID(
int PointID,
int & ElementID,
int & ElementOffset)
const;
478#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
479 bool MyGID(
int GID_in)
const {
return(LID(GID_in)!=-1);};
481#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
482 bool MyGID(
long long GID_in)
const {
return(LID(GID_in)!=-1);};
488 if ((BlockMapData_->NumMyElements_ == 0) ||
489 (lid < BlockMapData_->MinLID_) || (lid > BlockMapData_->MaxLID_)) {
496#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
498 if(GlobalIndicesInt())
499 return (
int) MinAllGID64();
500 throw "Epetra_BlockMap::MinAllGID: GlobalIndices not int.";
503 long long MinAllGID64()
const {
return(BlockMapData_->MinAllGID_);};
506#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
508 if(GlobalIndicesInt())
509 return (
int) MaxAllGID64();
510 throw "Epetra_BlockMap::MaxAllGID: GlobalIndices not int.";
513 long long MaxAllGID64()
const {
return(BlockMapData_->MaxAllGID_);};
516#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
518 if(GlobalIndicesInt())
519 return (
int) MinMyGID64();
520 throw "Epetra_BlockMap::MinMyGID: GlobalIndices not int.";
523 long long MinMyGID64()
const {
return(BlockMapData_->MinMyGID_);};
526#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
528 if(GlobalIndicesInt())
529 return (
int) MaxMyGID64();
530 throw "Epetra_BlockMap::MaxMyGID: GlobalIndices not int.";
533 long long MaxMyGID64()
const {
return(BlockMapData_->MaxMyGID_);};
536 int MinLID()
const {
return(BlockMapData_->MinLID_);};
539 int MaxLID()
const {
return(BlockMapData_->MaxLID_);};
545#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
547 if(GlobalIndicesInt())
548 return (
int) NumGlobalElements64();
549 throw "Epetra_BlockMap::NumGlobalElements: GlobalIndices not int.";
558#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
559 int MyGlobalElements(
int * MyGlobalElementList)
const;
561#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
562 int MyGlobalElements(
long long * MyGlobalElementList)
const;
565#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
566 int MyGlobalElementsPtr(
int *& MyGlobalElementList)
const;
568#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
569 int MyGlobalElementsPtr(
long long *& MyGlobalElementList)
const;
576 int ElementSize(
int LID)
const;
582 int FirstPointInElement(
int LID)
const;
584#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
587 if(GlobalIndicesInt() || IndexBase64() == (
long long)
static_cast<int>(IndexBase64()))
588 return (
int) IndexBase64();
589 throw "Epetra_BlockMap::IndexBase: GlobalIndices not int and IndexBase cannot fit an int.";
592 long long IndexBase64()
const {
return(BlockMapData_->IndexBase_);};
595#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
597 if(GlobalIndicesInt())
598 return (
int) NumGlobalPoints64();
599 throw "Epetra_BlockMap::NumGlobalPoints: GlobalIndices not int.";
657 template<
typename int_type>
660 bool GlobalIndicesTypeValid()
const {
return BlockMapData_->GlobalIndicesInt_ || BlockMapData_->GlobalIndicesLongLong_; }
665#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
668#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
691 bool LinearMap()
const {
return(BlockMapData_->LinearMap_);};
701#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
702 int * MyGlobalElements()
const;
704#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
705 long long * MyGlobalElements64()
const;
710#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
711 if(GlobalIndicesInt()) {
712 IntGIDs = MyGlobalElements();
716#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
717 if(GlobalIndicesLongLong()) {
718 LLGIDs = MyGlobalElements64();
726#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
727 if(GlobalIndicesInt()) {
728 IntGIDs = MyGlobalElements();
732#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
733 if(GlobalIndicesLongLong()) {
734 LLGIDs = MyGlobalElements64();
744 int * FirstPointInElementList()
const;
747 int * ElementSizeList()
const;
750 int * PointToElementList()
const;
753 int ElementSizeList(
int * ElementSizeList)
const;
756 int FirstPointInElementList(
int * FirstPointInElementList)
const;
759 int PointToElementList(
int * PointToElementList)
const;
767 virtual void Print(std::ostream & os)
const;
772 bool IsOneToOne()
const;
868 void GlobalToLocalSetup();
869 bool DetermineIsOneToOne()
const;
870 bool IsDistributedGlobal(
long long NumGlobalElements,
int NumMyElements)
const;
871 void CheckValidNGE(
long long NumGlobalElements);
872 void EndOfConstructorOps();
882 void ConstructAutoUniform(
long long NumGlobal_Elements,
int Element_Size,
883 long long Index_Base,
const Epetra_Comm& comm,
bool IsLongLong);
885 void ConstructUserLinear(
long long NumGlobal_Elements,
int NumMy_Elements,
886 int Element_Size,
long long Index_Base,
const Epetra_Comm& comm,
bool IsLongLong);
888 template<
typename int_type>
889 void ConstructUserConstant(int_type NumGlobal_Elements,
int NumMy_Elements,
890 const int_type * myGlobalElements,
891 int Element_Size, int_type indexBase,
894 template<
typename int_type>
895 void ConstructUserVariable(int_type NumGlobal_Elements,
int NumMy_Elements,
896 const int_type * myGlobalElements,
897 const int *elementSizeList, int_type indexBase,
900 template<
typename int_type>
901 void ConstructUserConstantNoComm(int_type NumGlobal_Elements,
int NumMy_Elements,
902 const int_type * myGlobalElements,
903 int ElementSize, int_type indexBase,
905 bool UserIsDistributedGlobal,
906 int_type UserMinAllGID, int_type UserMaxAllGID);
908 template<
typename int_type>
911 template<
typename int_type>
914 template<
typename int_type>
917 template<
typename int_type>
918 void TGlobalToLocalSetup();
921#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
928#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
Epetra_BlockMapData: The Epetra BlockMap Data Class.
Epetra_IntSerialDenseVector MyGlobalElements_int_
Epetra_LongLongSerialDenseVector MyGlobalElements_LL_
bool GlobalIndicesLongLong_
Epetra_BlockMap: A class for partitioning block element vectors and matrices.
long long IndexBase64() const
int MinAllGID() const
Returns the minimum global ID across the entire map.
int SizeMyGlobalElement(int n)
int_type & MyGlobalElementVal(int i)
int RemoteIDList(int NumIDs, const int *GIDList, int *PIDList, int *LIDList) const
Returns the processor IDs and corresponding local index value for a given list of global indices.
int MaxElementSize() const
Maximum element size across all processors.
bool GlobalIndicesIsType() const
int MinMyElementSize() const
Minimum element size on the calling processor.
int_type MyGlobalElementValGet(int i)
long long MaxAllGID64() const
int MinMyGID() const
Returns the minimum global ID owned by this processor.
long long MaxMyGID64() const
bool GlobalIndicesTypeMatch(const Epetra_BlockMap &other) const
bool GlobalIndicesTypeValid() const
bool MyGID(long long GID_in) const
bool DistributedGlobal() const
Returns true if map is defined across more than one processor.
int NumMyPoints() const
Number of local points for this map; equals the sum of all element sizes on the calling processor.
int ReferenceCount() const
Returns the reference count of BlockMapData.
bool LinearMap() const
Returns true if the global ID space is contiguously divided (but not necessarily uniformly) across al...
int IndexBase() const
Index base for this map.
Epetra_BlockMapData * BlockMapData_
int RemoteIDList(int NumIDs, const long long *GIDList, int *PIDList, int *LIDList) const
int MaxAllGID() const
Returns the maximum global ID across the entire map.
int ElementSize() const
Returns the size of elements in the map; only valid if map has constant element size.
void MyGlobalElements(int *&IntGIDs, long long *&LLGIDs)
int MaxMyElementSize() const
Maximum element size on the calling processor.
int MinLID() const
The minimum local index value on the calling processor.
bool UniqueGIDs() const
Returns true if map GIDs are 1-to-1.
long long NumGlobalElements64() const
void MyGlobalElements(const int *&IntGIDs, const long long *&LLGIDs) const
bool GlobalIndicesInt() const
Returns true if map create with int NumGlobalElements.
int MinElementSize() const
Minimum element size across all processors.
int NumGlobalElements() const
Number of elements across all processors.
const Epetra_Comm & Comm() const
Access function for Epetra_Comm communicator.
bool ConstantElementSize() const
Returns true if map has constant element size.
const Epetra_BlockMapData * DataPtr() const
Returns a pointer to the BlockMapData instance this BlockMap uses.
long long MinAllGID64() const
long long MinMyGID64() const
int NumMyElements() const
Number of elements on the calling processor.
bool MyLID(int lid) const
Returns true if the LID passed in belongs to the calling processor in this map, otherwise returns fal...
long long NumGlobalPoints64() const
int MaxLID() const
The maximum local index value on the calling processor.
int NumGlobalPoints() const
Number of global points for this map; equals the sum of all element sizes across all processors.
bool MyGID(int GID_in) const
Returns true if the GID passed in belongs to the calling processor in this map, otherwise returns fal...
bool GlobalIndicesLongLong() const
Returns true if map create with long long NumGlobalElements.
int MaxMyGID() const
Returns the maximum global ID owned by this processor.
Epetra_Comm: The Epetra Communication Abstract Base Class.
Epetra_Directory: This class is a pure virtual class whose interface allows Epetra_Map and Epetr_Bloc...
int Size(int Length_in)
Set length of a Epetra_IntSerialDenseVector object; init values to zero.
Epetra_LocalMap: A class for replicating vectors and matrices across multiple processors.
int Size(int Length_in)
Set length of a Epetra_LongLongSerialDenseVector object; init values to zero.
Epetra_Object: The base Epetra class.
virtual void Print(std::ostream &os) const
Print object to an output stream Print method.
Epetra_Object & operator=(const Epetra_Object &src)