|
Stratimikos Package Browser (Single Doxygen Collection)
Version of the Day
|
00001 // @HEADER 00002 // *********************************************************************** 00003 // 00004 // Stratimikos: Thyra-based strategies for linear solvers 00005 // Copyright (2006) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 // @HEADER 00028 00029 #include "test_single_stratimikos_solver.hpp" 00030 #include "Teuchos_GlobalMPISession.hpp" 00031 #include "Teuchos_VerboseObject.hpp" 00032 #include "Teuchos_CommandLineProcessor.hpp" 00033 #include "Teuchos_XMLParameterListHelpers.hpp" 00034 #include "Teuchos_StandardCatchMacros.hpp" 00035 00036 int main(int argc, char* argv[]) 00037 { 00038 00039 Teuchos::GlobalMPISession mpiSession(&argc,&argv); 00040 00041 using Teuchos::CommandLineProcessor; 00042 00043 bool success = true; 00044 bool verbose = true; 00045 00046 Teuchos::RCP<Teuchos::FancyOStream> 00047 out = Teuchos::VerboseObjectBase::getDefaultOStream(); 00048 00049 try { 00050 00051 // 00052 // Read options from command-line 00053 // 00054 00055 std::string inputFile = ""; 00056 std::string extraParams = ""; 00057 bool dumpAll = false; 00058 00059 CommandLineProcessor clp(false); // Don't throw exceptions 00060 clp.addOutputSetupOptions(true); 00061 clp.setOption( "input-file", &inputFile, "Input file [Required].", true ); 00062 clp.setOption( "extra-params", &extraParams, "Extra parameters overriding the parameters read in from --input-file"); 00063 clp.setDocString( 00064 "Testing program for Trilinos (and non-Trilinos) linear solvers access through Thyra." 00065 ); 00066 00067 CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv); 00068 if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL ) return parse_return; 00069 00070 Teuchos::ParameterList paramList; 00071 if(verbose) *out << "\nReading parameters from XML file \""<<inputFile<<"\" ...\n"; 00072 Teuchos::updateParametersFromXmlFile(inputFile, Teuchos::inOutArg(paramList)); 00073 if(extraParams.length()) { 00074 if(verbose) *out << "\nAppending extra parameters from the XML string \""<<extraParams<<"\" ...\n"; 00075 Teuchos::updateParametersFromXmlString(extraParams, Teuchos::inOutArg(paramList)); 00076 } 00077 00078 success 00079 = Thyra::test_single_stratimikos_solver( 00080 ¶mList, dumpAll, verbose?&*out:0 00081 ); 00082 00083 } 00084 TEUCHOS_STANDARD_CATCH_STATEMENTS(verbose,std::cerr,success) 00085 00086 if (verbose) { 00087 if(success) *out << "\nCongratulations! All of the tests checked out!\n"; 00088 else *out << "\nOh no! At least one of the tests failed!\n"; 00089 } 00090 00091 return ( success ? 0 : 1 ); 00092 }
1.7.6.1