Stratimikos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
test_tpetra_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 
10 #include <Tpetra_Core.hpp>
17 
18 int main(int argc, char* argv[])
19 {
20 
22 
23  bool success = true;
24  bool verbose = true;
25 
26 
28  out = Teuchos::VerboseObjectBase::getDefaultOStream();
29 
30  try {
31  Tpetra::ScopeGuard tpetraScope(&argc,&argv);
32  {
33 
34  //
35  // Read options from command-line
36  //
37 
38  std::string inputFile = "";
39  std::string extraParams = "";
40  bool dumpAll = false;
41 
42  CommandLineProcessor clp(false); // Don't throw exceptions
43  clp.addOutputSetupOptions(true);
44  clp.setOption( "input-file", &inputFile, "Input file [Required].", true );
45  clp.setOption( "extra-params", &extraParams, "Extra parameters overriding the parameters read in from --input-file");
46  clp.setDocString(
47  "Testing program for Tpetra-Belos linear solvers access through Thyra."
48  );
49 
50  CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv);
51  if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL ) return parse_return;
52 
53  Teuchos::ParameterList paramList;
54  if(verbose) *out << "\nReading parameters from XML file \""<<inputFile<<"\" ...\n";
55  Teuchos::updateParametersFromXmlFile(inputFile, Teuchos::inOutArg(paramList));
56  if(extraParams.length()) {
57  if(verbose) *out << "\nAppending extra parameters from the XML string \""<<extraParams<<"\" ...\n";
58  Teuchos::updateParametersFromXmlString(extraParams, Teuchos::inOutArg(paramList));
59  }
60 
61  success
63  &paramList, dumpAll, verbose?&*out:0
64  );
65 
66  } //End Tpetra scope
67  }
68  TEUCHOS_STANDARD_CATCH_STATEMENTS(verbose,std::cerr,success)
69 
70  if (verbose) {
71  if(success) *out << "\nCongratulations! All of the tests checked out!\n";
72  else *out << "\nOh no! At least one of the tests failed!\n";
73  }
74 
75  return ( success ? EXIT_SUCCESS : EXIT_FAILURE );
76 }
int main(int argc, char *argv[])
#define TEUCHOS_STANDARD_CATCH_STATEMENTS(VERBOSE, ERR_STREAM, SUCCESS_FLAG)
bool test_tpetra_stratimikos_solver(Teuchos::ParameterList *paramList, const bool dumpAll, Teuchos::FancyOStream *out)
Testing function for a single tpetra stratimikos solver for a single matrix.
bool dumpAll