45 int *MyGlobalElements,
int ElementSize,
int * ElementSizeList,
46 int 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 int 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 int MinMyGID = Comm.
MyPID()*NumMyElements+IndexBase;
144 if (Comm.
MyPID()>2) MinMyGID+=3;
145 if (!DistributedGlobal) MinMyGID = IndexBase;
148 int * MyGlobalElements1 =
new int[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 int MaxMyGID2 = Map.
GID(Map.
LID(MaxMyGID));
172 int MaxLID2 = Map.
LID(Map.
GID(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 int * MyGIDlist =
new int[NumElePerProc];
264 int * GIDlist =
new int[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.
GID(LIDlist[i]) != GIDlist[i];
278 forierr += SizeList[i] != Map.
ElementSize(LIDlist[i]);
281 forierr += PIDlist[i] == MyPID;
293 delete [] MyGlobalElements1;
294 delete [] MyElementSizeList;
300 int * GIDList =
new int[3];
301 int * PIDList =
new int[3];
302 int * LIDList =
new int[3];
int NumGlobalElements() const
Number of elements across all processors.
int * FirstPointInElementList() const
Pointer to internal array containing a mapping between the local elements and the first local point n...
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)
int MyGlobalElements(int *MyGlobalElementList) const
Puts list of global elements on this processor into the user-provided array.
bool ConstantElementSize() const
Returns true if map has constant element size.
int * ElementSizeList() const
List of the element sizes corresponding to the array MyGlobalElements().
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 IndexBase() const
Index base for this map.
int NumMyElements() const
Number of elements on the calling processor.
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)
int GID(int LID) const
Returns global ID of local ID, return IndexBase-1 if not found on this processor. ...
Epetra_BlockMap: A class for partitioning block element vectors and matrices.
int MinAllGID() const
Returns the minimum global ID across the entire map.
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.
int MaxMyGID() const
Returns the maximum global ID owned by this processor.
int MinMyGID() const
Returns the minimum global ID owned by this 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.
int NumGlobalPoints() const
Number of global points for this map; equals the sum of all element sizes across all processors...
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...
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...
int MaxAllGID() const
Returns the maximum global ID across the entire map.