84 if (numProcs != 2)
return(0);
86 int indexBase = 0, ierr = 0;
89 int* myNodes =
new int[numMyNodes];
104 myNodes =
new int[numMyNodes];
106 if (localProc == 0) {
121 numMyNodes, myNodes),ierr);
164 if (numProcs != 2)
return(0);
166 int indexBase = 0, ierr = 0;
168 int* myNodes =
new int[numMyNodes];
170 if (localProc == 0) {
185 if (localProc != 0) {
193 numMyNodes, myNodes),ierr);
209 std::cout <<
"******************* four_quads ***********************"<<std::endl;
241 int numNodesPerElem = 4;
250 int* nodes =
new int[numNodesPerElem];
253 if (preconstruct_graph) {
261 for(i=0; i<numElems; ++i) {
264 nodes[0] = 0; nodes[1] = 1; nodes[2] = 4; nodes[3] = 3;
267 nodes[0] = 1; nodes[1] = 2; nodes[2] = 5; nodes[3] = 4;
270 nodes[0] = 3; nodes[1] = 4; nodes[2] = 7; nodes[3] = 6;
273 nodes[0] = 4; nodes[1] = 5; nodes[2] = 8; nodes[3] = 7;
278 numNodesPerElem, nodes);
280 std::cerr <<
"ERROR, FECrsGraph error in InsertGlobalIndices, err="
291 if (preconstruct_graph) {
300 double* values_1d =
new double[numNodesPerElem*numNodesPerElem];
301 double** values_2d =
new double*[numNodesPerElem];
303 for(i=0; i<numNodesPerElem*numNodesPerElem; ++i) values_1d[i] = 1.0;
306 for(i=0; i<numNodesPerElem; ++i) {
307 values_2d[i] = &(values_1d[offset]);
308 offset += numNodesPerElem;
314 numNodesPerElem, numNodesPerElem);
316 for(i=0; i<numElems; ++i) {
319 nodes[0] = 0; nodes[1] = 1; nodes[2] = 4; nodes[3] = 3;
320 if (preconstruct_graph) {
322 epetra_values, format);
323 if (err<0)
return(err);
327 epetra_values, format);
328 if (err<0)
return(err);
333 nodes[0] = 1; nodes[1] = 2; nodes[2] = 5; nodes[3] = 4;
334 if (preconstruct_graph) {
337 if (err<0)
return(err);
342 if (err<0)
return(err);
347 nodes[0] = 3; nodes[1] = 4; nodes[2] = 7; nodes[3] = 6;
348 if (preconstruct_graph) {
350 numNodesPerElem, nodes,
352 if (err<0)
return(err);
356 numNodesPerElem, nodes,
358 if (err<0)
return(err);
363 nodes[0] = 4; nodes[1] = 5; nodes[2] = 8; nodes[3] = 7;
364 if (preconstruct_graph) {
366 numNodesPerElem, nodes,
368 if (err<0)
return(err);
372 numNodesPerElem, nodes,
374 if (err<0)
return(err);
399 double ynorm2, y2norm2;
403 if (ynorm2 != y2norm2) {
404 std::cerr <<
"norm2(A*ones) != norm2(Acopy*ones)"<<std::endl;
414 std::cout <<
"A:"<<std::endl<<*A << std::endl;
415 std::cout <<
"Acopy:"<<std::endl<<Acopy << std::endl;
426 Acopy2.Multiply(
false, x3, y3);
431 if (y3norm2 != y2norm2) {
432 std::cerr <<
"norm2(Acopy*ones) != norm2(Acopy2*ones)"<<std::endl;
437 int* indices =
new int[len];
438 double* values =
new double[len];
444 if (numIndices != 4) {
447 if (indices[0] != 0) {
451 if (values[0] != 1.0*numProcs) {
452 std::cout <<
"ERROR: values[0] ("<<values[0]<<
") should be "<<numProcs<<std::endl;
461 if (numIndices != 9) {
464 int lcid = A->
LCID(4);
468 if (values[lcid] != 4.0*numProcs) {
469 std::cout <<
"ERROR: values["<<lcid<<
"] ("<<values[lcid]<<
") should be "
470 <<4*numProcs<<std::endl;
480 if (numIndices != 4) {
483 if (indices[0] != 0) {
487 if (values[0] != 1.0*numProcs) {
488 std::cout <<
"ERROR: Acopy.values[0] ("<<values[0]<<
") should be "<<numProcs<<std::endl;
497 if (numIndices != 9) {
500 int lcid = A->
LCID(4);
504 if (values[lcid] != 4.0*numProcs) {
505 std::cout <<
"ERROR: Acopy.values["<<lcid<<
"] ("<<values[lcid]<<
") should be "
506 <<4*numProcs<<std::endl;
516 if (numIndices != 4) {
519 if (indices[0] != 0) {
523 if (values[0] != 1.0*numProcs) {
524 std::cout <<
"ERROR: Acopy2.values[0] ("<<values[0]<<
") should be "<<numProcs<<std::endl;
533 if (numIndices != 9) {
536 int lcid = A->
LCID(4);
540 if (values[lcid] != 4.0*numProcs) {
541 std::cout <<
"ERROR: Acopy2.values["<<lcid<<
"] ("<<values[lcid]<<
") should be "
542 <<4*numProcs<<std::endl;
569 if (Comm.
MyPID() == 0) {
578 Epetra_Map RangeMap(-1, 3, RowIndices, 0, Comm);
583 if (Comm.
MyPID() == 0) {
589 Epetra_Map DomainMap(-1, 1, ColIndices, 0, Comm);
595 int ig = RowIndices[i];
596 int jgs[2] = { 0, 1 };
604 std::cout <<
"Number of global rows in the graph where only "
605 "local elements were inserted: " << BrokenGraph.
NumGlobalRows()
607 std::cout <<
"Number of global cols in the graph where only "
608 "local elements were inserted: " << BrokenGraph.
NumGlobalCols()
613 for (
int i = 0; i < 6; i++) {
615 int jgs[2] = { 0, 1 };
623 std::cout <<
"Number of global rows in the graph where "
626 std::cout <<
"Number of global cols in the graph where "
631 if (numCols1 != numCols2)
return(-1);
637 int mypid = Comm.
MyPID();
638 int numlocalrows = 3;
641 int numglobalrows = numlocalrows*Comm.
NumProc();
643 int numcols = 2*numglobalrows;
647 int* cols =
new int[numcols];
648 for(
int j=0; j<numcols; ++j) cols[j] = j;
652 int firstlocalrow = numlocalrows*mypid;
653 int lastlocalrow = numlocalrows*(mypid+1)-1;
655 for(
int i=0; i<numglobalrows; ++i) {
658 if (i >= firstlocalrow && i <= lastlocalrow)
continue;
666 std::cout <<
"********************** fegraph **********************" << std::endl;
667 std::cout << fegraph << std::endl;
int NumGlobalRows() const
Returns the number of matrix rows in global matrix.
Epetra_Map: A class for partitioning vectors and matrices.
int InsertGlobalIndices(int numRows, const int *rows, int numCols, const int *cols)
Insert a rectangular, dense 'submatrix' of entries (matrix nonzero positions) into the graph...
Epetra_IntSerialDenseVector: A class for constructing and using dense vectors.
int Multiply(bool TransA, const Epetra_Vector &x, Epetra_Vector &y) const
Returns the result of a Epetra_CrsMatrix multiplied by a Epetra_Vector x in y.
#define EPETRA_TEST_ERR(a, b)
int PutScalar(double ScalarConstant)
Initialize all values in a multi-vector with constant value.
Epetra Finite-Element CrsGraph.
virtual void Print(std::ostream &os) const
Print method.
#define EPETRA_CHK_ERR(a)
Epetra_Vector: A class for constructing and using dense vectors on a parallel computer.
int GlobalAssemble(bool callFillComplete=true)
Gather any overlapping/shared data into the non-overlapping partitioning defined by the Map that was ...
Epetra_SerialDenseMatrix: A class for constructing and using real double precision general dense matr...
const Epetra_Map & ColMap() const
Returns the Epetra_Map object that describes the set of column-indices that appear in each processor'...
int Drumm1(const Epetra_Map &map, bool verbose)
virtual int MyPID() const =0
Return my process ID.
int InsertGlobalValues(int GlobalRow, int NumEntries, const double *Values, const int *Indices)
override base-class Epetra_CrsMatrix::InsertGlobalValues method
int PutScalar(double ScalarConstant)
Initialize all values in the matrix with constant value.
const Epetra_Map & RowMap() const
Returns the Epetra_Map object associated with the rows of this matrix.
int NumMyElements() const
Number of elements on the calling processor.
Epetra Finite-Element CrsMatrix.
int NumGlobalCols() const
Returns the number of matrix columns in global matrix.
Epetra_Comm: The Epetra Communication Abstract Base Class.
int ExtractGlobalRowCopy(int GlobalRow, int Length, int &NumEntries, double *Values, int *Indices) const
Returns a copy of the specified global row in user-provided arrays.
int LCID(int GCID_in) const
Returns the local column index for given global column index, returns -1 if no local column for this ...
int GlobalAssemble(bool callFillComplete=true, Epetra_CombineMode combineMode=Add, bool save_off_and_reuse_map_exporter=false)
Gather any overlapping/shared data into the non-overlapping partitioning defined by the Map that was ...
bool MyGID(int GID_in) const
Returns true if the GID passed in belongs to the calling processor in this map, otherwise returns fal...
const Epetra_Comm & Comm() const
Access function for Epetra_Comm communicator.
int SumIntoGlobalValues(int GlobalRow, int NumEntries, const double *Values, const int *Indices)
override base-class Epetra_CrsMatrix::SumIntoGlobalValues method
virtual int NumProc() const =0
Returns total number of processes.
int Young1(const Epetra_Comm &Comm, bool verbose)
int rectangular(const Epetra_Comm &Comm, bool verbose)
int Drumm2(const Epetra_Map &map, bool verbose)
int four_quads(const Epetra_Comm &Comm, bool preconstruct_graph, bool verbose)