45 long long *MyGlobalElements,
int ElementSize,
int * ElementSizeList,
46 long long NumGlobalPoints,
int NumMyPoints,
48 bool DistributedGlobal,
52 int i, ierr=0, forierr=0;
56 if (ElementSizeList==0)
67 int *MyElementSizeList;
69 if (ElementSizeList==0)
73 MyElementSizeList =
new int[NumMyElements];
77 for (i=0; i<NumMyElements; i++)
78 forierr += MyElementSizeList[i]!=ElementSize;
86 MyElementSizeList =
new int[NumMyElements];
88 int MaxSize = MyElementSizeList[0];
89 int MinSize = MyElementSizeList[0];
91 for (i=0; i<NumMyElements; i++) {
92 forierr += MyElementSizeList[i]!=ElementSizeList[i];
93 if (MyElementSizeList[i] > MaxSize)
94 MaxSize = MyElementSizeList[i];
95 if (MyElementSizeList[i] < MinSize)
96 MinSize = MyElementSizeList[i];
100 forierr += Map.
ElementSize(Map.
LID(MyGlobalElements[i])) != ElementSizeList[i];
124 int MaxLID = Map.
MaxLID();
127 long long MaxMyGID = (Comm.
MyPID()+1)*NumMyElements-1+IndexBase;
128 if (Comm.
MyPID()>2) MaxMyGID+=3;
129 if (!DistributedGlobal) MaxMyGID = NumMyElements-1+IndexBase;
134 if (ElementSizeList==0)
140 int MinLID = Map.
MinLID();
143 long long MinMyGID = Comm.
MyPID()*NumMyElements+IndexBase;
144 if (Comm.
MyPID()>2) MinMyGID+=3;
145 if (!DistributedGlobal) MinMyGID = IndexBase;
148 long long * MyGlobalElements1 =
new long long[NumMyElements];
152 if (MyGlobalElements==0) {
153 for (i=0; i<NumMyElements; i++)
154 forierr += MyGlobalElements1[i]!=MinMyGID+i;
158 for (i=0; i<NumMyElements; i++)
159 forierr += MyGlobalElements[i]!=MyGlobalElements1[i];
170 long long MaxMyGID2 = Map.
GID64(Map.
LID(MaxMyGID));
172 int MaxLID2 = Map.
LID(Map.
GID64(MaxLID));
191 int * FirstPointInElementList =
new int[NumMyElements+1];
195 for (i=0; i<=NumMyElements; i++)
196 forierr += FirstPointInElementList[i]!=FirstPointInElementList1[i];
201 for (i=0; i<=NumMyElements; i++)
202 forierr += FirstPointInElementList1[i]!=(i*ElementSize);
207 for (i=0; i<NumMyElements; i++) {
208 forierr += FirstPointInElementList1[i]!=FirstPoint;
209 FirstPoint += ElementSizeList[i];
212 EPETRA_TEST_ERR(FirstPointInElementList[NumMyElements] != NumMyPoints,ierr);
214 delete [] FirstPointInElementList;
217 int ElementID, Offset;
219 int * PointToElementList =
new int[NumMyPoints];
223 for (i=0; i<NumMyPoints; i++)
224 forierr += PointToElementList1[i] != PointToElementList[i];
229 for (i=0; i<NumMyElements; i++)
230 for (
int j=0; j<ElementSize; j++) {
231 forierr += PointToElementList[i*ElementSize+j] != i;
234 forierr += ElementID != i || Offset != j;
240 for (i=0; i<NumMyElements; i++) {
241 for (
int j=0; j<ElementSizeList[i]; j++) {
242 forierr += PointToElementList[MyPointTot+j] != i;
245 forierr += ElementID != i || Offset != j;
247 MyPointTot += ElementSizeList[i];
251 delete [] PointToElementList;
255 int TotalNumEle, NumElePerProc, NumProc = Comm.
NumProc();
258 Comm.
MinAll(&NumMyEle,&MinNumEleOnProc,1);
259 if (MinNumEleOnProc > 5) NumElePerProc = 6;
260 else NumElePerProc = MinNumEleOnProc;
261 if (NumElePerProc > 0) {
262 TotalNumEle = NumElePerProc*NumProc;
263 long long * MyGIDlist =
new long long[NumElePerProc];
264 long long * GIDlist =
new long long[TotalNumEle];
265 int * PIDlist =
new int[TotalNumEle];
266 int * LIDlist =
new int[TotalNumEle];
267 int * SizeList =
new int[TotalNumEle];
268 for (i=0; i<NumElePerProc; i++)
269 MyGIDlist[i] = MyGlobalElements1[i];
270 Comm.
GatherAll(MyGIDlist,GIDlist,NumElePerProc);
271 Map.
RemoteIDList(TotalNumEle, GIDlist, PIDlist, LIDlist, SizeList);
272 int MyPID= Comm.
MyPID();
274 for (i=0; i<TotalNumEle; i++) {
275 if (Map.
MyGID(GIDlist[i])) {
276 forierr += PIDlist[i] != MyPID;
277 forierr += !Map.
MyLID(Map.
LID(GIDlist[i])) || Map.
LID(GIDlist[i]) != LIDlist[i] || Map.
GID64(LIDlist[i]) != GIDlist[i];
278 forierr += SizeList[i] != Map.
ElementSize(LIDlist[i]);
281 forierr += PIDlist[i] == MyPID;
293 delete [] MyGlobalElements1;
294 delete [] MyElementSizeList;
300 long long * GIDList =
new long long[3];
301 int * PIDList =
new int[3];
302 int * LIDList =
new int[3];
long long MinMyGID64() const
int * FirstPointInElementList() const
Pointer to internal array containing a mapping between the local elements and the first local point n...
long long MaxAllGID64() const
bool DistributedGlobal() const
Returns true if map is defined across more than one processor.
int ElementSize() const
Returns the size of elements in the map; only valid if map has constant element size.
int MaxLID() const
The maximum local index value on the calling processor.
virtual int GatherAll(double *MyVals, double *AllVals, int Count) const =0
Epetra_Comm All Gather function.
#define EPETRA_TEST_ERR(a, b)
long long IndexBase64() const
int MyGlobalElements(int *MyGlobalElementList) const
Puts list of global elements on this processor into the user-provided array.
long long NumGlobalElements64() const
bool ConstantElementSize() const
Returns true if map has constant element size.
int * ElementSizeList() const
List of the element sizes corresponding to the array MyGlobalElements().
long long NumGlobalPoints64() const
virtual int MinAll(double *PartialMins, double *GlobalMins, int Count) const =0
Epetra_Comm Global Min function.
int MinLID() const
The minimum local index value on the calling processor.
virtual int MyPID() const =0
Return my process ID.
int NumMyElements() const
Number of elements on the calling processor.
long long GID64(int LID) const
Epetra_Comm: The Epetra Communication Abstract Base Class.
int checkmap(Epetra_BlockMap &Map, int NumGlobalElements, int NumMyElements, int *MyGlobalElements, int ElementSize, int *ElementSizeList, int NumGlobalPoints, int NumMyPoints, int IndexBase, Epetra_Comm &Comm, bool DistributedGlobal, bool IsOneToOne)
long long MinAllGID64() const
Epetra_BlockMap: A class for partitioning block element vectors and matrices.
int FindLocalElementID(int PointID, int &ElementID, int &ElementOffset) const
Returns the LID of the element that contains the given local PointID, and the Offset of the point in ...
int LID(int GID) const
Returns local ID of global ID, return -1 if not found on this processor.
bool MyGID(int GID_in) const
Returns true if the GID passed in belongs to the calling processor in this map, otherwise returns fal...
int MinMyElementSize() const
Minimum element size on the calling processor.
const Epetra_Comm & Comm() const
Access function for Epetra_Comm communicator.
bool LinearMap() const
Returns true if the global ID space is contiguously divided (but not necessarily uniformly) across al...
int * PointToElementList() const
For each local point, indicates the local element ID that the point belongs to.
virtual int NumProc() const =0
Returns total number of processes.
int MaxElementSize() const
Maximum element size across all processors.
int MaxMyElementSize() const
Maximum element size 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...
int NumMyPoints() const
Number of local points for this map; equals the sum of all element sizes on the calling processor...
long long MaxMyGID64() const
int MinElementSize() const
Minimum element size across all processors.
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...