10 #include <Epetra_config.h>
33 #ifdef EPETRA_NO_32BIT_GLOBAL_INDICES
36 # define EXAMPLE_USES_64BIT_GLOBAL_INDICES 1
39 # ifdef EPETRA_NO_64BIT_GLOBAL_INDICES
44 # define EXAMPLE_USES_64BIT_GLOBAL_INDICES 1
48 # endif // EPETRA_NO_64BIT_GLOBAL_INDICES
49 #endif // EPETRA_NO_32BIT_GLOBAL_INDICES
67 #ifdef EXAMPLE_USES_64BIT_GLOBAL_INDICES
73 #endif // EXAMPLE_USES_64BIT_GLOBAL_INDICES
82 if (numMyElts > 0 && myGblElts == NULL) {
83 throw std::logic_error (
"Failed to get the list of global indices");
92 for (
int i = 0; i < numMyElts; ++i) {
94 if (myGblElts[i] == 0) {
97 tempGblInds[0] = myGblElts[i];
98 tempGblInds[1] = myGblElts[i] + 1;
107 else if (myGblElts[i] == numGblElts - 1) {
110 tempGblInds[0] = myGblElts[i] - 1;
111 tempGblInds[1] = myGblElts[i];
124 tempGblInds[0] = myGblElts[i] - 1;
125 tempGblInds[1] = myGblElts[i];
126 tempGblInds[2] = myGblElts[i] + 1;
138 (void) comm.
MaxAll (&lclerr, &gblerr, 1);
143 throw std::runtime_error (
"Some process failed to insert an entry.");
152 std::ostringstream os;
153 os <<
"A->FillComplete() failed with error code " << gblerr <<
".";
154 throw std::runtime_error (os.str ());
191 const int procZeroMapNumLclElts = (comm.
MyPID () == 0) ?
193 static_cast<global_ordinal_type> (0);
194 Epetra_Map procZeroMap (numGblElts, procZeroMapNumLclElts, indexBase, comm);
198 Epetra_Map globalMap (numGblElts, indexBase, comm);
212 (void) comm.
MaxAll (&lclerr, &gblerr, 1);
214 throw std::runtime_error (
"createCrsMatrix returned NULL on at least one "
257 (void) comm.
MinAll (&lclerr, &gblerr, 1);
259 throw std::runtime_error (
"Export() failed on at least one process.");
261 (void) comm.
MaxAll (&lclerr, &gblerr, 1);
263 throw std::runtime_error (
"Export() failed on at least one process.");
276 (void) comm.
MinAll (&lclerr, &gblerr, 1);
278 throw std::runtime_error (
"B.FillComplete() failed on at least one process.");
280 (void) comm.
MaxAll (&lclerr, &gblerr, 1);
282 throw std::runtime_error (
"B.FillComplete() failed on at least one process.");
298 MPI_Init (&argc, &argv);
304 const int myRank = comm.
MyPID ();
305 const int numProcs = comm.
NumProc ();
310 <<
"Total number of processes: " << numProcs << endl;
317 cout <<
"End Result: TEST PASSED" << endl;
321 (void) MPI_Finalize ();
int NumGlobalElements() const
Number of elements across all processors.
Epetra_Map: A class for partitioning vectors and matrices.
int MyGlobalElements(int *MyGlobalElementList) const
Puts list of global elements on this processor into the user-provided array.
long long NumGlobalElements64() const
virtual int InsertGlobalValues(int GlobalRow, int NumEntries, const double *Values, const int *Indices)
Insert a list of elements in a given global row of the matrix.
Epetra_Export: This class builds an export object for efficient exporting of off-processor elements...
int MyPID() const
Return my process ID.
virtual int MinAll(double *PartialMins, double *GlobalMins, int Count) const =0
Epetra_Comm Global Min function.
Epetra_MpiComm: The Epetra MPI Communication Class.
std::string Epetra_Version()
virtual int MyPID() const =0
Return my process ID.
int FillComplete(bool OptimizeDataStorage=true)
Signal that data entry is complete. Perform transformations to local index space. ...
virtual int MaxAll(double *PartialMaxs, double *GlobalMaxs, int Count) const =0
Epetra_Comm Global Max function.
int NumMyElements() const
Number of elements on the calling processor.
int Export(const Epetra_SrcDistObject &A, const Epetra_Import &Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)
Exports an Epetra_DistObject using the Epetra_Import object.
Epetra_CrsMatrix * createCrsMatrix(const Epetra_Map &map)
Epetra_Comm: The Epetra Communication Abstract Base Class.
long long global_ordinal_type
int NumProc() const
Returns total number of processes (always returns 1 for SerialComm).
const Epetra_Comm & Comm() const
Access function for Epetra_Comm communicator.
Epetra_SerialComm: The Epetra Serial Communication Class.
void example(const Epetra_Comm &comm)
virtual int NumProc() const =0
Returns total number of processes.
Epetra_CrsMatrix: A class for constructing and using real-valued double-precision sparse compressed r...
int main(int argc, char *argv[])
long long * MyGlobalElements64() const