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) {
323 err =
A->SumIntoGlobalValues(epetra_nodes,
324 epetra_values, format);
325 if (err<0)
return(err);
328 err =
A->InsertGlobalValues(epetra_nodes,
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) {
337 err =
A->SumIntoGlobalValues(numNodesPerElem, nodes,
339 if (err<0)
return(err);
342 err =
A->InsertGlobalValues(numNodesPerElem, nodes,
344 if (err<0)
return(err);
349 nodes[0] = 3; nodes[1] = 4; nodes[2] = 7; nodes[3] = 6;
350 if (preconstruct_graph) {
351 err =
A->SumIntoGlobalValues(numNodesPerElem, nodes,
352 numNodesPerElem, nodes,
354 if (err<0)
return(err);
357 err =
A->InsertGlobalValues(numNodesPerElem, nodes,
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) {
367 err =
A->SumIntoGlobalValues(numNodesPerElem, nodes,
368 numNodesPerElem, nodes,
370 if (err<0)
return(err);
373 err =
A->InsertGlobalValues(numNodesPerElem, nodes,
374 numNodesPerElem, nodes,
376 if (err<0)
return(err);
382 err =
A->GlobalAssemble();
397 A->Multiply(
false, x, y);
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;