FEI Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
test_Matrix.cpp
Go to the documentation of this file.
1 /*--------------------------------------------------------------------*/
2 /* Copyright 2005 Sandia Corporation. */
3 /* Under the terms of Contract DE-AC04-94AL85000, there is a */
4 /* non-exclusive license for use of this work by or on behalf */
5 /* of the U.S. Government. Export of this program may require */
6 /* a license from the United States Government. */
7 /*--------------------------------------------------------------------*/
8 
9 #include <fei_macros.hpp>
10 #include <cmath>
11 #include <fei_mpi.h>
18 #include <fei_Factory.hpp>
19 #include <fei_defs.h>
20 #include <snl_fei_Factory.hpp>
21 #include <fei_Vector_Impl.hpp>
22 #include <fei_Matrix_Impl.hpp>
23 
24 #ifdef HAVE_FEI_AZTECOO
25 #include <fei_Aztec_LinSysCore.hpp>
26 #endif
27 #include <fei_Factory_Trilinos.hpp>
28 
29 #ifdef HAVE_FEI_FETI
30 #include <FETI_DP_FiniteElementData.h>
31 #endif
32 
33 #undef fei_file
34 #define fei_file "test_Matrix.cpp"
35 #include <fei_ErrMacros.hpp>
36 
38 {
39  std::vector<double> data1D;
40  std::vector<const double*>data2D;
41 
42  int numRows = 2;
43  int numCols = 3;
44  double** values = new double*[numRows];
45  int i, j;
46  for(i=0; i<numRows; ++i) {
47  values[i] = new double[numCols];
48  for(j=0; j<numCols; ++j) {
49  values[i][j] = i*1.0;
50  }
51  }
52 
54  values, data1D, data2D);
55 
56  for(i=0; i<numRows; ++i) {
57  for(j=0; j<numCols; ++j) {
58  if (std::abs(values[i][j] - (data2D[j])[i]) > 1.e-49) {
59  ERReturn(-1);
60  }
61  }
62  delete [] values[i];
63  }
64 
65  delete [] values;
66 
67  return(0);
68 }
69 
71 {
72  if (numProcs > 1) {
73  return;
74  }
75 
76  FEI_COUT << "testing fei::Matrix_Impl...";
77 
80 
81  int rowfield = 0, rowfieldsize = 1;
82  int idType = 0;
83  rowspace->defineFields(1, &rowfield, &rowfieldsize);
84  rowspace->defineIDTypes(1, &idType);
85 
86  fei::SharedPtr<fei::MatrixGraph> mgraph(new fei::MatrixGraph_Impl2(rowspace, colspace));
87 
88  int patternID1 = mgraph->definePattern(2, idType, rowfield);
89 
90  fei::Pattern* rowpattern = mgraph->getPattern(patternID1);
91 
92  mgraph->initConnectivityBlock(0, 1, patternID1);
93 
94  std::vector<int> ids(2);
95  ids[0] = 0; ids[1] = 1;
96 
97  int err = mgraph->initConnectivity(0, 0, &ids[0]);
98  if (err) {
99  FEI_OSTRINGSTREAM osstr;
100  osstr << "test_Matrix_unit2, initConnectivity returned err="<<err;
101  throw std::runtime_error(osstr.str());
102  }
103 
104  err = mgraph->initComplete();
105  if (err) {
106  FEI_OSTRINGSTREAM osstr;
107  osstr << "test_Matrix_unit2, initComplete returned err="<<err;
108  throw std::runtime_error(osstr.str());
109  }
110 
111  bool factory_created = false;
113  try {
114  factory = fei::create_fei_Factory(comm, "Trilinos");
115  factory_created = true;
116  }
117  catch(...) {}
118 
119  if (!factory_created) {
120  FEI_COUT << "failed to create Trilinos factory."<<FEI_ENDL;
121  return;
122  }
123 
124  fei::SharedPtr<fei::Matrix> feimat = factory->createMatrix(mgraph);
125 
126  int numrowindices = rowpattern->getNumIndices();
127 
128  std::vector<double> coefs(numrowindices*numrowindices, 1.0);
129  std::vector<double*> coefs_2D(numrowindices);
130  for(int i=0; i<numrowindices; ++i) {
131  coefs_2D[i] = &(coefs[i*numrowindices]);
132  }
133 
134  err = feimat->sumIn(0, 0, &coefs_2D[0]);
135  if (err) {
136  FEI_OSTRINGSTREAM osstr;
137  osstr << "test_Matrix_unit2, feimat->sumIn returned err="<<err;
138  throw std::runtime_error(osstr.str());
139  }
140 
141  err = feimat->globalAssemble();
142  if (err) {
143  FEI_OSTRINGSTREAM osstr;
144  osstr << "test_Matrix_unit2, feimat->globalAssemble returned err="<<err;
145  throw std::runtime_error(osstr.str());
146  }
147 
148  err = feimat->writeToFile("feimat2.mtx", false);
149  if (err) {
150  FEI_OSTRINGSTREAM osstr;
151  osstr << "test_Matrix_unit2, feimat->writeToFile returned err="<<err;
152  throw std::runtime_error(osstr.str());
153  }
154 
155  fei::FillableMat feimat_ss;
156  err = fei_test_utils::copy_feiMatrix_to_FillableMat(*feimat, feimat_ss);
157  if (err) {
158  FEI_OSTRINGSTREAM osstr;
159  osstr << "test_Matrix_unit2, copy_feiMatrix_to_FillableMat returned err="<<err;
160  throw std::runtime_error(osstr.str());
161  }
162 
163  fei_test_utils::writeMatrix("feimat_ss2.mtx", feimat_ss);
164 
165  FEI_COUT << "ok"<<FEI_ENDL;
166 }
167 
169 {
170  if (numProcs > 1) {
171  return;
172  }
173 
174  FEI_COUT << "testing fei::Matrix_Impl with FEI_BLOCK_DIAGONAL_ROW...";
175 
178 
179  int rowfield = 0, rowfieldsize = 2;
180  int idType = 0;
181  rowspace->defineFields(1, &rowfield, &rowfieldsize);
182  rowspace->defineIDTypes(1, &idType);
183 
184  fei::SharedPtr<fei::MatrixGraph> mgraph(new fei::MatrixGraph_Impl2(rowspace, colspace));
185 
186  int patternID1 = mgraph->definePattern(2, idType, rowfield);
187 
188  fei::Pattern* rowpattern = mgraph->getPattern(patternID1);
189 
190  bool diagonal = true;
191  mgraph->initConnectivityBlock(0, 1, patternID1, diagonal);
192 
193  std::vector<int> ids(2);
194  ids[0] = 0; ids[1] = 1;
195 
196  int err = mgraph->initConnectivity(0, 0, &ids[0]);
197  if (err) {
198  FEI_OSTRINGSTREAM osstr;
199  osstr << "test_Matrix_unit4, initConnectivity returned err="<<err;
200  throw std::runtime_error(osstr.str());
201  }
202 
203  err = mgraph->initComplete();
204  if (err) {
205  FEI_OSTRINGSTREAM osstr;
206  osstr << "test_Matrix_unit4, initComplete returned err="<<err;
207  throw std::runtime_error(osstr.str());
208  }
209 
211  try {
212  factory = fei::create_fei_Factory(comm, "Trilinos");
213  }
214  catch(...) {
215  FEI_COUT << "Trilinos not available."<<FEI_ENDL;
216  return;
217  }
218 
219  fei::Param blktrue("BLOCK_MATRIX", true);
220  fei::Param blkfalse("BLOCK_MATRIX", false);
221 
222  fei::ParameterSet paramset;
223  paramset.add(blktrue);
224  factory->parameters(paramset);
225 
226  fei::SharedPtr<fei::Matrix> feiblkmat = factory->createMatrix(mgraph);
227 
228  paramset.add(blkfalse);
229  factory->parameters(paramset);
230 
231  fei::SharedPtr<fei::Matrix> feimat = factory->createMatrix(mgraph);
232 
233  int numrowindices = rowpattern->getNumIndices();
234 
235  std::vector<double> coefs(numrowindices*rowfieldsize*rowfieldsize, 1.0);
236  std::vector<double*> coefs_2D(numrowindices*rowfieldsize);
237  int offset = 0;
238  for(int i=0; i<numrowindices*rowfieldsize; ++i) {
239  coefs_2D[i] = &(coefs[offset]);
240  offset += rowfieldsize;
241  }
242 
243  err = feimat->sumIn(0, 0, &coefs_2D[0], FEI_BLOCK_DIAGONAL_ROW);
244  if (err) {
245  FEI_OSTRINGSTREAM osstr;
246  osstr << "test_Matrix_unit4, feimat->sumIn returned err="<<err;
247  throw std::runtime_error(osstr.str());
248  }
249 
250  err = feiblkmat->sumIn(0, 0, &coefs_2D[0], FEI_BLOCK_DIAGONAL_ROW);
251  if (err) {
252  FEI_OSTRINGSTREAM osstr;
253  osstr << "test_Matrix_unit4, feiblkmat->sumIn returned err="<<err;
254  throw std::runtime_error(osstr.str());
255  }
256 
257  err = feimat->globalAssemble();
258  if (err) {
259  FEI_OSTRINGSTREAM osstr;
260  osstr << "test_Matrix_unit4, feimat->globalAssemble returned err="<<err;
261  throw std::runtime_error(osstr.str());
262  }
263 
264  err = feiblkmat->globalAssemble();
265  if (err) {
266  FEI_OSTRINGSTREAM osstr;
267  osstr << "test_Matrix_unit4, feimat->globalAssemble returned err="<<err;
268  throw std::runtime_error(osstr.str());
269  }
270 
271  feimat->writeToFile("feimat_blkdiag.mtx");
272  feiblkmat->writeToFile("feiblkmat_blkdiag.mtx");
273 
274  FEI_COUT << "ok"<<FEI_ENDL;
275 }
276 
278  : tester(comm)
279 {
280 }
281 
283 {
284 }
285 
287 {
288 
289  //-------------------------------
290  // Test a Factory_Trilinos matrix.
291  if (localProc_==0) FEI_COUT << "Testing Factory_Trilinos fei::Matrix..." << FEI_ENDL;
292  fei::SharedPtr<fei::Factory> factory_trilinos(new Factory_Trilinos(comm_));
293 
294  fei::SharedPtr<fei::Matrix> mat = create_matrix(factory_trilinos);
295 
296  matrix_test1(mat);
297 
298  if (localProc_==0) FEI_COUT << FEI_ENDL;
299 
300 #ifdef HAVE_FEI_AZTECOO
301  //-------------------------------
302  // Test a matrix from a "snl_fei::Factory", which was created by the
303  // test-util function create_fei_Factory for library "Aztec", which causes
304  // an "old" LinearSystemCore object to be used as the underlying assembly layer.
305  // (It still ends up using Aztec if you create a solver and solve the linear-
306  // system, but it assembles data into non-Trilinos matrix/vector data structures.)
307  if (localProc_==0) FEI_COUT << "Testing 'old' factory_aztec fei::Matrix..." << FEI_ENDL;
308  fei::SharedPtr<fei::Factory> factory_aztec =
309  fei::create_fei_Factory(comm_, "Aztec");
310 
311  fei::SharedPtr<fei::Matrix> mat1 = create_matrix(factory_aztec);
312 
313  matrix_test1(mat1);
314 #endif
315 
316  return(0);
317 }
318 
321 {
322  testData test_data(localProc_, numProcs_);
323 
326  false, false, (const char*)0, factory);
327  int err = vspace->initComplete();
328  if (err != 0) {
329  FEI_COUT << "ERROR, failed to create valid fei::VectorSpace." << FEI_ENDL;
330  throw std::runtime_error("test_Vector::vector_test1: ERROR, failed to create valid fei::VectorSpace.");
331  }
332 
334  factory->createMatrixGraph(vspace, vspace, NULL);
335 
336  std::vector<int>& fieldIDs = test_data.fieldIDs;
337  std::vector<int>& idTypes = test_data.idTypes;
338  std::vector<int>& ids = test_data.ids;
339 
340  int numIDs = ids.size();
341  int fieldID = fieldIDs[0];
342  int idType = idTypes[0];
343 
344  int patternID = mgraph->definePattern(numIDs, idType, fieldID);
345 
346  mgraph->initConnectivityBlock(0, 1, patternID);
347 
348  mgraph->initConnectivity(0, 0, &ids[0]);
349 
350  mgraph->initComplete();
351 
352  fei::SharedPtr<fei::Matrix> matrix = factory->createMatrix(mgraph);
353  return(matrix);
354 }
355 
357 {
358  if (localProc_==0)
359  FEI_COUT << " matrix_test1: testing fei::Matrix with type '"
360  << mat->typeName() << "':"<<FEI_ENDL;
361 
363 
365 
366  if (localProc_==0)
367  FEI_COUT << " testing get{Global/Local}NumRows,getRowLength...";
368 
369  int mglobalrows = mat->getGlobalNumRows();
370  int vglobaleqns = rspace->getGlobalNumIndices();
371 
372  if (mglobalrows != vglobaleqns) {
373  throw std::runtime_error("mat reports different num rows than vector-space eqns");
374  }
375 
376  std::vector<int> global_offsets;
377  rspace->getGlobalIndexOffsets(global_offsets);
378 
379  int my_num_rows = mat->getLocalNumRows();
380  if (my_num_rows != global_offsets[localProc_+1]-global_offsets[localProc_]) {
381  throw std::runtime_error("num-local-rows mis-match between mat and vector-space");
382  }
383 
384  int i, my_first_row = global_offsets[localProc_];
385  std::vector<int> row_lengths(my_num_rows);
386 
387  for(i=0; i<my_num_rows; ++i) {
388  int errcode = mat->getRowLength(i+my_first_row, row_lengths[i]);
389  if (errcode != 0) {
390  throw std::runtime_error("nonzero errcode from mat->getRowLength");
391  }
392  }
393 
394  if (localProc_==0) FEI_COUT << "ok" << FEI_ENDL;
395 }
396 
398 {
400  std::vector<int>& fieldIDs = testdata->fieldIDs;
401  std::vector<int>& fieldSizes = testdata->fieldSizes;
402  std::vector<int>& idTypes = testdata->idTypes;
403  std::vector<int>& ids = testdata->ids;
404 
406 
407  vspc->defineFields(fieldIDs.size(),
408  &fieldIDs[0],
409  &fieldSizes[0]);
410 
411  vspc->defineIDTypes(idTypes.size(), &idTypes[0]);
412 
414  matgraph(new fei::MatrixGraph_Impl2(vspc, vspc, "sU_Mat"));
415 
416  int numIDs = ids.size();
417  int fieldID = fieldIDs[0];
418  int idType = idTypes[0];
419 
420  int patternID = matgraph->definePattern(numIDs, idType, fieldID);
421 
422  CHK_ERR( matgraph->initConnectivityBlock(0, 1, patternID) );
423 
424  CHK_ERR( matgraph->initConnectivity(0, 0, &ids[0]) );
425 
426  CHK_ERR( matgraph->initComplete() );
427 
429  int localsize = matgraph->getRowSpace()->getNumIndices_Owned();
430  fei::SharedPtr<fei::Matrix> matrix(new fei::Matrix_Impl<fei::FillableMat>(ssmat, matgraph, localsize));
431 
432  fei::SharedPtr<fei::Matrix> matrixT(new fei::Matrix_Impl<fei::FillableMat>(ssmatT, matgraph, localsize));
433 
434  std::vector<int> indices(numIDs);
435  CHK_ERR( matgraph->getConnectivityIndices(0, 0, numIDs, &indices[0], numIDs) );
436 
437  std::vector<double> data1(numIDs*numIDs);
438  std::vector<double*> data2d(numIDs);
439 
440  int i;
441  for(i=0; i<numIDs; ++i) {
442  data2d[i] = &(data1[i*numIDs]);
443  }
444 
445  for(i=0; i<numIDs*numIDs; ++i) {
446  data1[i] = 1.0*i;
447  }
448 
449  CHK_ERR( matrix->sumIn(numIDs, &indices[0], numIDs, &indices[0],
450  &data2d[0], 0) );
451 
452  CHK_ERR( matrix->sumIn(0, 0, &data2d[0], 0) );
453 
454  CHK_ERR( matrixT->sumIn(numIDs, &indices[0],
455  numIDs, &indices[0], &data2d[0], 3) );
456 
457  CHK_ERR( matrixT->sumIn(0, 0, &data2d[0], 3) );
458 
459  if (*ssmat != *ssmatT) {
460  ERReturn(-1);
461  }
462 
463  return(0);
464 }
465 
467 {
468  testData* testdata = new testData(localProc_, numProcs_);
469  std::vector<int>& idTypes = testdata->idTypes;
470  std::vector<int>& ids = testdata->ids;
471 
473 
474  vspc->defineIDTypes(idTypes.size(), &idTypes[0]);
475 
476  fei::SharedPtr<fei::MatrixGraph> matgraph(new fei::MatrixGraph_Impl2(vspc, vspc, "sU_Mat"));
477 
478  int numIDs = ids.size();
479  int idType = idTypes[0];
480 
481  int patternID = matgraph->definePattern(numIDs, idType);
482 
483  CHK_ERR( matgraph->initConnectivityBlock(0, 1, patternID) );
484 
485  CHK_ERR( matgraph->initConnectivity(0, 0, &ids[0]) );
486 
487  CHK_ERR( matgraph->initComplete() );
488 
490  int localsize = matgraph->getRowSpace()->getNumIndices_Owned();
491  fei::Matrix* matrix = new fei::Matrix_Impl<fei::FillableMat>(ssmat, matgraph, localsize);
492 
493  fei::Matrix* matrixT = new fei::Matrix_Impl<fei::FillableMat>(ssmatT, matgraph, localsize);
494 
495  std::vector<int> indices(numIDs);
496  CHK_ERR( matgraph->getConnectivityIndices(0, 0, numIDs, &indices[0], numIDs) );
497 
498  std::vector<double> data1(numIDs*numIDs);
499  std::vector<double*> data2d(numIDs);
500 
501  int i;
502  for(i=0; i<numIDs; ++i) {
503  data2d[i] = &(data1[i*numIDs]);
504  }
505 
506  for(i=0; i<numIDs*numIDs; ++i) {
507  data1[i] = 1.0*i;
508  }
509 
510  CHK_ERR( matrix->sumIn(numIDs, &indices[0],
511  numIDs, &indices[0], &data2d[0], 0) );
512 
513  CHK_ERR( matrixT->sumIn(numIDs, &indices[0],
514  numIDs, &indices[0], &data2d[0], 3) );
515 
516  if (*ssmat != *ssmatT) {
517  ERReturn(-1);
518  }
519 
520  delete matrix;
521  delete matrixT;
522  delete testdata;
523 
524  return(0);
525 }
526 
528 {
529  testData* testdata = new testData(localProc_, numProcs_);
530  std::vector<int>& fieldIDs = testdata->fieldIDs;
531  std::vector<int>& fieldSizes = testdata->fieldSizes;
532  std::vector<int>& idTypes = testdata->idTypes;
533  std::vector<int>& ids = testdata->ids;
534 
536 
537  vspc->defineFields(fieldIDs.size(), &fieldIDs[0], &fieldSizes[0]);
538 
539  vspc->defineIDTypes(idTypes.size(), &idTypes[0]);
540 
542  matgraph(new fei::MatrixGraph_Impl2(vspc, vspc, "sU_Mat3"));
543 
544  int numIDs = ids.size();
545  int fieldID = fieldIDs[0];
546  int idType = idTypes[0];
547 
548  int patternID = matgraph->definePattern(numIDs, idType, fieldID);
549 
550  CHK_ERR( matgraph->initConnectivityBlock(0, 1, patternID) );
551 
552  CHK_ERR( matgraph->initConnectivity(0, 0, &ids[0]) );
553 
554  //set up a slave constraint that defines id 2, field 0 to be equal to
555  //id 1, field 0.
556  int offsetOfSlave = 1;
557  int offsetIntoSlaveField = 0;
558  std::vector<double> weights(2);
559  weights[0] = 1.0;
560  weights[1] = -1.0;
561  double rhsValue = 0.0;
562  std::vector<int> cr_idtypes(2, idTypes[0]);
563  std::vector<int> cr_fieldIDs(2, fieldIDs[0]);
564 
565  CHK_ERR( matgraph->initSlaveConstraint(2, //numIDs
566  &cr_idtypes[0],
567  &ids[1],
568  &cr_fieldIDs[0],
569  offsetOfSlave,
570  offsetIntoSlaveField,
571  &weights[0],
572  rhsValue) );
573 
574  CHK_ERR( matgraph->initComplete() );
575 
577  int localsize = matgraph->getRowSpace()->getNumIndices_Owned();
578  localsize -= 1;//subtract the slave
579  fei::Matrix* matrix = new fei::Matrix_Impl<fei::FillableMat>(ssmat, matgraph, localsize);
580 
581  if (matrix == NULL) {
582  ERReturn(-1);
583  }
584 
585  std::vector<int> indices(numIDs);
586  CHK_ERR( matgraph->getConnectivityIndices(0, 0, numIDs,
587  &indices[0], numIDs) );
588 
589  std::vector<double> data1(numIDs*numIDs);
590  std::vector<double*> data2d(numIDs);
591 
592  int i;
593  for(i=0; i<numIDs; ++i) {
594  data2d[i] = &(data1[i*numIDs]);
595  }
596 
597  for(i=0; i<numIDs*numIDs; ++i) {
598  data1[i] = 1.0*i;
599  }
600 
601  CHK_ERR( matrix->sumIn(numIDs, &indices[0],
602  numIDs, &indices[0], &data2d[0], 0) );
603 
604  CHK_ERR( matrix->sumIn(0, 0, &data2d[0], 0) );
605 
606  delete matrix;
607  delete testdata;
608 
609  return(0);
610 }
611 
613 {
614  return(0);
615 }
616 
618 {
619  return(0);
620 }
621 
623 {
624 #ifdef HAVE_FEI_FETI
625  testData* testdata = new testData(localProc_, numProcs_);
626  std::vector<int>& idTypes = testdata->idTypes;
627  std::vector<int>& ids = testdata->ids;
628 
629  fei::SharedPtr<FiniteElementData> fedata(new FETI_DP_FiniteElementData(comm_));
630 
631  std::string paramstr("debugOutput .");
632  char* param = const_cast<char*>(paramstr.c_str());
633 
634  CHK_ERR( fedata->parameters(1, &param) );
635 
636  fei::SharedPtr<fei::Factory> factory(new snl_fei::Factory(fedata, idTypes[0]));
637 
638  fei::SharedPtr<fei::VectorSpace> vectorSpacePtr =
640  testdata, localProc_, numProcs_,
641  false, false, "U_FEMat", factory);
642 
643  fei::SharedPtr<fei::MatrixGraph> matrixGraphPtr =
645  false, false, "U_FEMat", vectorSpacePtr,
646  factory);
647 
648  CHK_ERR( matrixGraphPtr->initComplete() );
649 
650  fei::SharedPtr<fei::Vector> vec_fed = factory->createVector(vectorSpacePtr);
651 
652  fei::SharedPtr<fei::Matrix> mat_fed = factory->createMatrix(matrixGraphPtr);
653 
655  dynamic_cast<fei::Matrix_Impl<FiniteElementData>*>(mat_fed.get());
656  if (smat2 == NULL) {
657  ERReturn(-1);
658  }
659 
660  int blockID=0;
661  int numIndices = matrixGraphPtr->getConnectivityNumIndices(blockID);
662 
663  std::vector<int> indicesArray(numIndices);
664  int* indicesPtr = &indicesArray[0];
665 
666  int checkNumIndices = 0;
667  CHK_ERR( matrixGraphPtr->getConnectivityIndices(blockID, 0,
668  numIndices, indicesPtr,
669  checkNumIndices) );
670 
671  std::vector<double> data(ids.size(), 1.0);
672  double* dptr = &data[0];
673  std::vector<double*> coefPtrs(ids.size(), dptr);
674 
675  CHK_ERR( mat_fed->sumIn(blockID, 0, &coefPtrs[0]) );
676 
677  CHK_ERR( vec_fed->sumIn(blockID, 0, &data[0]) );
678 
679  CHK_ERR( mat_fed->gatherFromOverlap() );
680 
681  CHK_ERR( fedata->loadComplete() );
682 
683 
684  delete testdata;
685 
687 
688 #endif //HAVE_FEI_FETI
689 
690  return(0);
691 }
692 
694 {
695  return(0);
696 }
697 
virtual int parameters(int numParams, char **params)=0
virtual const char * typeName()=0
int writeMatrix(const char *fileName, fei::FillableMat &matrix)
std::vector< int > fieldSizes
Definition: testData.hpp:70
int getGlobalNumIndices() const
#define FEI_COUT
int getNumIndices() const
Definition: fei_Pattern.hpp:92
MPI_Comm comm_
Definition: tester.hpp:37
virtual int loadComplete()=0
fei::SharedPtr< fei::Factory > create_fei_Factory(MPI_Comm comm, const char *libraryName)
virtual void parameters(const fei::ParameterSet &paramset)
Definition: fei_Factory.cpp:38
std::vector< int > ids
Definition: testData.hpp:72
virtual int initSlaveConstraint(int numIDs, const int *idTypes, const int *IDs, const int *fieldIDs, int offsetOfSlave, int offsetIntoSlaveField, const double *weights, double rhsValue)=0
std::vector< int > fieldIDs
Definition: testData.hpp:69
int localProc_
Definition: tester.hpp:38
test_Matrix(MPI_Comm comm)
void defineFields(int numFields, const int *fieldIDs, const int *fieldSizes, const int *fieldTypes=NULL)
#define FEI_BLOCK_DIAGONAL_ROW
Definition: fei_defs.h:84
fei::SharedPtr< fei::Matrix > create_matrix(fei::SharedPtr< fei::Factory > factory)
std::vector< int > idTypes
Definition: testData.hpp:71
static fei::SharedPtr< fei::MatrixGraph > create_MatrixGraph(testData *testdata, int localProc, int numProcs, bool bothFields, bool nonSymmetric, const char *name, fei::SharedPtr< fei::VectorSpace > vectorSpacePtr, fei::SharedPtr< fei::Factory > factory, const std::string &path, bool turnOnDebugOutput=false)
#define MPI_Comm
Definition: fei_mpi.h:56
virtual int getConnectivityNumIndices(int blockID) const =0
virtual ~test_Matrix()
virtual fei::SharedPtr< fei::VectorSpace > getRowSpace()=0
virtual int initConnectivity(int blockID, int connectivityID, const int *connectedIdentifiers)=0
virtual int initComplete()=0
int serialtest2()
void test_Matrix_unit2(MPI_Comm comm, int numProcs, int localProc)
Definition: test_Matrix.cpp:70
void add(const Param &param, bool maintain_unique_keys=true)
virtual int writeToFile(const char *filename, bool matrixMarketFormat=true)=0
virtual int sumIn(int numRows, const int *rows, int numCols, const int *cols, const double *const *values, int format=0)=0
virtual int getConnectivityIndices(int blockID, int connectivityID, int indicesAllocLen, int *indices, int &numIndices)=0
int copy_feiMatrix_to_FillableMat(fei::Matrix &feimat, fei::FillableMat &fmat)
virtual int getRowLength(int row, int &length) const =0
void defineIDTypes(int numIDTypes, const int *idTypes)
#define ERReturn(a)
T * get() const
int numProcs_
Definition: tester.hpp:38
virtual fei::SharedPtr< fei::MatrixGraph > getMatrixGraph() const =0
#define MPI_Barrier(a)
Definition: fei_mpi.h:61
#define FEI_ENDL
static void copyTransposeToWorkArrays(int numRows, int numCols, const double *const *values, std::vector< double > &work_1D, std::vector< const double * > &work_2D)
void getGlobalIndexOffsets(std::vector< int > &globalOffsets) const
int serialtest1()
int serialtest3()
virtual int getGlobalNumRows() const =0
int localProc(MPI_Comm comm)
void matrix_test1(fei::SharedPtr< fei::Matrix > mat)
virtual int globalAssemble()=0
virtual int definePattern(int numIDs, int idType)=0
int test_matrix_unit1()
Definition: test_Matrix.cpp:37
virtual fei::SharedPtr< fei::Matrix > createMatrix(fei::SharedPtr< fei::MatrixGraph > matrixGraph)=0
#define CHK_ERR(a)
virtual fei::SharedPtr< fei::MatrixGraph > createMatrixGraph(fei::SharedPtr< fei::VectorSpace > rowSpace, fei::SharedPtr< fei::VectorSpace > columnSpace, const char *name)=0
virtual fei::Pattern * getPattern(int patternID)=0
int sumIn(int numRows, const int *rows, int numCols, const int *cols, const double *const *values, int format=0)
virtual int gatherFromOverlap(bool accumulate=true)=0
void test_Matrix_unit4(MPI_Comm comm, int numProcs, int localProc)
#define FEI_OSTRINGSTREAM
Definition: fei_sstream.hpp:32
virtual int getLocalNumRows() const =0
int numProcs(MPI_Comm comm)
int getNumIndices_Owned() const
virtual int initConnectivityBlock(int blockID, int numConnectivityLists, int patternID, bool diagonal=false)=0
static fei::SharedPtr< fei::VectorSpace > create_VectorSpace(MPI_Comm comm)