84 if (numProcs != 2)
return(0);
86 long long indexBase = 0;
90 long long* myNodes =
new long long[numMyNodes];
101 Epetra_Map Map((
long long) -1, numMyNodes, myNodes, indexBase, map.
Comm());
105 myNodes =
new long long[numMyNodes];
107 if (localProc == 0) {
122 numMyNodes, myNodes),ierr);
165 if (numProcs != 2)
return(0);
167 long long indexBase = 0;
170 long long* myNodes =
new long long[numMyNodes];
172 if (localProc == 0) {
182 Epetra_Map Map((
long long) -1, numMyNodes, myNodes, indexBase, map.
Comm());
187 if (localProc != 0) {
195 numMyNodes, myNodes),ierr);
211 std::cout <<
"******************* four_quads ***********************"<<std::endl;
241 long long numNodes = 9;
243 int numNodesPerElem = 4;
245 long long indexBase = 0;
252 long long* nodes =
new long long[numNodesPerElem];
255 if (preconstruct_graph) {
263 for(i=0; i<numElems; ++i) {
266 nodes[0] = 0; nodes[1] = 1; nodes[2] = 4; nodes[3] = 3;
269 nodes[0] = 1; nodes[1] = 2; nodes[2] = 5; nodes[3] = 4;
272 nodes[0] = 3; nodes[1] = 4; nodes[2] = 7; nodes[3] = 6;
275 nodes[0] = 4; nodes[1] = 5; nodes[2] = 8; nodes[3] = 7;
280 numNodesPerElem, nodes);
282 std::cerr <<
"ERROR, FECrsGraph error in InsertGlobalIndices, err="
293 if (preconstruct_graph) {
302 double* values_1d =
new double[numNodesPerElem*numNodesPerElem];
303 double** values_2d =
new double*[numNodesPerElem];
305 for(i=0; i<numNodesPerElem*numNodesPerElem; ++i) values_1d[i] = 1.0;
308 for(i=0; i<numNodesPerElem; ++i) {
309 values_2d[i] = &(values_1d[offset]);
310 offset += numNodesPerElem;
316 numNodesPerElem, numNodesPerElem);
318 for(i=0; i<numElems; ++i) {
321 nodes[0] = 0; nodes[1] = 1; nodes[2] = 4; nodes[3] = 3;
322 if (preconstruct_graph) {
324 epetra_values, format);
325 if (err<0)
return(err);
329 epetra_values, format);
330 if (err<0)
return(err);
335 nodes[0] = 1; nodes[1] = 2; nodes[2] = 5; nodes[3] = 4;
336 if (preconstruct_graph) {
339 if (err<0)
return(err);
344 if (err<0)
return(err);
349 nodes[0] = 3; nodes[1] = 4; nodes[2] = 7; nodes[3] = 6;
350 if (preconstruct_graph) {
352 numNodesPerElem, nodes,
354 if (err<0)
return(err);
358 numNodesPerElem, nodes,
360 if (err<0)
return(err);
365 nodes[0] = 4; nodes[1] = 5; nodes[2] = 8; nodes[3] = 7;
366 if (preconstruct_graph) {
368 numNodesPerElem, nodes,
370 if (err<0)
return(err);
374 numNodesPerElem, nodes,
376 if (err<0)
return(err);
401 double ynorm2, y2norm2;
405 if (ynorm2 != y2norm2) {
406 std::cerr <<
"norm2(A*ones) != norm2(Acopy*ones)"<<std::endl;
416 std::cout <<
"A:"<<std::endl<<*A << std::endl;
417 std::cout <<
"Acopy:"<<std::endl<<Acopy << std::endl;
428 Acopy2.Multiply(
false, x3, y3);
433 if (y3norm2 != y2norm2) {
434 std::cerr <<
"norm2(Acopy*ones) != norm2(Acopy2*ones)"<<std::endl;
439 long long* indices =
new long long[len];
440 double* values =
new double[len];
446 if (numIndices != 4) {
449 if (indices[0] != 0) {
453 if (values[0] != 1.0*numProcs) {
454 std::cout <<
"ERROR: values[0] ("<<values[0]<<
") should be "<<numProcs<<std::endl;
463 if (numIndices != 9) {
466 int lcid = A->
LCID(4);
470 if (values[lcid] != 4.0*numProcs) {
471 std::cout <<
"ERROR: values["<<lcid<<
"] ("<<values[lcid]<<
") should be "
472 <<4*numProcs<<std::endl;
482 if (numIndices != 4) {
485 if (indices[0] != 0) {
489 if (values[0] != 1.0*numProcs) {
490 std::cout <<
"ERROR: Acopy.values[0] ("<<values[0]<<
") should be "<<numProcs<<std::endl;
499 if (numIndices != 9) {
502 int lcid = A->
LCID(4);
506 if (values[lcid] != 4.0*numProcs) {
507 std::cout <<
"ERROR: Acopy.values["<<lcid<<
"] ("<<values[lcid]<<
") should be "
508 <<4*numProcs<<std::endl;
518 if (numIndices != 4) {
521 if (indices[0] != 0) {
525 if (values[0] != 1.0*numProcs) {
526 std::cout <<
"ERROR: Acopy2.values[0] ("<<values[0]<<
") should be "<<numProcs<<std::endl;
535 if (numIndices != 9) {
538 int lcid = A->
LCID(4);
542 if (values[lcid] != 4.0*numProcs) {
543 std::cout <<
"ERROR: Acopy2.values["<<lcid<<
"] ("<<values[lcid]<<
") should be "
544 <<4*numProcs<<std::endl;
570 long long RowIndices[3];
571 if (Comm.
MyPID() == 0) {
580 Epetra_Map RangeMap((
long long) -1, 3, RowIndices, 0LL, Comm);
584 long long ColIndices[1];
585 if (Comm.
MyPID() == 0) {
591 Epetra_Map DomainMap((
long long) -1, 1, ColIndices, 0LL, Comm);
597 long long ig = RowIndices[i];
598 long long jgs[2] = { 0, 1 };
606 std::cout <<
"Number of global rows in the graph where only "
609 std::cout <<
"Number of global cols in the graph where only "
615 for (
int i = 0; i < 6; i++) {
617 long long jgs[2] = { 0, 1 };
625 std::cout <<
"Number of global rows in the graph where "
628 std::cout <<
"Number of global cols in the graph where "
633 if (numCols1 != numCols2)
return(-1);
639 int mypid = Comm.
MyPID();
640 int numlocalrows = 3;
641 Epetra_Map rowmap((
long long) -1, numlocalrows, 0LL, Comm);
643 long long numglobalrows = numlocalrows*Comm.
NumProc();
645 long long numcols = 2*numglobalrows;
649 long long* cols =
new long long[numcols];
650 for(
int j=0; j<numcols; ++j) cols[j] = j;
652 Epetra_Map domainmap((
long long) -1, numcols, 0LL, Comm);
654 long long firstlocalrow = numlocalrows*mypid;
655 long long lastlocalrow = numlocalrows*(mypid+1)-1;
657 for(
long long i=0; i<numglobalrows; ++i) {
660 if (i >= firstlocalrow && i <= lastlocalrow)
continue;
668 std::cout <<
"********************** fegraph **********************" << std::endl;
669 std::cout << fegraph << std::endl;
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...
long long NumGlobalRows64() const
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)
long long NumGlobalCols64() const
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.
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 ...
Epetra_LongLongSerialDenseVector: A class for constructing and using dense vectors.
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)