47 #include "az_aztec_defs.h"
51 std::string _matrixFile
55 ,
double _maxSolutionError
56 ,
double _maxSlackErrorFrac
59 ,
double _maxPrecSolutionError
60 ,
double _maxPrecSlackErrorFrac
85 int main(
int argc,
char* argv[])
92 bool result, success =
true;
103 std::string matrixDir =
".";
104 int numRandomVectors = 1;
106 bool showAllTestsDetails =
false;
108 std::string aztecOutputLevel =
"freq";
109 int aztecOutputFreq = 0;
111 CommandLineProcessor clp(
false);
112 clp.setOption(
"matrix-dir", &matrixDir,
"Base directory for the test matrices" );
113 clp.setOption(
"num-random-vectors", &numRandomVectors,
"Number of times a test is performed with different random vectors." );
114 clp.setOption(
"verbose",
"quiet", &verbose,
"Set if output is printed or not." );
115 clp.setOption(
"show-all-tests",
"no-show-all-tests", &showAllTests,
"Set if all the tests are shown or not." );
116 clp.setOption(
"show-all-tests-details",
"no-show-all-tests-details", &showAllTestsDetails,
"Set if all the details of the tests are shown or not." );
117 clp.setOption(
"dump-all",
"no-dump-all", &dumpAll,
"Determines if vectors are printed or not." );
118 clp.setOption(
"aztec-output-level", &aztecOutputLevel,
"Aztec output level (freq,last,summary,warnings,all)" );
119 clp.setOption(
"aztec-output-freq", &aztecOutputFreq,
"Aztec output freqency (> 0)" );
120 CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv);
121 if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL )
return parse_return;
129 const int numTestMatrices = 9;
135 const MTP testMatrices[numTestMatrices] =
137 MTP(
"bcsstk01.mtx" ,1e-12, 40 , 1e-4, 0.6, 1.0, 20 , 1e-10, 0.5, 1.0)
138 ,MTP(
"bcsstk02.mtx" ,1e-12, 40 , 1e-3, 0.5, 1.0, 2 , 1e-10, 0.5, 1.0)
139 ,MTP(
"bcsstk04.mtx" ,1e-12, 80 , 1e-4, 0.999990, 1.0, 40 , 1e-10, 0.999990, 1.0)
140 ,MTP(
"Diagonal.mtx" ,1e-12, 4 , 1e-6, 1e-14, 1.0, 2 , 1e-10, 1e-14, 1.0)
141 ,MTP(
"FourByFour.mtx" ,1e-12, 4 , 1e-6, 1e-14, 1.0, 2 , 1e-10, 1e-14, 1.0)
142 ,MTP(
"KheadK.mtx" ,1e-12, 8 , 1e-6, 1e-14, 1.0, 2 , 1e-10, 1e-14, 1.0)
143 ,MTP(
"KheadSorted.mtx" ,1e-12, 8 , 1e-6, 1e-14, 1.0, 2 , 1e-10, 1e-14, 1.0)
144 ,MTP(
"nos1.mtx" ,1e-11, 200, 1e-4, 0.8, 1.0, 237, 1e-2, 5.0, 1.0)
145 ,MTP(
"nos5.mtx" ,1e-12, 468, 1e-5, 0.5, 1.0, 468, 1e-10, 0.5, 1.0)
150 for(
int matrix_i = 0; matrix_i < numTestMatrices; ++matrix_i ) {
152 mtp = testMatrices[matrix_i];
156 for(
int prec_i = 0; prec_i < 2; ++prec_i ) {
158 out << std::endl<<matrix_i<<
":"<<prec_i<<
": Testing, matrixFile=\'"<<mtp.
matrixFile<<
"\', ";
161 double maxSolutionError;
164 paramList(
"AztecOOLinearOpWithSolveFactory");
166 &fwdSolvePL = paramList.
sublist(
"Forward Solve"),
167 &adjSolvePL = paramList.
sublist(
"Adjoint Solve");
169 &fwdAztecOOPL = fwdSolvePL.
sublist(
"AztecOO Settings"),
170 &adjAztecOOPL = adjSolvePL.sublist(
"AztecOO Settings");
171 if( aztecOutputLevel !=
"freq" ) {
172 fwdAztecOOPL.
set(
"Output Frequency",aztecOutputLevel);
173 adjAztecOOPL.
set(
"Output Frequency",aztecOutputLevel);
176 fwdAztecOOPL.
set(
"Output Frequency",aztecOutputFreq);
177 adjAztecOOPL.
set(
"Output Frequency",aztecOutputFreq);
180 out <<
"no aztec preconditioning ... ";
181 fwdAztecOOPL.
set(
"Aztec Preconditioner",
"none");
182 testTranspose =
true;
190 out <<
"using aztec preconditioning ... ";
191 fwdAztecOOPL.
set(
"Aztec Preconditioner",
"ilu");
192 testTranspose =
false;
199 std::ostringstream oss;
202 Thyra::test_single_aztecoo_thyra_solver(
203 matrixDir+
"/"+mtp.
matrixFile,testTranspose,numRandomVectors
205 ,showAllTestsDetails,dumpAll,¶mList,&fancy_oss
207 if(!result) success =
false;
211 out << std::endl << oss.str();
213 out <<
" : passed!\n";
217 out << std::endl << oss.str();
219 out <<
" : failed!\n";
229 if(success) out <<
"\nCongratulations! All of the tests checked out!\n";
230 else out <<
"\nOh no! At least one of the tests failed!\n";
233 return ( success ? EXIT_SUCCESS : EXIT_FAILURE );
int main(int argc, char *argv[])
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
RCP< ParameterList > sublist(const RCP< ParameterList > ¶mList, const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
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)