18 int main(
int argc,
char* argv[])
29 out = Teuchos::VerboseObjectBase::getDefaultOStream();
37 std::string matrixFile =
"";
38 bool testTranspose =
false;
39 bool usePreconditioner =
true;
41 int numRandomVectors = 1;
42 double maxFwdError = 1e-14;
43 int maxIterations = 400;
45 int gmresKrylovLength = 25;
46 int outputFrequency = 10;
47 bool outputMaxResOnly =
true;
49 double maxResid = 1e-6;
50 double maxSolutionError = 1e-6;
54 CommandLineProcessor clp;
55 clp.throwExceptions(
false);
56 clp.addOutputSetupOptions(
true);
57 clp.setOption(
"matrix-file", &matrixFile,
"Matrix input file [Required]." );
58 clp.setOption(
"test-transpose",
"no-test-transpose", &testTranspose,
"Test the transpose solve or not." );
59 clp.setOption(
"use-preconditioner",
"no-use-preconditioner", &usePreconditioner,
"Use the preconditioner or not." );
60 clp.setOption(
"num-rhs", &numRhs,
"Number of RHS in linear solve." );
61 clp.setOption(
"num-random-vectors", &numRandomVectors,
"Number of times a test is performed with different random vectors." );
62 clp.setOption(
"max-fwd-error", &maxFwdError,
"The maximum relative error in the forward operator." );
63 clp.setOption(
"max-iters", &maxIterations,
"The maximum number of linear solver iterations to take." );
64 clp.setOption(
"max-restarts", &maxRestarts,
"???." );
65 clp.setOption(
"gmres-krylov-length", &gmresKrylovLength,
"???." );
66 clp.setOption(
"output-frequency", &outputFrequency,
"Number of linear solver iterations between output" );
67 clp.setOption(
"output-max-res-only",
"output-all-res", &outputMaxResOnly,
"Determines if only the max residual is printed or if all residuals are printed per iteration." );
68 clp.setOption(
"block-size", &blockSize,
"???." );
69 clp.setOption(
"max-resid", &maxResid,
"The maximum relative error in the residual." );
70 clp.setOption(
"max-solution-error", &maxSolutionError,
"The maximum relative error in the solution of the linear system." );
71 clp.setOption(
"verbose",
"quiet", &verbose,
"Set if output is printed or not." );
72 clp.setOption(
"show-all-tests",
"no-show-all-tests", &showAllTests,
"Set if all the tests are shown or not." );
73 clp.setOption(
"dump-all",
"no-dump-all", &dumpAll,
"Determines if vectors are printed or not." );
74 CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv);
75 if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL )
return parse_return;
81 belosLOWSFPL.
set(
"Solver Type",
"Block GMRES");
84 belosLOWSFPL.
sublist(
"Solver Types");
87 belosLOWSFPL_solver.
sublist(
"Block GMRES");
89 belosLOWSFPL_gmres.
set(
"Maximum Iterations",
int(maxIterations));
90 belosLOWSFPL_gmres.
set(
"Convergence Tolerance",
double(maxResid));
91 belosLOWSFPL_gmres.
set(
"Maximum Restarts",
int(maxRestarts));
92 belosLOWSFPL_gmres.
set(
"Block Size",
int(blockSize));
93 belosLOWSFPL_gmres.
set(
"Num Blocks",
int(gmresKrylovLength));
94 belosLOWSFPL_gmres.
set(
"Output Frequency",
int(outputFrequency));
95 belosLOWSFPL_gmres.
set(
"Show Maximum Residual Norm Only",
bool(outputMaxResOnly));
98 if(usePreconditioner) {
99 precPL.
set(
"Overlap",
int(2));
100 precPL.
set(
"Prec Type",
"ILUT");
104 = Thyra::test_single_belos_thyra_solver(
105 matrixFile,testTranspose,usePreconditioner,numRhs,numRandomVectors
106 ,maxFwdError,maxResid,maxSolutionError,showAllTests,dumpAll
107 ,&belosLOWSFPL,&precPL
115 if(success) *out <<
"\nCongratulations! All of the tests checked out!\n";
116 else *out <<
"\nOh no! At least one of the tests failed!\n";
119 return ( success ? 0 : 1 );
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)
#define TEUCHOS_STANDARD_CATCH_STATEMENTS(VERBOSE, ERR_STREAM, SUCCESS_FLAG)
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)