Stratimikos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
test_epetra_stratimikos_solver_driver.cpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Stratimikos: Thyra-based strategies for linear solvers
4 //
5 // Copyright 2006 NTESS and the Stratimikos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
16 
17 int main(int argc, char* argv[])
18 {
19 
20  Teuchos::GlobalMPISession mpiSession(&argc,&argv);
21 
23 
24  bool success = true;
25  bool verbose = true;
26 
28  out = Teuchos::VerboseObjectBase::getDefaultOStream();
29 
30  try {
31 
32  //
33  // Read options from command-line
34  //
35 
36  std::string inputFile = "";
37  std::string extraParams = "";
38  bool dumpAll = false;
39 
40  CommandLineProcessor clp(false); // Don't throw exceptions
41  clp.addOutputSetupOptions(true);
42  clp.setOption( "input-file", &inputFile, "Input file [Required].", true );
43  clp.setOption( "extra-params", &extraParams, "Extra parameters overriding the parameters read in from --input-file");
44  clp.setDocString(
45  "Testing program for Trilinos (and non-Trilinos) linear solvers access through Thyra."
46  );
47 
48  CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv);
49  if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL ) return parse_return;
50 
51  Teuchos::ParameterList paramList;
52  if(verbose) *out << "\nReading parameters from XML file \""<<inputFile<<"\" ...\n";
53  Teuchos::updateParametersFromXmlFile(inputFile, Teuchos::inOutArg(paramList));
54  if(extraParams.length()) {
55  if(verbose) *out << "\nAppending extra parameters from the XML string \""<<extraParams<<"\" ...\n";
56  Teuchos::updateParametersFromXmlString(extraParams, Teuchos::inOutArg(paramList));
57  }
58 
59  success
61  &paramList, dumpAll, verbose?&*out:0
62  );
63 
64  }
65  TEUCHOS_STANDARD_CATCH_STATEMENTS(verbose,std::cerr,success)
66 
67  if (verbose) {
68  if(success) *out << "\nCongratulations! All of the tests checked out!\n";
69  else *out << "\nOh no! At least one of the tests failed!\n";
70  }
71 
72  return ( success ? EXIT_SUCCESS : EXIT_FAILURE );
73 }
int main(int argc, char *argv[])
#define TEUCHOS_STANDARD_CATCH_STATEMENTS(VERBOSE, ERR_STREAM, SUCCESS_FLAG)
bool test_epetra_stratimikos_solver(Teuchos::ParameterList *paramList, const bool dumpAll, Teuchos::FancyOStream *out)
Testing function for a single epetra stratimikos solver for a single matrix.
bool dumpAll