54 #include "../epetra_test_err.h"
64 int main(
int argc,
char *argv[]) {
68 if ((argv[1][0] ==
'-') && (argv[1][1] ==
'v')) {
78 MPI_Init(&argc,&argv);
87 int MyPID = Comm.
MyPID();
89 int verbose_int = verbose ? 1 : 0;
91 verbose = verbose_int==1 ?
true :
false;
93 if (verbose && MyPID==0)
111 if (returnierr == 0) {
112 cout <<
"Epetra_Directory tests passed."<<endl;
115 cout <<
"Epetra_Directory tests failed."<<endl;
127 int myPID = Comm.
MyPID();
130 if (numProcs < 2)
return(0);
132 int myFirstID = (myPID+1)*(myPID+1);
133 int myNumIDs = 3+myPID;
135 int* myIDs =
new int[myNumIDs];
137 for(i=0; i<myNumIDs; ++i) {
138 myIDs[i] = myFirstID+i;
146 if (proc >= numProcs) proc = 0;
148 int procNumIDs = 3+proc;
149 int procFirstID = (proc+1)*(proc+1);
150 int procLastID = procFirstID+procNumIDs - 1;
156 &queryProc1, NULL, NULL);
158 &queryProc2, NULL, NULL);
162 if (queryProc1 != proc || queryProc2 != proc) {
177 int myPID = Comm.
MyPID();
180 if (numProcs < 2)
return(0);
182 int myFirstID = (numProcs-myPID)*(numProcs-myPID);
185 int* myIDs =
new int[myNumIDs];
187 for(i=0; i<myNumIDs; ++i) {
188 myIDs[i] = myFirstID+i;
196 if (proc >= numProcs) proc = 0;
199 int procFirstID = (numProcs-proc)*(numProcs-proc);
200 int procLastID = procFirstID+procNumIDs - 1;
206 &queryProc1, NULL, NULL);
208 &queryProc2, NULL, NULL);
212 if (queryProc1 != proc || queryProc2 != proc) {
224 int myPID = Comm.
MyPID();
227 if (numProcs < 2)
return(0);
229 int myFirstID = (myPID+1)*(myPID+1);
232 int* myIDs =
new int[myNumIDs];
234 for(i=0; i<myNumIDs-1; ++i) {
235 myIDs[i] = myFirstID+i;
238 int nextProc = myPID+1;
239 if (nextProc >= numProcs) nextProc = 0;
241 int nextProcFirstID = (nextProc+1)*(nextProc+1);
242 myIDs[myNumIDs-1] = nextProcFirstID;
262 int myPID = Comm.
MyPID();
265 if (numProcs < 2)
return(0);
269 int numMyGIDs = 2*num;
270 int myFirstGID = myPID*num;
272 int* myGIDs =
new int[numMyGIDs];
274 for(
int i=0; i<numMyGIDs; ++i) {
275 myGIDs[i] = myFirstGID+i;
278 Epetra_Map overlappingmap(-1, numMyGIDs, myGIDs, 0, Comm);
287 bool use_high_sharing_proc =
true;
296 if (numGlobal1 != numGlobal2) {
302 if (numGlobal0 <= numGlobal1) {
311 if ((myPID==0 || myPID==numProcs-1) && numLocal1 == numLocal2) {
320 int myPID = Comm.
MyPID();
323 if (numProcs < 2)
return(0);
327 int numMyGIDs = 2*num;
328 int myFirstGID = myPID*num;
330 int* myGIDs =
new int[numMyGIDs];
331 int* sizes =
new int[numMyGIDs];
333 for(
int i=0; i<numMyGIDs; ++i) {
334 myGIDs[i] = myFirstGID+i;
335 sizes[i] = myFirstGID+i+1;
348 bool use_high_sharing_proc =
true;
357 if (numGlobal1 != numGlobal2) {
363 if (numGlobal0 <= numGlobal1) {
372 if ((myPID==0 || myPID==numProcs-1) && numLocal1 == numLocal2) {
int NumGlobalElements() const
Number of elements across all processors.
Epetra_Map: A class for partitioning vectors and matrices.
int directory_test_3(Epetra_Comm &Comm)
static Epetra_Map Create_OneToOne_Map(const Epetra_Map &usermap, bool high_rank_proc_owns_shared=false)
Epetra_Util Create_OneToOne_Map function.
#define EPETRA_TEST_ERR(a, b)
virtual Epetra_Directory * CreateDirectory(const Epetra_BlockMap &Map) const =0
Create a directory object for the given Epetra_BlockMap.
static void SetTracebackMode(int TracebackModeValue)
Set the value of the Epetra_Object error traceback report mode.
virtual bool GIDsAllUniquelyOwned() const =0
GIDsAllUniquelyOwned: returns true if all GIDs appear on just one processor.
int MyPID() const
Return my process ID.
Epetra_MpiComm: The Epetra MPI Communication Class.
virtual int GetDirectoryEntries(const Epetra_BlockMap &Map, const int NumEntries, const int *GlobalEntries, int *Procs, int *LocalEntries, int *EntrySizes, bool high_rank_sharing_procs=false) const =0
GetDirectoryEntries : Returns proc and local id info for non-local map entries.
std::string Epetra_Version()
int directory_test_4(Epetra_Comm &Comm)
virtual int MyPID() const =0
Return my process ID.
int NumMyElements() const
Number of elements on the calling processor.
Epetra_Directory: This class is a pure virtual class whose interface allows Epetra_Map and Epetr_Bloc...
static Epetra_BlockMap Create_OneToOne_BlockMap(const Epetra_BlockMap &usermap, bool high_rank_proc_owns_shared=false)
Epetra_Util Create_OneToOne_Map function.
Epetra_Comm: The Epetra Communication Abstract Base Class.
Epetra_BlockMap: A class for partitioning block element vectors and matrices.
int directory_test_5(Epetra_Comm &Comm)
int directory_test_2(Epetra_Comm &Comm)
Epetra_SerialComm: The Epetra Serial Communication Class.
int directory_test_1(Epetra_Comm &Comm)
virtual int NumProc() const =0
Returns total number of processes.
int main(int argc, char *argv[])
int Broadcast(double *MyVals, int Count, int Root) const
Epetra_SerialComm Broadcast function.