Epetra Package Browser (Single Doxygen Collection) Development
FECrsGraph_LL/ExecuteTestProblems.cpp
Go to the documentation of this file.
00001 //@HEADER
00002 // ************************************************************************
00003 //
00004 //               Epetra: Linear Algebra Services Package
00005 //                 Copyright 2011 Sandia Corporation
00006 //
00007 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00008 // the U.S. Government retains certain rights in this software.
00009 //
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
00038 //
00039 // ************************************************************************
00040 //@HEADER
00041 
00042 
00043 #include "Epetra_BLAS.h"
00044 #include "ExecuteTestProblems.h"
00045 #include "Epetra_Comm.h"
00046 #include "Epetra_Map.h"
00047 #include "Epetra_Vector.h"
00048 #include "Epetra_FECrsGraph.h"
00049 #include "Epetra_FECrsMatrix.h"
00050 #include "Epetra_IntSerialDenseVector.h"
00051 #include "Epetra_SerialDenseMatrix.h"
00052 
00053 
00054 int Drumm1(const Epetra_Map& map, bool verbose)
00055 {
00056   //Simple 2-element problem (element as in "finite-element") from
00057   //Clif Drumm. Two triangular elements, one per processor, as shown
00058   //here:
00059   //
00060   //   *----*
00061   //  3|\  2|
00062   //   | \  |
00063   //   | 0\1|
00064   //   |   \|
00065   //   *----*
00066   //  0    1
00067   //
00068   //Element 0 on processor 0, element 1 on processor 1.
00069   //Processor 0 will own nodes 0,1 and processor 1 will own nodes 2,3.
00070   //Each processor will pass a 3x3 element-connectivity-matrix to
00071   //Epetra_FECrsGraph.
00072   //After GlobalAssemble(), the graph should be as follows:
00073   //
00074   //         row 0: 2  1  0  1
00075   //proc 0   row 1: 1  4  1  2
00076   //----------------------------------
00077   //         row 2: 0  1  2  1
00078   //proc 1   row 3: 1  2  1  4
00079   //
00080 
00081   int numProcs = map.Comm().NumProc();
00082   int localProc = map.Comm().MyPID();
00083 
00084   if (numProcs != 2) return(0);
00085 
00086   long long indexBase = 0;
00087   int ierr = 0;
00088 
00089   int numMyNodes = 2;
00090   long long* myNodes = new long long[numMyNodes];
00091 
00092   if (localProc == 0) {
00093     myNodes[0] = 0;
00094     myNodes[1] = 1;
00095   }
00096   else {
00097     myNodes[0] = 2;
00098     myNodes[1] = 3;
00099   }
00100 
00101   Epetra_Map Map((long long) -1, numMyNodes, myNodes, indexBase, map.Comm());
00102 
00103   delete [] myNodes;
00104   numMyNodes = 3;
00105   myNodes = new long long[numMyNodes];
00106 
00107   if (localProc == 0) {
00108     myNodes[0] = 0;
00109     myNodes[1] = 1;
00110     myNodes[2] = 3;
00111   }
00112   else {
00113     myNodes[0] = 1;
00114     myNodes[1] = 2;
00115     myNodes[2] = 3;
00116   }
00117 
00118   int rowLengths = 3;
00119   Epetra_FECrsGraph A(Copy, Map, rowLengths);
00120 
00121   EPETRA_TEST_ERR( A.InsertGlobalIndices(numMyNodes, myNodes,
00122            numMyNodes, myNodes),ierr);
00123 
00124   EPETRA_TEST_ERR( A.GlobalAssemble(), ierr );
00125 
00126   if (verbose) {
00127     A.Print(std::cout);
00128   }
00129 
00130   delete [] myNodes;
00131 
00132   return(0);
00133 }
00134 
00135 int Drumm2(const Epetra_Map& map, bool verbose)
00136 {
00137   //Simple 2-element problem (element as in "finite-element") from
00138   //Clif Drumm. Two triangular elements, one per processor, as shown
00139   //here:
00140   //
00141   //   *----*
00142   //  3|\  2|
00143   //   | \  |
00144   //   | 0\1|
00145   //   |   \|
00146   //   *----*
00147   //  0    1
00148   //
00149   //Element 0 on processor 0, element 1 on processor 1.
00150   //Processor 0 will own nodes 0,1,3 and processor 1 will own node 2.
00151   //Each processor will pass a 3x3 element-connectivity-matrix to
00152   //Epetra_FECrsGraph.
00153   //After GlobalAssemble(), the graph should be as follows:
00154   //
00155   //         row 0: 2  1  0  1
00156   //proc 0   row 1: 1  4  1  2
00157   //         row 2: 0  1  2  1
00158   //----------------------------------
00159   //proc 1   row 3: 1  2  1  4
00160   //
00161 
00162   int numProcs = map.Comm().NumProc();
00163   int localProc = map.Comm().MyPID();
00164 
00165   if (numProcs != 2) return(0);
00166 
00167   long long indexBase = 0;
00168   int ierr = 0;
00169   int numMyNodes = 3;
00170   long long* myNodes = new long long[numMyNodes];
00171 
00172   if (localProc == 0) {
00173     myNodes[0] = 0;
00174     myNodes[1] = 1;
00175     myNodes[2] = 3;
00176   }
00177   else {
00178     numMyNodes = 1;
00179     myNodes[0] = 2;
00180   }
00181 
00182   Epetra_Map Map((long long) -1, numMyNodes, myNodes, indexBase, map.Comm());
00183 
00184   int rowLengths = 3;
00185   Epetra_FECrsGraph A(Copy, Map, rowLengths);
00186 
00187   if (localProc != 0) {
00188     numMyNodes = 3;
00189     myNodes[0] = 1;
00190     myNodes[1] = 2;
00191     myNodes[2] = 3;
00192   }
00193 
00194   EPETRA_TEST_ERR( A.InsertGlobalIndices(numMyNodes, myNodes,
00195            numMyNodes, myNodes),ierr);
00196 
00197   EPETRA_TEST_ERR( A.GlobalAssemble(), ierr );
00198 
00199   if (verbose) {
00200     A.Print(std::cout);
00201   }
00202 
00203   delete [] myNodes;
00204 
00205   return(0);
00206 }
00207 
00208 int four_quads(const Epetra_Comm& Comm, bool preconstruct_graph, bool verbose)
00209 {
00210   if (verbose) {
00211     std::cout << "******************* four_quads ***********************"<<std::endl;
00212   }
00213 
00214   //This function assembles a matrix representing a finite-element
00215   //mesh of four 2-D quad elements. There are 9 nodes in the problem. The
00216   //same problem is assembled no matter how many processors are being used
00217   //(within reason). It may not work if more than 9 processors are used.
00218   //
00219   //  *------*------*
00220   // 6|     7|     8|
00221   //  | E2   | E3   |
00222   //  *------*------*
00223   // 3|     4|     5|
00224   //  | E0   | E1   |
00225   //  *------*------*
00226   // 0      1      2
00227   //
00228   //Nodes are denoted by * with node-numbers below and left of each node.
00229   //E0, E1 and so on are element-numbers.
00230   //
00231   //Each processor will contribute a sub-matrix of size 4x4, filled with 1's,
00232   //for each element. Thus, the coefficient value at position 0,0 should end up
00233   //being 1.0*numProcs, the value at position 4,4 should be 1.0*4*numProcs, etc.
00234   //
00235   //Depending on the number of processors being used, the locations of the
00236   //specific matrix positions (in terms of which processor owns them) will vary.
00237   //
00238 
00239   int numProcs = Comm.NumProc();
00240 
00241   long long numNodes = 9;
00242   int numElems = 4;
00243   int numNodesPerElem = 4;
00244 
00245   long long indexBase = 0;
00246 
00247   //Create a map using epetra-defined linear distribution.
00248   Epetra_Map map(numNodes, indexBase, Comm);
00249 
00250   Epetra_FECrsGraph* graph = NULL;
00251 
00252   long long* nodes = new long long[numNodesPerElem];
00253   int i, err = 0;
00254 
00255   if (preconstruct_graph) {
00256     graph = new Epetra_FECrsGraph(Copy, map, 1);
00257 
00258     //we're going to fill the graph with indices, by passing our
00259     //connectivity lists.
00260     //FECrsGraph should accept indices in all rows, regardless of
00261     //whether map.MyGID(row) is true.
00262 
00263     for(i=0; i<numElems; ++i) {
00264       switch(i) {
00265       case 0:
00266   nodes[0] = 0; nodes[1] = 1; nodes[2] = 4; nodes[3] = 3;
00267   break;
00268       case 1:
00269   nodes[0] = 1; nodes[1] = 2; nodes[2] = 5; nodes[3] = 4;
00270   break;
00271       case 2:
00272   nodes[0] = 3; nodes[1] = 4; nodes[2] = 7; nodes[3] = 6;
00273   break;
00274       case 3:
00275   nodes[0] = 4; nodes[1] = 5; nodes[2] = 8; nodes[3] = 7;
00276   break;
00277       }
00278 
00279       err = graph->InsertGlobalIndices(numNodesPerElem, nodes,
00280                                        numNodesPerElem, nodes);
00281       if (err < 0) {
00282         std::cerr << "ERROR, FECrsGraph error in InsertGlobalIndices, err="
00283           << err << std::endl;
00284         return(-1);
00285       }
00286     }
00287 
00288     EPETRA_CHK_ERR( graph->GlobalAssemble() );
00289   }
00290 
00291   Epetra_FECrsMatrix* A = NULL;
00292 
00293   if (preconstruct_graph) {
00294     A = new Epetra_FECrsMatrix(Copy, *graph);
00295   }
00296   else {
00297     A = new Epetra_FECrsMatrix(Copy, map, 1);
00298   }
00299 
00300   EPETRA_CHK_ERR( A->PutScalar(0.0) );
00301 
00302   double* values_1d = new double[numNodesPerElem*numNodesPerElem];
00303   double** values_2d = new double*[numNodesPerElem];
00304 
00305   for(i=0; i<numNodesPerElem*numNodesPerElem; ++i) values_1d[i] = 1.0;
00306 
00307   int offset = 0;
00308   for(i=0; i<numNodesPerElem; ++i) {
00309     values_2d[i] = &(values_1d[offset]);
00310     offset += numNodesPerElem;
00311   }
00312 
00313   int format = Epetra_FECrsMatrix::ROW_MAJOR;
00314   Epetra_LongLongSerialDenseVector epetra_nodes(View, nodes, numNodesPerElem);
00315   Epetra_SerialDenseMatrix epetra_values(View, values_1d, numNodesPerElem,
00316            numNodesPerElem, numNodesPerElem);
00317 
00318   for(i=0; i<numElems; ++i) {
00319     switch(i) {
00320     case 0:
00321       nodes[0] = 0; nodes[1] = 1; nodes[2] = 4; nodes[3] = 3;
00322       if (preconstruct_graph) {
00323   err = A->SumIntoGlobalValues(epetra_nodes,
00324              epetra_values, format);
00325   if (err<0) return(err);
00326       }
00327       else {
00328   err = A->InsertGlobalValues(epetra_nodes,
00329             epetra_values, format);
00330   if (err<0) return(err);
00331       }
00332       break;
00333 
00334     case 1:
00335       nodes[0] = 1; nodes[1] = 2; nodes[2] = 5; nodes[3] = 4;
00336       if (preconstruct_graph) {
00337   err = A->SumIntoGlobalValues(numNodesPerElem, nodes,
00338              values_2d, format);
00339   if (err<0) return(err);
00340       }
00341       else {
00342   err = A->InsertGlobalValues(numNodesPerElem, nodes,
00343             values_2d, format);
00344   if (err<0) return(err);
00345       }
00346       break;
00347 
00348     case 2:
00349       nodes[0] = 3; nodes[1] = 4; nodes[2] = 7; nodes[3] = 6;
00350       if (preconstruct_graph) {
00351   err = A->SumIntoGlobalValues(numNodesPerElem, nodes,
00352              numNodesPerElem, nodes,
00353              values_1d, format);
00354   if (err<0) return(err);
00355       }
00356       else {
00357   err = A->InsertGlobalValues(numNodesPerElem, nodes,
00358             numNodesPerElem, nodes,
00359             values_1d, format);
00360   if (err<0) return(err);
00361       }
00362       break;
00363 
00364      case 3:
00365       nodes[0] = 4; nodes[1] = 5; nodes[2] = 8; nodes[3] = 7;
00366       if (preconstruct_graph) {
00367   err = A->SumIntoGlobalValues(numNodesPerElem, nodes,
00368              numNodesPerElem, nodes,
00369              values_2d, format);
00370   if (err<0) return(err);
00371       }
00372       else {
00373   err = A->InsertGlobalValues(numNodesPerElem, nodes,
00374             numNodesPerElem, nodes,
00375             values_2d, format);
00376   if (err<0) return(err);
00377       }
00378       break;
00379     }
00380   }
00381 
00382   err = A->GlobalAssemble();
00383   if (err < 0) {
00384     return(err);
00385   }
00386 
00387   Epetra_Vector x(A->RowMap()), y(A->RowMap());
00388 
00389   x.PutScalar(1.0); y.PutScalar(0.0);
00390 
00391   Epetra_FECrsMatrix Acopy(*A);
00392 
00393   Epetra_Vector x2(Acopy.RowMap()), y2(Acopy.RowMap());
00394 
00395   x2.PutScalar(1.0); y2.PutScalar(0.0);
00396 
00397   A->Multiply(false, x, y);
00398 
00399   Acopy.Multiply(false, x2, y2);
00400 
00401   double ynorm2, y2norm2;
00402 
00403   y.Norm2(&ynorm2);
00404   y2.Norm2(&y2norm2);
00405   if (ynorm2 != y2norm2) {
00406     std::cerr << "norm2(A*ones) != norm2(Acopy*ones)"<<std::endl;
00407     return(-99);
00408   }
00409 
00410   err = Acopy.GlobalAssemble();
00411   if (err < 0) {
00412     return(err);
00413   }
00414 
00415   if (verbose) {
00416     std::cout << "A:"<<std::endl<<*A << std::endl;
00417     std::cout << "Acopy:"<<std::endl<<Acopy << std::endl;
00418   }
00419 
00420   Epetra_FECrsMatrix Acopy2(Copy, A->RowMap(), A->ColMap(), 1);
00421 
00422   Acopy2 = Acopy;
00423 
00424   Epetra_Vector x3(Acopy.RowMap()), y3(Acopy.RowMap());
00425 
00426   x3.PutScalar(1.0); y3.PutScalar(0.0);
00427 
00428   Acopy2.Multiply(false, x3, y3);
00429 
00430   double y3norm2;
00431   y3.Norm2(&y3norm2);
00432 
00433   if (y3norm2 != y2norm2) {
00434     std::cerr << "norm2(Acopy*ones) != norm2(Acopy2*ones)"<<std::endl;
00435     return(-999);
00436   }
00437 
00438   int len = 20;
00439   long long* indices = new long long[len];
00440   double* values = new double[len];
00441   int numIndices;
00442 
00443   if (map.MyGID(0)) {
00444     EPETRA_CHK_ERR( A->ExtractGlobalRowCopy(0, len, numIndices,
00445               values, indices) );
00446     if (numIndices != 4) {
00447       return(-1);
00448     }
00449     if (indices[0] != 0) {
00450       return(-2);
00451     }
00452 
00453     if (values[0] != 1.0*numProcs) {
00454       std::cout << "ERROR: values[0] ("<<values[0]<<") should be "<<numProcs<<std::endl;
00455       return(-3);
00456     }
00457   }
00458 
00459   if (map.MyGID(4)) {
00460     EPETRA_CHK_ERR( A->ExtractGlobalRowCopy(4, len, numIndices,
00461               values, indices) );
00462 
00463     if (numIndices != 9) {
00464       return(-4);
00465     }
00466     int lcid = A->LCID(4);
00467     if (lcid<0) {
00468       return(-5);
00469     }
00470     if (values[lcid] != 4.0*numProcs) {
00471       std::cout << "ERROR: values["<<lcid<<"] ("<<values[lcid]<<") should be "
00472      <<4*numProcs<<std::endl;
00473       return(-6);
00474     }
00475   }
00476 
00477 // now let's do the checks for Acopy...
00478 
00479   if (map.MyGID(0)) {
00480     EPETRA_CHK_ERR( Acopy.ExtractGlobalRowCopy(0, len, numIndices,
00481                                             values, indices) );
00482     if (numIndices != 4) {
00483       return(-1);
00484     }
00485     if (indices[0] != 0) {
00486       return(-2);
00487     }
00488 
00489     if (values[0] != 1.0*numProcs) {
00490       std::cout << "ERROR: Acopy.values[0] ("<<values[0]<<") should be "<<numProcs<<std::endl;
00491       return(-3);
00492     }
00493   }
00494 
00495   if (map.MyGID(4)) {
00496     EPETRA_CHK_ERR( Acopy.ExtractGlobalRowCopy(4, len, numIndices,
00497                                             values, indices) );
00498 
00499     if (numIndices != 9) {
00500       return(-4);
00501     }
00502     int lcid = A->LCID(4);
00503     if (lcid<0) {
00504       return(-5);
00505     }
00506     if (values[lcid] != 4.0*numProcs) {
00507       std::cout << "ERROR: Acopy.values["<<lcid<<"] ("<<values[lcid]<<") should be "
00508            <<4*numProcs<<std::endl;
00509       return(-6);
00510     }
00511   }
00512 
00513 // now let's do the checks for Acopy2...
00514 
00515   if (map.MyGID(0)) {
00516     EPETRA_CHK_ERR( Acopy2.ExtractGlobalRowCopy(0, len, numIndices,
00517                                             values, indices) );
00518     if (numIndices != 4) {
00519       return(-1);
00520     }
00521     if (indices[0] != 0) {
00522       return(-2);
00523     }
00524 
00525     if (values[0] != 1.0*numProcs) {
00526       std::cout << "ERROR: Acopy2.values[0] ("<<values[0]<<") should be "<<numProcs<<std::endl;
00527       return(-3);
00528     }
00529   }
00530 
00531   if (map.MyGID(4)) {
00532     EPETRA_CHK_ERR( Acopy2.ExtractGlobalRowCopy(4, len, numIndices,
00533                                             values, indices) );
00534 
00535     if (numIndices != 9) {
00536       return(-4);
00537     }
00538     int lcid = A->LCID(4);
00539     if (lcid<0) {
00540       return(-5);
00541     }
00542     if (values[lcid] != 4.0*numProcs) {
00543       std::cout << "ERROR: Acopy2.values["<<lcid<<"] ("<<values[lcid]<<") should be "
00544            <<4*numProcs<<std::endl;
00545       return(-6);
00546     }
00547   }
00548 
00549   delete [] values_2d;
00550   delete [] values_1d;
00551   delete [] nodes;
00552   delete [] indices;
00553   delete [] values;
00554 
00555   delete A;
00556   delete graph;
00557 
00558   return(0);
00559 }
00560 
00561 int Young1(const Epetra_Comm& Comm, bool verbose)
00562 {
00563   //This is a test case submitted by Joe Young with bug 2421. It runs
00564   //only on 2 processors.
00565   if (Comm.NumProc() != 2) {
00566     return(0);
00567   }
00568 
00569   // Give rows 0-2 to proc 0 and 3-5 to proc 1
00570   long long             RowIndices[3];
00571   if (Comm.MyPID() == 0) {
00572     RowIndices[0] = 0;
00573     RowIndices[1] = 1;
00574     RowIndices[2] = 2;
00575   } else {
00576     RowIndices[0] = 3;
00577     RowIndices[1] = 4;
00578     RowIndices[2] = 5;
00579   }
00580   Epetra_Map      RangeMap((long long) -1, 3, RowIndices, 0LL, Comm);
00581   Epetra_Map & RowMap = RangeMap;
00582 
00583   // Define a second map that gives col 0 to proc 0 and col 1 to proc 1
00584   long long             ColIndices[1];
00585   if (Comm.MyPID() == 0) {
00586     ColIndices[0] = 0;
00587   }
00588   else {
00589     ColIndices[0] = 1;
00590   }
00591   Epetra_Map      DomainMap((long long) -1, 1, ColIndices, 0LL, Comm);
00592 
00593   // Construct a graph where both processors only insert into local
00594   // elements
00595   Epetra_FECrsGraph BrokenGraph(Copy, RowMap, 2);
00596   for (int i = 0; i < RangeMap.NumMyElements(); i++) {
00597     long long             ig = RowIndices[i];
00598     long long             jgs[2] = { 0, 1 };
00599     BrokenGraph.InsertGlobalIndices(1, &ig, 2, jgs);
00600   }
00601   BrokenGraph.GlobalAssemble(DomainMap, RangeMap);
00602 
00603   // Check the size of the matrix that would be created from the graph
00604   long long numCols1 = BrokenGraph.NumGlobalCols64();
00605   if (verbose) {
00606     std::cout << "Number of global rows in the graph where only "
00607         "local elements were inserted: " << BrokenGraph.NumGlobalRows64()
00608       << std::endl;
00609     std::cout << "Number of global cols in the graph where only "
00610         "local elements were inserted: " << BrokenGraph.NumGlobalCols64()
00611       << std::endl;
00612   }
00613   // Construct a graph where both processors insert into global elements
00614   Epetra_FECrsGraph Graph(Copy, RowMap, 2);
00615   for (int i = 0; i < 6; i++) {
00616     long long             ig = i;
00617     long long             jgs[2] = { 0, 1 };
00618     Graph.InsertGlobalIndices(1, &ig, 2, jgs);
00619   }
00620   Graph.GlobalAssemble(DomainMap, RangeMap);
00621 
00622   // Check the size of the matrix that would be created from the graph
00623   long long numCols2 = Graph.NumGlobalCols64();
00624   if (verbose) {
00625     std::cout << "Number of global rows in the graph where "
00626         "global elements were inserted: " << Graph.NumGlobalRows64()
00627        << std::endl;
00628     std::cout << "Number of global cols in the graph where "
00629         "global elements were inserted: " << Graph.NumGlobalCols64()
00630       << std::endl;
00631   }
00632 
00633   if (numCols1 != numCols2) return(-1);
00634   return(0);
00635 }
00636 
00637 int rectangular(const Epetra_Comm& Comm, bool verbose)
00638 {
00639   int mypid = Comm.MyPID();
00640   int numlocalrows = 3;
00641   Epetra_Map rowmap((long long) -1, numlocalrows, 0LL, Comm);
00642 
00643   long long numglobalrows = numlocalrows*Comm.NumProc();
00644 
00645   long long numcols = 2*numglobalrows;
00646 
00647   Epetra_FECrsGraph fegraph(Copy, rowmap, numcols);
00648 
00649   long long* cols = new long long[numcols];
00650   for(int j=0; j<numcols; ++j) cols[j] = j;
00651 
00652   Epetra_Map domainmap((long long) -1, numcols, 0LL, Comm);
00653 
00654   long long firstlocalrow = numlocalrows*mypid;
00655   long long lastlocalrow = numlocalrows*(mypid+1)-1;
00656 
00657   for(long long i=0; i<numglobalrows; ++i) {
00658     //if i is a local row, then skip it. We want each processor to only
00659     //load rows that belong on other processors.
00660     if (i >= firstlocalrow && i <= lastlocalrow) continue;
00661 
00662     EPETRA_CHK_ERR( fegraph.InsertGlobalIndices(1, &i, numcols, &(cols[0])) );
00663   }
00664 
00665   EPETRA_CHK_ERR( fegraph.GlobalAssemble(domainmap, rowmap) );
00666 
00667   if (verbose) {
00668     std::cout << "********************** fegraph **********************" << std::endl;
00669     std::cout << fegraph << std::endl;
00670   }
00671 
00672   delete [] cols;
00673 
00674   return(0);
00675 }
00676 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines