Epetra Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
test/FusedImportExport_LL/cxx_main.cpp
Go to the documentation of this file.
1 //@HEADER
2 // ************************************************************************
3 //
4 // Epetra: Linear Algebra Services Package
5 // Copyright 2011 Sandia Corporation
6 //
7 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8 // the U.S. Government retains certain rights in this software.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ************************************************************************
40 //@HEADER
41 
42 
43 #include "Epetra_Map.h"
44 #include "Epetra_Time.h"
45 #include "Epetra_CrsMatrix.h"
46 #include "Epetra_Import.h"
47 #include "Epetra_Export.h"
48 #include "Epetra_Util.h"
49 #include "Epetra_Vector.h"
50 #include "Epetra_Flops.h"
51 
52 #ifdef EPETRA_MPI
53 
54 #include "Epetra_MpiComm.h"
55 #include "mpi.h"
56 #include "../epetra_test_err.h"
57 #include "Epetra_Version.h"
58 
59 // prototypes
60 
61 int check(Epetra_CrsMatrix& A, int NumMyRows1, int NumGlobalRows1, int NumMyNonzeros1,
62  int NumGlobalNonzeros1, int * MyGlobalElements, bool verbose);
63 
64 int power_method(bool TransA, Epetra_CrsMatrix& A,
65  Epetra_Vector& q,
66  Epetra_Vector& z,
67  Epetra_Vector& resid,
68  double * lambda, int niters, double tolerance,
69  bool verbose);
70 
72 
74  const Epetra_Map & Xamap = A.DomainMap();
75  const Epetra_Map & Yamap = A.RangeMap();
76  const Epetra_Map & Xbmap = B.DomainMap();
77  const Epetra_Map & Ybmap = B.RangeMap();
78 
79  Epetra_Vector Xa(Xamap), Xb(Xbmap), Ya(Yamap), Yb(Ybmap), Diff(Yamap);
80 
81  Xa.SetSeed(24601);
82  Xa.Random();
83 
84  // Handle domain map change
85  if(!Xamap.SameAs(Xbmap)) {
86  Epetra_Import Ximport(Xbmap,Xamap);
87  Xb.Import(Xa,Ximport,Insert);
88  }
89  else {
90  Xb=Xa;
91  }
92 
93  // Do the multiplies
94  A.Apply(Xa,Ya);
95  B.Apply(Xb,Yb);
96 
97  // Handle Rangemap change
98  if(!Yamap.SameAs(Ybmap)) {
99  Epetra_Import Yimport(Yamap,Ybmap);
100  Diff.Import(Yb,Yimport,Insert);
101  }
102  else {
103  Diff=Yb;
104  }
105 
106  // Check solution
107  Diff.Update(-1.0,Ya,1.0);
108  double norm;
109  Diff.Norm2(&norm);
110 
111  return norm;
112 }
113 
114 // B here is the "reduced" matrix. Square matrices w/ Row=Domain=Range only.
116  const Epetra_Map & Amap = A.DomainMap();
117  Epetra_Vector Xa(Amap), Ya(Amap), Diff(Amap);
118  const Epetra_Map *Bmap = Bfullmap.NumMyElements() > 0 ? &B.DomainMap() : 0;
119  Epetra_Vector *Xb = Bmap ? new Epetra_Vector(*Bmap) : 0;
120  Epetra_Vector *Yb = Bmap ? new Epetra_Vector(*Bmap) : 0;
121 
122  Epetra_Vector Xb_alias(View,Bfullmap, Bmap ? Xb->Values(): 0);
123  Epetra_Vector Yb_alias(View,Bfullmap, Bmap ? Yb->Values(): 0);
124 
125  Epetra_Import Ximport(Bfullmap,Amap);
126 
127  // Set the input vector
128  Xa.SetSeed(24601);
129  Xa.Random();
130  Xb_alias.Import(Xa,Ximport,Insert);
131 
132  // Do the multiplies
133  A.Apply(Xa,Ya);
134  if(Bmap) B.Apply(*Xb,*Yb);
135 
136  // Check solution
137  Epetra_Import Yimport(Amap,Bfullmap);
138  Diff.Import(Yb_alias,Yimport,Insert);
139 
140 
141  Diff.Update(-1.0,Ya,1.0);
142  double norm;
143  Diff.Norm2(&norm);
144 
145  delete Xb; delete Yb;
146  return norm;
147 }
148 
149 
150 int build_matrix_unfused(const Epetra_CrsMatrix & SourceMatrix, Epetra_Import & RowImporter, Epetra_CrsMatrix *&A){
151  int rv=0;
152  rv=A->Import(SourceMatrix, RowImporter, Insert);
153  if(rv) {cerr<<"build_matrix_unfused: Import failed"<<endl; return rv;}
154 
155  rv=A->FillComplete(SourceMatrix.DomainMap(), SourceMatrix.RangeMap());
156  return rv;
157 }
158 
159 int build_matrix_unfused(const Epetra_CrsMatrix & SourceMatrix, Epetra_Export & RowExporter, Epetra_CrsMatrix *&A){
160  int rv=0;
161  rv=A->Export(SourceMatrix, RowExporter, Insert);
162  if(rv) {cerr<<"build_matrix_unfused: Export failed"<<endl; return rv;}
163 
164  rv=A->FillComplete(SourceMatrix.DomainMap(), SourceMatrix.RangeMap());
165  return rv;
166 }
167 
168 
169 
170 void build_test_matrix(Epetra_MpiComm & Comm, int test_number, Epetra_CrsMatrix *&A){
171  int NumProc = Comm.NumProc();
172  int MyPID = Comm.MyPID();
173 
174  if(test_number==1){
175  // Case 1: Tridiagonal
176  int NumMyEquations = 100;
177 
178  long long NumGlobalEquations = (NumMyEquations * NumProc) + EPETRA_MIN(NumProc,3);
179  if(MyPID < 3) NumMyEquations++;
180 
181  // Construct a Map that puts approximately the same Number of equations on each processor
182  Epetra_Map Map(NumGlobalEquations, NumMyEquations, (long long)0, Comm);
183 
184  // Get update list and number of local equations from newly created Map
185  long long* MyGlobalElements = new long long[Map.NumMyElements()];
186  Map.MyGlobalElements(MyGlobalElements);
187 
188  // Create an integer vector NumNz that is used to build the Petra Matrix.
189  // NumNz[i] is the Number of OFF-DIAGONAL term for the ith global equation on this processor
190 
191  int* NumNz = new int[NumMyEquations];
192 
193  // We are building a tridiagonal matrix where each row has (-1 2 -1)
194  // So we need 2 off-diagonal terms (except for the first and last equation)
195 
196  for (int i = 0; i < NumMyEquations; i++)
197  if((MyGlobalElements[i] == 0) || (MyGlobalElements[i] == NumGlobalEquations - 1))
198  NumNz[i] = 1;
199  else
200  NumNz[i] = 2;
201 
202  // Create a Epetra_Matrix
203  A=new Epetra_CrsMatrix(Copy, Map, NumNz);
204 
205  // Add rows one-at-a-time
206  // Need some vectors to help
207  // Off diagonal Values will always be -1
208 
209  double* Values = new double[2];
210  Values[0] = -1.0;
211  Values[1] = -1.0;
212  long long* Indices = new long long[2];
213  double two = 2.0;
214  int NumEntries;
215 
216  for (int i = 0; i < NumMyEquations; i++) {
217  if(MyGlobalElements[i] == 0) {
218  Indices[0] = 1;
219  NumEntries = 1;
220  }
221  else if (MyGlobalElements[i] == NumGlobalEquations-1) {
222  Indices[0] = NumGlobalEquations-2;
223  NumEntries = 1;
224  }
225  else {
226  Indices[0] = MyGlobalElements[i]-1;
227  Indices[1] = MyGlobalElements[i]+1;
228  NumEntries = 2;
229  }
230  A->InsertGlobalValues(MyGlobalElements[i], NumEntries, Values, Indices);
231  A->InsertGlobalValues(MyGlobalElements[i], 1, &two, MyGlobalElements+i);
232  }
233 
234  A->FillComplete();
235 
236  // Cleanup
237  delete [] MyGlobalElements;
238  delete [] NumNz;
239  delete [] Values;
240  delete [] Indices;
241 
242  }
243 }
244 
245 
246 
247 
248 int main(int argc, char *argv[])
249 {
250  int total_err=0;
251 
252  // Initialize MPI
253 
254  MPI_Init(&argc,&argv);
255  int rank; // My process ID
256 
257  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
258  Epetra_MpiComm Comm( MPI_COMM_WORLD );
259 
260  bool verbose = false;
261 
262  // Check if we should print results to standard out
263  if (argc>1) if (argv[1][0]=='-' && argv[1][1]=='v') verbose = true;
264 
265  int verbose_int = verbose ? 1 : 0;
266  Comm.Broadcast(&verbose_int, 1, 0);
267  verbose = verbose_int==1 ? true : false;
268 
269  Comm.SetTracebackMode(0); // This should shut down any error traceback reporting
270  int MyPID = Comm.MyPID();
271  int NumProc = Comm.NumProc();
272 
273  if(verbose && MyPID==0)
274  cout << Epetra_Version() << std::endl << std::endl;
275 
276  if (verbose) cout << "Processor "<<MyPID<<" of "<< NumProc
277  << " is alive."<<endl;
278 
279  // Redefine verbose to only print on PE 0
280  if(verbose && rank!=0) verbose = false;
281 
282  // Matrix & Map pointers
283  Epetra_CrsMatrix *A, *B, *C;
284  Epetra_Map* Map1;
285  Epetra_Import* Import1;
286  Epetra_Export* Export1;
287  double diff_tol=1e-12;
288 
289 #define ENABLE_TEST_1
290 #define ENABLE_TEST_2
291 #define ENABLE_TEST_3
292 #define ENABLE_TEST_4
293 #define ENABLE_TEST_5
294 #define ENABLE_TEST_6
295 
297  // Test #1: Tridiagonal Matrix; Migrate to Proc 0
299 #ifdef ENABLE_TEST_1
300  {
301  double diff;
302  build_test_matrix(Comm,1,A);
303  long long num_global = A->RowMap().NumGlobalElements64();
304 
305  // New map with all on Proc1
306  if(MyPID==0) Map1=new Epetra_Map(num_global,num_global,(long long) 0,Comm);
307  else Map1=new Epetra_Map(num_global,0,(long long)0,Comm);
308 
309  // Execute fused import constructor
310  Import1 = new Epetra_Import(*Map1,A->RowMap());
311  B=new Epetra_CrsMatrix(*A,*Import1,0,&A->RangeMap());
312 
313  diff=test_with_matvec(*A,*B);
314  if(diff > diff_tol){
315  if(MyPID==0) cout<<"FusedImport: Test #1 FAILED with norm diff = "<<diff<<"."<<endl;
316  total_err--;
317  }
318 
319  // Execute fused export constructor
320  delete B;
321  Export1 = new Epetra_Export(A->RowMap(),*Map1);
322  B=new Epetra_CrsMatrix(*A,*Export1,0,&A->RangeMap());
323 
324  diff=test_with_matvec(*A,*B);
325  if(diff > diff_tol){
326  if(MyPID==0) cout<<"FusedExport: Test #1 FAILED with norm diff = "<<diff<<"."<<endl;
327  total_err--;
328  }
329 
330  delete A; delete B; delete Map1; delete Import1; delete Export1;
331  }
332 #endif
333 
334 
336  // Test #2: Tridiagonal Matrix; Locally Reversed Map
338 #ifdef ENABLE_TEST_2
339  {
340  double diff;
341  build_test_matrix(Comm,1,A);
342  int num_local = A->RowMap().NumMyElements();
343 
344  std::vector<long long> MyGIDS(num_local);
345  for(int i=0; i<num_local; i++)
346  MyGIDS[i] = A->RowMap().GID64(num_local-i-1);
347 
348  // New map with all on Proc1
349  Map1=new Epetra_Map((long long)-1,num_local,&MyGIDS[0],0,Comm);
350 
351  // Execute fused import constructor
352  Import1 = new Epetra_Import(*Map1,A->RowMap());
353  B=new Epetra_CrsMatrix(*A,*Import1,0,&A->RangeMap());
354 
355  diff=test_with_matvec(*A,*B);
356  if(diff > diff_tol){
357  if(MyPID==0) cout<<"FusedImport: Test #2 FAILED with norm diff = "<<diff<<"."<<endl;
358  total_err--;
359  }
360 
361  // Execute fused export constructor
362  delete B;
363  Export1 = new Epetra_Export(A->RowMap(),*Map1);
364  B=new Epetra_CrsMatrix(*A,*Export1,0,&A->RangeMap());
365 
366  diff=test_with_matvec(*A,*B);
367  if(diff > diff_tol){
368  if(MyPID==0) cout<<"FusedExport: Test #2 FAILED with norm diff = "<<diff<<"."<<endl;
369  total_err--;
370  }
371 
372  delete A; delete B; delete Map1; delete Import1; delete Export1;
373  }
374 #endif
375 
377  // Test #3: Tridiagonal Matrix; Globally Reversed Map
379 #ifdef ENABLE_TEST_3
380  {
381  double diff;
382  build_test_matrix(Comm,1,A);
383  int num_local = A->RowMap().NumMyElements();
384  long long num_global = A->RowMap().NumGlobalElements64();
385  int num_scansum = 0;
386 
387  Comm.ScanSum(&num_local,&num_scansum,1);
388 
389  // New Map
390  std::vector<long long> MyGIDS(num_local);
391  for(int i=0; i<num_local; i++)
392  MyGIDS[i] = num_global - num_scansum + num_local - i - 1;
393  Map1=new Epetra_Map((long long)-1,num_local,&MyGIDS[0],(long long)0,Comm);
394 
395  // Execute fused import constructor
396  Import1 = new Epetra_Import(*Map1,A->RowMap());
397  B=new Epetra_CrsMatrix(*A,*Import1,0,&A->RangeMap());
398 
399  diff=test_with_matvec(*A,*B);
400  if(diff > diff_tol){
401  if(MyPID==0) cout<<"FusedImport: Test #3 FAILED with norm diff = "<<diff<<"."<<endl;
402  total_err--;
403  }
404 
405  // Execute fused export constructor
406  delete B;
407  Export1 = new Epetra_Export(A->RowMap(),*Map1);
408  B=new Epetra_CrsMatrix(*A,*Export1,0,&A->RangeMap());
409 
410  diff=test_with_matvec(*A,*B);
411  if(diff > diff_tol){
412  if(MyPID==0) cout<<"FusedExport: Test #3 FAILED with norm diff = "<<diff<<"."<<endl;
413  total_err--;
414  }
415 
416  delete A; delete B; delete Map1; delete Import1; delete Export1;
417  }
418 #endif
419 
420 
422  // Test #4: Tridiagonal Matrix; MMM style halo import
424 #ifdef ENABLE_TEST_4
425  {
426  double diff;
427  build_test_matrix(Comm,1,A);
428 
429  // Assume we always own the diagonal
430  int num_local = A->NumMyCols()-A->NumMyRows();
431  std::vector<long long> MyGIDS(num_local);
432 
433  for(int i=0, idx=0; i<A->NumMyCols(); i++)
434  if(A->LRID(A->GCID64(i)) == -1){
435  MyGIDS[idx] = A->GCID64(i);
436  idx++;
437  }
438 
439  // New map
440  const long long * MyGIDS_ptr = Epetra_Util_data_ptr(MyGIDS);
441  Map1=new Epetra_Map((long long)-1,num_local,MyGIDS_ptr,(long long)0,Comm);
442 
443  // Execute fused import constructor
444  Import1 = new Epetra_Import(*Map1,A->RowMap());
445  B=new Epetra_CrsMatrix(*A,*Import1,0,&A->RangeMap());
446 
447  // Build unfused matrix to compare
448  C=new Epetra_CrsMatrix(Copy,*Map1,0);
449  build_matrix_unfused(*A,*Import1,C);
450 
451  diff=test_with_matvec(*B,*C);
452  if(diff > diff_tol){
453  if(MyPID==0) cout<<"FusedImport: Test #4 FAILED with norm diff = "<<diff<<"."<<endl;
454  total_err--;
455  }
456 
457  // Execute fused export constructor
458  delete B;
459  Export1 = new Epetra_Export(A->RowMap(),*Map1);
460  B=new Epetra_CrsMatrix(*A,*Export1,0,&A->RangeMap());
461 
462  diff=test_with_matvec(*B,*C);
463  if(diff > diff_tol){
464  if(MyPID==0) cout<<"FusedExport: Test #4 FAILED with norm diff = "<<diff<<"."<<endl;
465  total_err--;
466  }
467 
468  delete A; delete B; delete C; delete Map1; delete Import1; delete Export1;
469  }
470 #endif
471 
472 
474  // Test 5: Tridiagonal Matrix; Migrate to Proc 0, Replace Maps
476 #ifdef ENABLE_TEST_5
477  {
478  double diff;
479  build_test_matrix(Comm,1,A);
480  long long num_global = A->RowMap().NumGlobalElements64();
481 
482  // New map with all on Proc1
483  if(MyPID==0) Map1=new Epetra_Map(num_global,num_global,(long long)0,Comm);
484  else Map1=new Epetra_Map(num_global,0,(long long)0,Comm);
485 
486  // Execute fused import constructor
487  Import1 = new Epetra_Import(*Map1,A->RowMap());
488  B=new Epetra_CrsMatrix(*A,*Import1,Map1,Map1);
489 
490  diff=test_with_matvec(*A,*B);
491  if(diff > diff_tol){
492  if(MyPID==0) cout<<"FusedImport: Test #5 FAILED with norm diff = "<<diff<<"."<<endl;
493  total_err--;
494  }
495 
496  // Execute fused export constructor
497  delete B;
498  Export1 = new Epetra_Export(A->RowMap(),*Map1);
499  B=new Epetra_CrsMatrix(*A,*Export1,Map1,Map1);
500 
501  diff=test_with_matvec(*A,*B);
502  if(diff > diff_tol){
503  if(MyPID==0) cout<<"FusedExport: Test #5 FAILED with norm diff = "<<diff<<"."<<endl;
504  total_err--;
505  }
506 
507  delete A; delete B; delete Map1; delete Import1; delete Export1;
508  }
509 #endif
510 
511 
513  // Test 6: Tridiagonal Matrix; Migrate to Proc 0, Replace Comm
515 #ifdef ENABLE_TEST_6
516  {
517  double diff;
518  build_test_matrix(Comm,1,A);
519  long long num_global = A->RowMap().NumGlobalElements64();
520 
521  // New map with all on Proc1
522  if(MyPID==0) Map1=new Epetra_Map(num_global,num_global,(long long)0,Comm);
523  else Map1=new Epetra_Map(num_global,0,(long long)0,Comm);
524 
525  // Execute fused import constructor
526  Import1 = new Epetra_Import(*Map1,A->RowMap());
527  B=new Epetra_CrsMatrix(*A,*Import1,Map1,Map1,true);
528 
529  diff=test_with_matvec_reduced_maps(*A,*B,*Map1);
530  if(diff > diff_tol){
531  if(MyPID==0) cout<<"FusedImport: Test #6 FAILED with norm diff = "<<diff<<"."<<endl;
532  total_err--;
533  }
534 
535  // Execute fused export constructor
536  delete B;
537  Export1 = new Epetra_Export(A->RowMap(),*Map1);
538  B=new Epetra_CrsMatrix(*A,*Export1,Map1,Map1,true);
539 
540  diff=test_with_matvec_reduced_maps(*A,*B,*Map1);
541  if(diff > diff_tol){
542  if(MyPID==0) cout<<"FusedExport: Test #6 FAILED with norm diff = "<<diff<<"."<<endl;
543  total_err--;
544  }
545 
546  delete A; delete B; delete Map1; delete Import1; delete Export1;
547  }
548 #endif
549 
550 
551  // Final output for OK
552  if(MyPID==0 && total_err==0)
553  cout<<"FusedImportExport: All tests PASSED."<<endl;
554 
555  // Cleanup
556  MPI_Finalize();
557 
558  return total_err ;
559 }
560 
561 
562 
563 #else
564 int main(){
565 
566  return 0;
567 }
568 #endif
int LRID(int GRID_in) const
Returns the local row index for given global row index, returns -1 if no local row for this global ro...
Epetra_Map: A class for partitioning vectors and matrices.
Definition: Epetra_Map.h:119
double test_with_matvec(const Epetra_CrsMatrix &A, const Epetra_CrsMatrix &B)
const Epetra_Map & RangeMap() const
Returns the Epetra_Map object associated with the range of this matrix operator.
bool SameAs(const Epetra_BlockMap &Map) const
Returns true if this and Map are identical maps.
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.
int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Epetra_Operator applied to a Epetra_MultiVector X in Y.
int NumProc() const
Returns total number of processes.
static void SetTracebackMode(int TracebackModeValue)
Set the value of the Epetra_Object error traceback report mode.
T * Epetra_Util_data_ptr(std::vector< T > &vec)
Function that returns either a pointer to the first entry in the vector or, if the vector is empty...
Definition: Epetra_Util.h:422
double test_with_matvec_reduced_maps(const Epetra_CrsMatrix &A, const Epetra_CrsMatrix &B, const Epetra_Map &Bfullmap)
int power_method(Epetra_CrsMatrix &A, double &lambda, int niters, double tolerance, bool verbose)
Epetra_Export: This class builds an export object for efficient exporting of off-processor elements...
Definition: Epetra_Export.h:62
Epetra_Vector: A class for constructing and using dense vectors on a parallel computer.
#define EPETRA_MIN(x, y)
Epetra_MpiComm: The Epetra MPI Communication Class.
std::string Epetra_Version()
Epetra_Import: This class builds an import object for efficient importing of off-processor elements...
Definition: Epetra_Import.h:63
int check(Epetra_CrsGraph &A, int NumMyRows1, int NumGlobalRows1, int NumMyNonzeros1, int NumGlobalNonzeros1, int *MyGlobalElements, bool verbose)
int ScanSum(double *MyVals, double *ScanSums, int Count) const
Epetra_MpiComm Scan Sum function.
int FillComplete(bool OptimizeDataStorage=true)
Signal that data entry is complete. Perform transformations to local index space. ...
int build_matrix_unfused(const Epetra_CrsMatrix &SourceMatrix, Epetra_Import &RowImporter, Epetra_CrsMatrix *&A)
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.
int NumMyCols() const
Returns the number of entries in the set of column-indices that appear on this processor.
long long GID64(int LID) const
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_Comm: The Epetra Communication Abstract Base Class.
Definition: Epetra_Comm.h:73
int Broadcast(double *MyVals, int Count, int Root) const
Epetra_MpiComm Broadcast function.
void build_test_matrix(Epetra_MpiComm &Comm, int test_number, Epetra_CrsMatrix *&A)
int NumMyRows() const
Returns the number of matrix rows owned by the calling processor.
double * Values() const
Get pointer to MultiVector values.
int Update(double ScalarA, const Epetra_MultiVector &A, double ScalarThis)
Update multi-vector values with scaled values of A, this = ScalarThis*this + ScalarA*A.
int check_graph_sharing(Epetra_Comm &Comm)
Epetra_CrsMatrix: A class for constructing and using real-valued double-precision sparse compressed r...
int Norm2(double *Result) const
Compute 2-norm of each vector in multi-vector.
const Epetra_Map & DomainMap() const
Returns the Epetra_Map object associated with the domain of this matrix operator. ...
int main(int argc, char *argv[])
int Import(const Epetra_SrcDistObject &A, const Epetra_Import &Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)
Imports an Epetra_DistObject using the Epetra_Import object.
long long GCID64(int LCID_in) const
int MyPID() const
Return my process ID.