45 #include "Teuchos_CommandLineProcessor.hpp" 46 #include "Teuchos_VerboseObject.hpp" 48 int main(
int argc,
char* argv[])
51 using Teuchos::CommandLineProcessor;
56 Teuchos::RCP<Teuchos::FancyOStream>
57 out = Teuchos::VerboseObjectBase::getDefaultOStream();
65 std::string matrixFile =
"";
67 #ifdef HAVE_AMESOS_KLU 73 bool testTranspose =
true;
74 int numRandomVectors = 1;
75 double maxFwdError = 1e-14;
76 double maxError = 1e-10;
77 double maxResid = 1e-10;
78 bool showAllTests =
false;
81 CommandLineProcessor clp;
82 clp.throwExceptions(
false);
83 clp.addOutputSetupOptions(
true);
84 clp.setOption(
"matrix-file", &matrixFile,
"Matrix iput file [Required]." );
86 "solver-type", &solverType
88 ,
"Type of direct solver." 91 "refactorization-policy", &refactorizationPolicy
93 ,
"Pivoting policy used on refactorizations." 95 clp.setOption(
"test-transpose",
"no-test-transpose", &testTranspose,
"Test the transpose solve or not." );
96 clp.setOption(
"num-random-vectors", &numRandomVectors,
"Number of times a test is performed with different random vectors." );
97 clp.setOption(
"max-fwd-error", &maxFwdError,
"The maximum relative error in the forward operator." );
98 clp.setOption(
"max-error", &maxError,
"The maximum relative error in the solution." );
99 clp.setOption(
"max-resid", &maxResid,
"The maximum relative error in the residual." );
100 clp.setOption(
"verbose",
"quiet", &verbose,
"Set if output is printed or not." );
101 clp.setOption(
"show-all-tests",
"no-show-all-tests", &showAllTests,
"Set if all the tests are shown or not." );
102 clp.setOption(
"dump-all",
"no-dump-all", &dumpAll,
"Determines if vectors are printed or not." );
103 CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv);
104 if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL )
return parse_return;
106 TEUCHOS_TEST_FOR_EXCEPT( matrixFile ==
"" );
108 Teuchos::ParameterList amesosLOWSFPL;
109 amesosLOWSFPL.set(
"Solver Type",
toString(solverType));
110 amesosLOWSFPL.set(
"Refactorization Policy",
toString(refactorizationPolicy));
114 matrixFile,&amesosLOWSFPL,testTranspose,numRandomVectors
115 ,maxFwdError,maxError,maxResid,showAllTests,dumpAll,verbose?&*out:0
119 catch(
const std::exception &excpt ) {
120 std::cerr <<
"*** Caught standard exception : " << excpt.what() << std::endl;
124 std::cerr <<
"*** Caught an unknown exception\n";
129 if(success) *out <<
"\nCongratulations! All of the tests checked out!\n";
130 else *out <<
"\nOh no! At least one of the tests failed!\n";
133 return ( success ? 0 : 1 );
ERefactorizationPolicy
The policy used on refactoring a matrix.
bool test_single_amesos_thyra_solver(const std::string matrixFile, Teuchos::ParameterList *amesosLOWSFPL, const bool testTranspose, const int numRandomVectors, const double maxFwdError, const double maxError, const double maxResid, const bool showAllTests, const bool dumpAll, Teuchos::FancyOStream *out)
Testing function for a single amesos solver with a single matrix.
const ERefactorizationPolicy refactorizationPolicyValues[numRefactorizationPolices]
const int numRefactorizationPolices
const char * solverTypeNames[numSolverTypes]
const char * refactorizationPolicyNames[numRefactorizationPolices]
const ESolverType solverTypeValues[numSolverTypes]
Completely new pivoting will be used on refactorizations!
const char * toString(const ESolverType solverType)
int main(int argc, char *argv[])