FEI  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
FEI_tester.cpp
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_sstream.hpp>
10 #include <fei_fstream.hpp>
11 
12 #include <test_utils/fei_test_utils.hpp>
13 
14 #include <test_utils/FEI_tester.hpp>
15 
16 #include <fei_LinearSystemCore.hpp>
17 #include <fei_LibraryWrapper.hpp>
18 #include <snl_fei_Utils.hpp>
19 
20 #include <fei_FEI_Impl.hpp>
21 
22 #include <test_utils/LibraryFactory.hpp>
23 
24 #ifdef HAVE_FEI_FETI
25 #include <FETI_DP_FiniteElementData.h>
26 #endif
27 
28 #include <test_utils/DataReader.hpp>
29 #include <test_utils/SolnCheck.hpp>
30 
31 #undef fei_file
32 #define fei_file "FEI_tester.cpp"
33 
34 #include <fei_ErrMacros.hpp>
35 
36 //----------------------------------------------------------------------------
37 FEI_tester::FEI_tester(fei::SharedPtr<DataReader> data_reader,
38  MPI_Comm comm, int localProc, int numProcs, bool useNewFEI)
39  : comm_(comm),
40  fei_(),
41  wrapper_(),
42  data_(data_reader),
43  localProc_(localProc),
44  numProcs_(numProcs),
45  numMatrices(1),
46  matrixIDs(NULL),
47  numRHSs(1),
48  rhsIDs(NULL),
49  useNewFEI_(useNewFEI)
50 {
51 }
52 
53 //----------------------------------------------------------------------------
54 FEI_tester::~FEI_tester()
55 {
56  delete [] matrixIDs;
57  delete [] rhsIDs;
58 }
59 
60 //----------------------------------------------------------------------------
61 int FEI_tester::testInitialization()
62 {
63  if (data_.get() == NULL) {
64  ERReturn(-1);
65  }
66 
67  CHK_ERR( createFEIinstance(data_->solverLibraryName_.c_str()) );
68 
69  const char* feiVersionString;
70  CHK_ERR( fei_->version(feiVersionString) );
71 
72  FEI_COUT << "FEI version: " << feiVersionString << FEI_ENDL;
73 
74  fei_->parameters(data_->numParams_, data_->paramStrings_);
75 
76  //Now we check the solveType. A regular Ax=b solve corresponds to
77  //solveType==FEI_SINGLE_SYSTEM. The aggregate stuff (solveType==
78  //FEI_AGGREGATE_SUM) is for power users who
79  //want to assemble more than one matrix system and solve a linear
80  //combination of them, an aggregate system.
81 
82  if (data_->solveType_ == FEI_AGGREGATE_SUM) {
83  CHK_ERR( setIDlists());
84  }
85 
86  CHK_ERR( initializationPhase() );
87 
88  int numBlkActNodes;
89  for(int i=0; i<data_->numElemBlocks_; ++i) {
90  ElemBlock& eblk = data_->elemBlocks_[i];
91  int elemBlockID = eblk.blockID_;
92  CHK_ERR( fei_->getNumBlockActNodes(elemBlockID, numBlkActNodes) );
93  }
94 
95  //************** Initialization Phase is now complete *****************
96 
97  return(0);
98 }
99 
100 //----------------------------------------------------------------------------
101 int FEI_tester::testLoading()
102 {
103  CHK_ERR(fei_->resetRHSVector());
104  CHK_ERR(fei_->resetMatrix()); //try out all of these reset functions,
105  CHK_ERR(fei_->resetSystem()); //just for the sake of coverage...
106 
107  // ************ Load Phase (delegated to a function) ***************
108 
109  //obviously only one of these load-phases should be
110  //performed.
111 
112  if (data_->solveType_ == FEI_SINGLE_SYSTEM) {
113  CHK_ERR( normalLoadPhase());
114  }
115  if (data_->solveType_ == FEI_AGGREGATE_SUM) {
116  CHK_ERR( aggregateLoadPhase());
117  }
118 
119  CHK_ERR( fei_->loadComplete() );
120 
121  CHK_ERR( exerciseResidualNorm() );
122 
123  //**** let's try out the 'put' functions. ******************
124  CHK_ERR( exercisePutFunctions() );
125 
126  return(0);
127 }
128 
129 //----------------------------------------------------------------------------
130 int FEI_tester::testSolve()
131 {
132  //If solverLibraryName is TEST_LSC, then we're not running a real solver so
133  //just return.
134  std::string sname(data_->solverLibraryName_);
135  if (sname == "TEST_LSC") {
136  return( 0 );
137  }
138 
139  int status;
140  int err = fei_->solve(status);
141 
142  //FEI_COUT << "fei->solve, err = " << err << ", status = " << status << FEI_ENDL;
143 
144  if (err != 0 || status != 0) {
145  FEI_COUT << "!!!! solve returned: err: "<<err<<", status: "<<status<<FEI_ENDL;
146  return(err);
147  }
148 
149  if (localProc_ == 0) {
150  int itersTaken;
151  CHK_ERR( fei_->iterations(itersTaken));
152  //FEI_COUT << "iterations: " << itersTaken << FEI_ENDL;
153  }
154 
155  CHK_ERR( exerciseResidualNorm() );
156 
157  return(0);
158 }
159 
160 //----------------------------------------------------------------------------
161 void FEI_tester::dumpMatrixFiles()
162 {
163 }
164 
165 //----------------------------------------------------------------------------
166 void FEI_tester::setParameter(const char*)
167 {
168 }
169 
170 //----------------------------------------------------------------------------
171 int FEI_tester::testCheckResult()
172 {
173  //If solverLibraryName is TEST_LSC, then we're not running a real solver so
174  //just check the matrix.
175  std::string sname(data_->solverLibraryName_);
176  if (sname == "TEST_LSC") {
177  return( lsc_matrix_check() );
178  }
179 
180  CHK_ERR( save_block_node_soln(*data_, *fei_, data_->solnFileName_.c_str(),
181  numProcs_, localProc_, 1));
182 
183  CHK_ERR( save_block_elem_soln(*data_, *fei_, data_->solnFileName_.c_str(),
184  numProcs_, localProc_, 1));
185 
186  CHK_ERR( save_multiplier_soln(*data_, *fei_, data_->solnFileName_.c_str(),
187  numProcs_, localProc_, 1));
188 
189  int err = SolnCheck::checkSolution(localProc_, numProcs_, data_->solnFileName_.c_str(),
190  data_->checkFileName_.c_str(), "node", 1);
191 
192  err += SolnCheck::checkSolution(localProc_, numProcs_, data_->solnFileName_.c_str(),
193  data_->checkFileName_.c_str(), "elem", 1);
194 
195  err += SolnCheck::checkSolution(localProc_, numProcs_, data_->solnFileName_.c_str(),
196  data_->checkFileName_.c_str(), "mult", 1);
197  int globalErr = err;
198 #ifndef FEI_SER
199  if (MPI_SUCCESS != MPI_Allreduce(&err, &globalErr, 1, MPI_INT, MPI_SUM,
200  comm_)) return(-1);
201 #endif
202  if (globalErr != 0) {
203  ERReturn(-1);
204  }
205 
206  return(0);
207 }
208 
209 //----------------------------------------------------------------------------
210 int FEI_tester::createFEIinstance(const char* solverName)
211 {
212  try {
213  wrapper_ = fei::create_LibraryWrapper(comm_, solverName);
214  }
215  catch(std::runtime_error& exc) {
216  fei::console_out() << exc.what()<<FEI_ENDL;
217  return(1);
218  }
219 
220  if (wrapper_.get() == NULL) ERReturn(-1);
221 
222  if (useNewFEI_) {
223  fei_.reset(new fei::FEI_Impl(wrapper_, comm_, 0));
224  }
225  else {
226  fei_.reset(new FEI_Implementation(wrapper_, comm_, 0));
227  }
228 
229  if (fei_.get() == NULL) ERReturn(-1);
230 
231  return(0);
232 }
233 
234 //----------------------------------------------------------------------------
235 int FEI_tester::setIDlists()
236 {
237  snl_fei::getIntParamValue("numMatrices",
238  data_->numParams_,
239  data_->paramStrings_,
240  numMatrices);
241 
242  matrixIDs = new int[numMatrices];
243  numRHSs = 1;
244  rhsIDs = new int[1];
245  rhsIDs[0] = 0;
246 
247  for(int i=0; i<numMatrices; i++) {
248  matrixIDs[i] = i;
249  }
250 
251  CHK_ERR(fei_->setIDLists(numMatrices, matrixIDs, numRHSs, rhsIDs));
252  return(0);
253 }
254 
255 //----------------------------------------------------------------------------
256 int FEI_tester::initializationPhase()
257 {
258  if (data_->solveType_ != FEI_SINGLE_SYSTEM &&
259  data_->solveType_ != FEI_AGGREGATE_SUM) {
260  FEI_COUT << "FEI_tester: bad solveType: " << data_->solveType_ << FEI_ENDL;
261  return(-1);
262  }
263 
264  CHK_ERR( fei_->setSolveType(data_->solveType_));
265 
266  CHK_ERR(fei_->initFields(data_->numFields_, data_->fieldSizes_, data_->fieldIDs_));
267 
268  int i;
269  for(i=0; i<data_->numElemBlocks_; i++) {
270  ElemBlock& block = data_->elemBlocks_[i];
271 
272  CHK_ERR(fei_->initElemBlock(block.blockID_,
273  block.numElements_,
274  block.numNodesPerElement_,
275  block.numFieldsPerNode_,
276  block.nodalFieldIDs_,
277  block.numElemDOF_,
278  block.elemDOFFieldIDs_,
279  block.interleaveStrategy_) );
280 
281  for(int el=0; el<block.numElements_; el++) {
282  CHK_ERR(fei_->initElem(block.blockID_,
283  block.elemIDs_[el],
284  block.elemConn_[el]));
285  }
286  }
287 
288  for(i=0; i<data_->numSharedNodeSets_; i++) {
289  CommNodeSet& shNodeSet = data_->sharedNodeSets_[i];
290 
291  CHK_ERR(fei_->initSharedNodes(shNodeSet.numNodes_, shNodeSet.nodeIDs_,
292  shNodeSet.procsPerNode_, shNodeSet.procs_));
293  }
294 
295  //********* Initialize any slave variables *****************************
296 
297  for(i=0; i<data_->numSlaveVars_; i++) {
298  CRSet& crSet = data_->slaveVars_[i];
299 
300  CHK_ERR( fei_->initSlaveVariable(crSet.slaveNodeID_,
301  crSet.slaveFieldID_,
302  crSet.slaveOffset_,
303  crSet.numNodes_,
304  crSet.nodeIDs_[0],
305  crSet.fieldIDs_,
306  crSet.weights_,
307  crSet.values_[0]) );
308  }
309 
310  //*********** Initialize Constraint Relation Equations *****************
311 
312  for(i=0; i<data_->numCRMultSets_; i++) {
313  CRSet& crSet = data_->crMultSets_[i];
314 
315  for(int j=0; j<1; j++) {
316  CHK_ERR(fei_->initCRMult(crSet.numNodes_,
317  crSet.nodeIDs_[j],
318  crSet.fieldIDs_,
319  crSet.crID_));
320  }
321  }
322 
323  for(i=0; i<data_->numCRPenSets_; i++) {
324  CRSet& crSet = data_->crPenSets_[i];
325 
326  for(int j=0; j<1; j++) {
327  CHK_ERR(fei_->initCRPen(crSet.numNodes_,
328  crSet.nodeIDs_[j],
329  crSet.fieldIDs_,
330  crSet.crID_));
331  }
332  }
333 
334  CHK_ERR(fei_->initComplete());
335  return(0);
336 }
337 
338 //----------------------------------------------------------------------------
339 int FEI_tester::normalLoadPhase()
340 {
341  int i;
342 
343  //*************** Boundary Condition Node Sets *************************
344 
345  for(i=0; i<data_->numBCNodeSets_; i++) {
346  BCNodeSet& bcSet = data_->bcNodeSets_[i];
347 
348  CHK_ERR(fei_->loadNodeBCs(bcSet.numNodes_,
349  bcSet.nodeIDs_,
350  bcSet.fieldID_,
351  bcSet.offsetsIntoField_,
352  bcSet.prescribed_values_));
353  }
354 
355  for(i=0; i<data_->numElemBlocks_; i++) {
356  ElemBlock& block = data_->elemBlocks_[i];
357 
358  for(int el=0; el<block.numElements_; el++) {
359 
360  CHK_ERR(fei_->sumInElemMatrix(block.blockID_,
361  block.elemIDs_[el],
362  block.elemConn_[el],
363  block.elemStiff_[el],
364  block.elemFormat_));
365  }
366  }
367 
368  for(i=0; i<data_->numElemBlocks_; i++) {
369  ElemBlock& block = data_->elemBlocks_[i];
370 
371  for(int el=0; el<block.numElements_; el++) {
372 
373  CHK_ERR(fei_->sumInElemRHS(block.blockID_,
374  block.elemIDs_[el],
375  block.elemConn_[el],
376  block.elemLoad_[el]));
377  }
378  }
379 
380  //******** Load Constraint Relation Equations ***********************
381 
382  for(i=0; i<data_->numCRMultSets_; i++) {
383  CRSet& crSet = data_->crMultSets_[i];
384 
385  for(int j=0; j<1; j++) {
386  CHK_ERR(fei_->loadCRMult(crSet.crID_,
387  crSet.numNodes_,
388  crSet.nodeIDs_[j],
389  crSet.fieldIDs_,
390  crSet.weights_,
391  crSet.values_[j]))
392  }
393  }
394 
395  for(i=0; i<data_->numCRPenSets_; i++) {
396  CRSet& crSet = data_->crPenSets_[i];
397 
398  for(int j=0; j<1; j++) {
399  CHK_ERR(fei_->loadCRPen(crSet.crID_,
400  crSet.numNodes_,
401  crSet.nodeIDs_[j],
402  crSet.fieldIDs_,
403  crSet.weights_,
404  crSet.values_[j],
405  crSet.penValues_[j]))
406  }
407  }
408  return(0);
409 }
410 
411 //----------------------------------------------------------------------------
412 int FEI_tester::aggregateLoadPhase()
413 {
414  int i;
415 
416  for(i=0; i<numMatrices; i++) {
417  CHK_ERR(fei_->setCurrentMatrix(matrixIDs[i]))
418 
419  for(int j=0; j<data_->numElemBlocks_; j++) {
420  ElemBlock& block = data_->elemBlocks_[j];
421 
422  for(int el=0; el<block.numElements_; el++) {
423 
424  CHK_ERR(fei_->sumInElemMatrix(block.blockID_,
425  block.elemIDs_[el],
426  block.elemConn_[el],
427  block.elemStiff_[el],
428  block.elemFormat_))
429  }
430  }
431  }
432 
433  for(i=0; i<numRHSs; i++) {
434  CHK_ERR(fei_->setCurrentRHS(rhsIDs[i]))
435 
436  for(int j=0; j<data_->numElemBlocks_; j++) {
437  ElemBlock& block = data_->elemBlocks_[j];
438 
439  for(int el=0; el<block.numElements_; el++) {
440  CHK_ERR(fei_->sumInElemRHS(block.blockID_,
441  block.elemIDs_[el],
442  block.elemConn_[el],
443  block.elemLoad_[el]))
444  }
445  }
446  }
447 
448  //*************** Boundary Condition Node Sets *************************
449 
450  for(i=0; i<data_->numBCNodeSets_; i++) {
451  BCNodeSet& bcSet = data_->bcNodeSets_[i];
452 
453  CHK_ERR(fei_->loadNodeBCs(bcSet.numNodes_,
454  bcSet.nodeIDs_,
455  bcSet.fieldID_,
456  bcSet.offsetsIntoField_,
457  bcSet.prescribed_values_))
458  }
459 
460  double* matScalars = new double[numMatrices];
461  for(i=0; i<numMatrices; i++) {
462  matScalars[i] = 1.0;
463  }
464 
465  int rhsScaleID = rhsIDs[0];
466  double rhsScalar = 1.0;
467 
468  CHK_ERR(fei_->setMatScalars(numMatrices, matrixIDs, matScalars))
469  CHK_ERR(fei_->setRHSScalars(1, &rhsScaleID, &rhsScalar))
470 
471  delete [] matScalars;
472  return(0);
473 }
474 
475 //----------------------------------------------------------------------------
476 int FEI_tester::exerciseResidualNorm()
477 {
478  std::string sname(data_->solverLibraryName_);
479  if (sname == "TEST_LSC") {
480  return( 0 );
481  }
482  //FEI_COUT << "numFields: " << data_->numFields_ << FEI_ENDL;
483  double* norms = new double[data_->numFields_];
484  int *fields = new int[data_->numFields_];
485  for(int i=0; i<data_->numFields_; ++i) {
486  fields[i] = data_->fieldIDs_[i];
487  }
488 
489  CHK_ERR( fei_->residualNorm(1, data_->numFields_, fields, norms) );
490  //int n;
491  //for(n=0; n<data_->numFields_; n++) {
492  // FEI_COUT << " field["<<n<<"]: " << fields[n]
493  // << ", 1-norm: " << norms[n] << FEI_ENDL;
494  //}
495 
496  delete [] fields;
497  delete [] norms;
498  return(0);
499 }
500 
501 //----------------------------------------------------------------------------
502 int FEI_tester::exercisePutFunctions()
503 {
504  //let's exercise the putNodalFieldData function.
505 
506  int numNodes;
507  CHK_ERR( fei_->getNumLocalNodes(numNodes) );
508  std::vector<int> nodeIDs(numNodes);
509  int* nodeIDsPtr = &nodeIDs[0];
510  int checkNumNodes;
511  CHK_ERR( fei_->getLocalNodeIDList(checkNumNodes, nodeIDsPtr, numNodes) );
512 
513  for(int i=0; i<data_->numFields_; ++i) {
514  int fieldID = data_->fieldIDs_[i];
515  int fieldSize = data_->fieldSizes_[i];
516  std::vector<double> data(numNodes*fieldSize, 0.0001);
517 
518  CHK_ERR( fei_->putNodalFieldData(fieldID, numNodes, nodeIDsPtr,
519  &data[0]) );
520  }
521 
522  return(0);
523 }
524 
525 //----------------------------------------------------------------------------
526 int FEI_tester::save_block_node_soln(DataReader& data, FEI& fei,
527  const char* solnFileName, int numProcs,
528  int localProc, int solveCounter)
529 {
530  (void)solveCounter;
531  int i;
532 
533  int maxNumEqnsPerNode = 0;
534  for(i=0; i<data.numFields_; ++i) {
535  maxNumEqnsPerNode += data.fieldSizes_[i];
536  }
537 
538  std::vector<double> soln(maxNumEqnsPerNode);
539 
540  int numNodes;
541  CHK_ERR( fei.getNumLocalNodes(numNodes) );
542 
543  std::vector<GlobalID> nodes(numNodes);
544  int* nodesPtr = &nodes[0];
545 
546  int checkNumNodes;
547  CHK_ERR( fei.getLocalNodeIDList( checkNumNodes, nodesPtr, numNodes) );
548 
549  if (checkNumNodes != numNodes) {
550  ERReturn(-1);
551  }
552 
553  FEI_OSTRINGSTREAM fileName;
554  fileName << solnFileName<<".node."<<solveCounter<<"."<<numProcs<<"."<<localProc;
555  FEI_OFSTREAM outfile(fileName.str().c_str());
556 
557  if (!outfile || outfile.bad()) {
558  FEI_COUT << "ERROR opening solution output file " << fileName.str() << FEI_ENDL;
559  return(1);
560  }
561 
562  outfile.setf(IOS_SCIENTIFIC, IOS_FLOATFIELD);
563 
564  std::vector<int> offsets(2);
565 
566  for(i=0; i<numNodes; ++i) {
567  CHK_ERR( fei.getNodalSolution(1, &(nodesPtr[i]),
568  &offsets[0], &soln[0]) );
569 
570  int numDOF = offsets[1];
571 
572  outfile << nodesPtr[i] << " " << numDOF << FEI_ENDL;
573  for(int j=0; j<numDOF; j++) {
574  outfile << soln[j] << " ";
575  }
576  outfile << FEI_ENDL;
577  }
578 
579  return(0);
580 }
581 
582 //----------------------------------------------------------------------------
583 int FEI_tester::save_block_elem_soln(DataReader& data, FEI& fei,
584  const char* solnFileName,
585  int numProcs, int localProc,
586  int solveCounter)
587 {
588  int returnValue = 0;
589  FEI_OSTRINGSTREAM fileName;
590  fileName << solnFileName<<".elem."<<solveCounter<<"."<<numProcs<<"."<<localProc;
591  FEI_OFSTREAM outfile(fileName.str().c_str());
592 
593  if (!outfile || outfile.bad()) {
594  FEI_COUT << "ERROR opening elem-solution output file " << fileName.str() << FEI_ENDL;
595  return(1);
596  }
597 
598  for(int i=0; i<data.numElemBlocks_; i++) {
599  if (returnValue != 0) break;
600 
601  ElemBlock& eb = data.elemBlocks_[i];
602 
603  GlobalID blockID = eb.blockID_;
604  int numElems;
605  CHK_ERR( fei.getNumBlockElements(blockID, numElems))
606 
607  int dofPerElem;
608  CHK_ERR( fei.getNumBlockElemDOF(blockID, dofPerElem))
609  int totalNumElemDOF = numElems*dofPerElem;
610 
611  if (totalNumElemDOF < 1) {
612  continue;
613  }
614 
615  GlobalID* elemIDs = new GlobalID[numElems];
616  if (elemIDs==NULL) return(-1);
617 
618  int err = fei.getBlockElemIDList(blockID, numElems, elemIDs);
619  if (err) returnValue = 1;
620 
621  int* offsets = new int[numElems+1];
622  if (offsets == NULL) return(-1);
623 
624  if (totalNumElemDOF > 0) {
625  double* solnValues = new double[totalNumElemDOF];
626  if (solnValues == NULL) return(-1);
627 
628  err = fei.getBlockElemSolution(blockID, numElems, elemIDs,
629  dofPerElem, solnValues);
630  if (err) returnValue = 1;
631 
632  if (!err) {
633  for(int j=0; j<numElems; j++) {
634 
635  outfile << (int)elemIDs[j] << " " << dofPerElem << FEI_ENDL << " ";
636  for(int k=0; k<dofPerElem; k++) {
637  outfile << solnValues[j*dofPerElem + k] << " ";
638  }
639  outfile << FEI_ENDL;
640  }
641  }
642 
643  delete [] solnValues;
644  }
645 
646  delete [] elemIDs;
647  delete [] offsets;
648  }
649 
650  return(0);
651 }
652 
653 //----------------------------------------------------------------------------
654 int FEI_tester::save_multiplier_soln(DataReader& data, FEI& fei,
655  const char* solnFileName,
656  int numProcs, int localProc, int solveCounter)
657 {
658  int numCRs = 0;
659 
660  CHK_ERR( fei.getNumCRMultipliers(numCRs) );
661 
662  int* globalNumCRs = new int[numProcs];
663 #ifndef FEI_SER
664  if (MPI_Allgather(&numCRs, 1, MPI_INT, globalNumCRs, 1, MPI_INT,
665  comm_) != MPI_SUCCESS) {
666  ERReturn(-1);
667  }
668 #endif
669 
670  int localCRStart = 0;
671  for(int p=0; p<localProc; p++) localCRStart += globalNumCRs[p];
672 
673  delete [] globalNumCRs;
674 
675  FEI_OSTRINGSTREAM fileName;
676  fileName << solnFileName<<".mult."<<solveCounter<<"."<<numProcs<<"."<<localProc;
677  FEI_OFSTREAM outfile(fileName.str().c_str());
678 
679  if (!outfile || outfile.bad()) {
680  FEI_COUT << "ERROR opening mult-solution output file " << fileName.str() << FEI_ENDL;
681  return(-1);
682  }
683 
684  int* CRIDs = numCRs > 0 ? new int[numCRs] : NULL;
685  double* results = numCRs > 0 ? new double[numCRs] : NULL;
686 
687  if (numCRs > 0 && (CRIDs==NULL || results==NULL)) {
688  ERReturn(-1);
689  }
690 
691  if (numCRs < 1) {
692  return(0);
693  }
694 
695  CHK_ERR( fei.getCRMultIDList(numCRs, CRIDs) );
696 
697  std::string sname(data_->solverLibraryName_);
698  if (sname == "FETI") {
699  for(int ii=0; ii<numCRs; ++ii) results[ii] = -999.99;
700  }
701  else {
702  CHK_ERR( fei.getCRMultipliers(numCRs, CRIDs, results));
703  }
704 
705  for(int i=0; i<numCRs; i++) {
706  outfile << localCRStart++ << " " << 1 << FEI_ENDL;
707 
708  outfile << " " << results[i] << FEI_ENDL;
709  }
710 
711  delete [] CRIDs;
712  delete [] results;
713 
714  return(0);
715 }
716 
717 //----------------------------------------------------------------------------
718 int FEI_tester::lsc_matrix_check()
719 {
720  if (localProc_ == 0) {
721  char* current_dir = NULL;
722  CHK_ERR( fei_test_utils::dirname(data_->solnFileName_.c_str(), current_dir));
723 
724  FEI_OSTRINGSTREAM solnMtxName;
725  solnMtxName<< current_dir<<"/A_TLSC.mtx";
726  fei::FillableMat solnMtx, checkMtx;
727  CHK_ERR( SolnCheck::readMatrix(solnMtxName.str().c_str(), numProcs_, solnMtx) );
728  CHK_ERR( SolnCheck::readMatrix(data_->checkFileName_.c_str(), numProcs_, checkMtx) );
729  int err = SolnCheck::compareMatrices(solnMtx, checkMtx);
730  delete [] current_dir;
731  if (err == 0) {
732  FEI_COUT << "Utst_fei_lsc: TEST PASSED" << FEI_ENDL;
733  }
734  else {
735  FEI_COUT << "Utst_fei_lsc: TEST FAILED" << FEI_ENDL;
736  return(-1);
737  }
738  }
739 
740  return(0);
741 }
virtual int getCRMultipliers(int numCRs, const int *CRIDs, double *results)=0
Definition: CRSet.hpp:25
virtual int getBlockElemIDList(GlobalID elemBlockID, int numElems, GlobalID *elemIDs)=0
virtual int getNumCRMultipliers(int &numMultCRs)=0
GlobalID slaveNodeID_
Definition: CRSet.hpp:45
virtual int getNumBlockElemDOF(GlobalID blockID, int &DOFPerElem) const =0
int slaveOffset_
Definition: CRSet.hpp:53
virtual int getNumLocalNodes(int &numNodes)=0
Definition: FEI.hpp:144
int crID_
Definition: CRSet.hpp:37
int numNodes_
Definition: CRSet.hpp:40
virtual int getNodalSolution(int numNodes, const GlobalID *nodeIDs, int *offsets, double *results)=0
std::ostream & console_out()
virtual int getBlockElemSolution(GlobalID elemBlockID, int numElems, const GlobalID *elemIDs, int &numElemDOFPerElement, double *results)=0
int slaveFieldID_
Definition: CRSet.hpp:48
virtual int getLocalNodeIDList(int &numNodes, GlobalID *nodeIDs, int lenNodeIDs)=0
fei::SharedPtr< LibraryWrapper > create_LibraryWrapper(MPI_Comm comm, const char *libraryName)
virtual int getCRMultIDList(int numMultCRs, int *multIDs)=0
virtual int getNumBlockElements(GlobalID blockID, int &numElems) const =0