15 #include "az_aztec_defs.h"
19 std::string _matrixFile
23 ,
double _maxSolutionError
24 ,
double _maxSlackErrorFrac
27 ,
double _maxPrecSolutionError
28 ,
double _maxPrecSlackErrorFrac
53 int main(
int argc,
char* argv[])
60 bool result, success =
true;
71 std::string matrixDir =
".";
72 int numRandomVectors = 1;
74 bool showAllTestsDetails =
false;
76 std::string aztecOutputLevel =
"freq";
77 int aztecOutputFreq = 0;
79 CommandLineProcessor clp(
false);
80 clp.setOption(
"matrix-dir", &matrixDir,
"Base directory for the test matrices" );
81 clp.setOption(
"num-random-vectors", &numRandomVectors,
"Number of times a test is performed with different random vectors." );
82 clp.setOption(
"verbose",
"quiet", &verbose,
"Set if output is printed or not." );
83 clp.setOption(
"show-all-tests",
"no-show-all-tests", &showAllTests,
"Set if all the tests are shown or not." );
84 clp.setOption(
"show-all-tests-details",
"no-show-all-tests-details", &showAllTestsDetails,
"Set if all the details of the tests are shown or not." );
85 clp.setOption(
"dump-all",
"no-dump-all", &dumpAll,
"Determines if vectors are printed or not." );
86 clp.setOption(
"aztec-output-level", &aztecOutputLevel,
"Aztec output level (freq,last,summary,warnings,all)" );
87 clp.setOption(
"aztec-output-freq", &aztecOutputFreq,
"Aztec output freqency (> 0)" );
88 CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv);
89 if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL )
return parse_return;
97 const int numTestMatrices = 9;
103 const MTP testMatrices[numTestMatrices] =
105 MTP(
"bcsstk01.mtx" ,1e-12, 40 , 1e-4, 0.6, 1.0, 20 , 1e-10, 0.5, 1.0)
106 ,MTP(
"bcsstk02.mtx" ,1e-12, 40 , 1e-3, 0.5, 1.0, 2 , 1e-10, 0.5, 1.0)
107 ,MTP(
"bcsstk04.mtx" ,1e-12, 80 , 1e-4, 0.999990, 1.0, 40 , 1e-10, 0.999990, 1.0)
108 ,MTP(
"Diagonal.mtx" ,1e-12, 4 , 1e-6, 1e-14, 1.0, 2 , 1e-10, 1e-14, 1.0)
109 ,MTP(
"FourByFour.mtx" ,1e-12, 4 , 1e-6, 1e-14, 1.0, 2 , 1e-10, 1e-14, 1.0)
110 ,MTP(
"KheadK.mtx" ,1e-12, 8 , 1e-6, 1e-14, 1.0, 2 , 1e-10, 1e-14, 1.0)
111 ,MTP(
"KheadSorted.mtx" ,1e-12, 8 , 1e-6, 1e-14, 1.0, 2 , 1e-10, 1e-14, 1.0)
112 ,MTP(
"nos1.mtx" ,1e-11, 200, 1e-4, 0.8, 1.0, 237, 1e-2, 5.0, 1.0)
113 ,MTP(
"nos5.mtx" ,1e-12, 468, 1e-5, 0.5, 1.0, 468, 1e-10, 0.5, 1.0)
118 for(
int matrix_i = 0; matrix_i < numTestMatrices; ++matrix_i ) {
120 mtp = testMatrices[matrix_i];
124 for(
int prec_i = 0; prec_i < 2; ++prec_i ) {
126 out << std::endl<<matrix_i<<
":"<<prec_i<<
": Testing, matrixFile=\'"<<mtp.
matrixFile<<
"\', ";
129 double maxSolutionError;
132 paramList(
"AztecOOLinearOpWithSolveFactory");
134 &fwdSolvePL = paramList.
sublist(
"Forward Solve"),
135 &adjSolvePL = paramList.
sublist(
"Adjoint Solve");
137 &fwdAztecOOPL = fwdSolvePL.
sublist(
"AztecOO Settings"),
138 &adjAztecOOPL = adjSolvePL.sublist(
"AztecOO Settings");
139 if( aztecOutputLevel !=
"freq" ) {
140 fwdAztecOOPL.
set(
"Output Frequency",aztecOutputLevel);
141 adjAztecOOPL.
set(
"Output Frequency",aztecOutputLevel);
144 fwdAztecOOPL.
set(
"Output Frequency",aztecOutputFreq);
145 adjAztecOOPL.
set(
"Output Frequency",aztecOutputFreq);
148 out <<
"no aztec preconditioning ... ";
149 fwdAztecOOPL.
set(
"Aztec Preconditioner",
"none");
150 testTranspose =
true;
158 out <<
"using aztec preconditioning ... ";
159 fwdAztecOOPL.
set(
"Aztec Preconditioner",
"ilu");
160 testTranspose =
false;
167 std::ostringstream oss;
170 Thyra::test_single_aztecoo_thyra_solver(
171 matrixDir+
"/"+mtp.
matrixFile,testTranspose,numRandomVectors
173 ,showAllTestsDetails,dumpAll,¶mList,&fancy_oss
175 if(!result) success =
false;
179 out << std::endl << oss.str();
181 out <<
" : passed!\n";
185 out << std::endl << oss.str();
187 out <<
" : failed!\n";
197 if(success) out <<
"\nCongratulations! All of the tests checked out!\n";
198 else out <<
"\nOh no! At least one of the tests failed!\n";
201 return ( success ? EXIT_SUCCESS : EXIT_FAILURE );
int main(int argc, char *argv[])
RCP< ParameterList > sublist(const RCP< ParameterList > ¶mList, const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
#define TEUCHOS_STANDARD_CATCH_STATEMENTS(VERBOSE, ERR_STREAM, SUCCESS_FLAG)
double maxPrecSolutionError
double maxPrecSlackErrorFrac
MatrixTestPacket(std::string _matrixFile, double _maxFwdError, int _maxIters, double _maxResid, double _maxSolutionError, double _maxSlackErrorFrac, int _maxPrecIters, double _maxPrecResid, double _maxPrecSolutionError, double _maxPrecSlackErrorFrac)
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)