test_single_aztecoo_thyra_solver_driver.cpp

Go to the documentation of this file.
00001 /*@HEADER
00002 // ***********************************************************************
00003 // 
00004 //        AztecOO: An Object-Oriented Aztec Linear Solver Package 
00005 //                 Copyright (2002) 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 Michael A. Heroux (maherou@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 //@HEADER
00028 */
00029 
00030 #include "test_single_aztecoo_thyra_solver.hpp"
00031 #include "Teuchos_GlobalMPISession.hpp"
00032 #include "Teuchos_CommandLineProcessor.hpp"
00033 #include "Teuchos_ParameterList.hpp"
00034 
00035 int main(int argc, char* argv[])
00036 {
00037 
00038   Teuchos::GlobalMPISession mpiSession(&argc,&argv);
00039   
00040   using Teuchos::CommandLineProcessor;
00041 
00042   bool success = true;
00043   bool verbose = true;
00044 
00045   Teuchos::FancyOStream out(Teuchos::rcp(&std::cout,false));
00046 
00047   try {
00048 
00049     //
00050     // Read options from command-line
00051     //
00052     
00053     std::string     matrixFile             = "";
00054     bool            testTranspose          = true;
00055     int             numRandomVectors       = 1;
00056     double          maxFwdError            = 1e-14;
00057     int             maxIterations          = 400;
00058     double          maxResid               = 1e-6;
00059     double          maxSolutionError       = 1e-6;
00060     bool            showAllTests           = false;
00061     bool            dumpAll                = false;
00062     std::string     aztecOutputLevel       = "freq";
00063     int             aztecOutputFreq        = 0;
00064     std::string     aztecPrec              = "none";
00065     std::string     aztecSubdomainSolve    = "ilu";
00066 
00067     CommandLineProcessor  clp(false); // Don't throw exceptions
00068     clp.setOption( "matrix-file", &matrixFile, "Matrix input file [Required]." );
00069     clp.setOption( "test-transpose", "no-test-transpose", &testTranspose, "Test the transpose solve or not." );
00070     clp.setOption( "num-random-vectors", &numRandomVectors, "Number of times a test is performed with different random vectors." );
00071     clp.setOption( "max-fwd-error", &maxFwdError, "The maximum relative error in the forward operator." );
00072     clp.setOption( "max-iters", &maxIterations, "The maximum number of linear solver iterations to take." );
00073     clp.setOption( "max-resid", &maxResid, "The maximum relative error in the residual." );
00074     clp.setOption( "max-solution-error", &maxSolutionError, "The maximum relative error in the solution of the linear system." );
00075     clp.setOption( "verbose", "quiet", &verbose, "Set if output is printed or not." );
00076     clp.setOption( "show-all-tests", "no-show-all-tests", &showAllTests, "Set if all the tests are shown or not." );
00077     clp.setOption( "dump-all", "no-dump-all", &dumpAll, "Determines if vectors are printed or not." );
00078     clp.setOption( "aztec-output-level", &aztecOutputLevel, "Aztec output level (freq,last,summary,warnings,all)" );
00079     clp.setOption( "aztec-output-freq", &aztecOutputFreq, "Aztec output freqency (> 0)" );
00080     clp.setOption( "aztec-prec", &aztecPrec, "Type of aztec preconditioner (none,sym_GS,Neumann,Jacobi,ls,dom_decomp)" );
00081     clp.setOption( "aztec-subdomain-solve", &aztecSubdomainSolve, "Type of subdomain solve for --aztec-prec==dom_decomp only (ilu,ilut)" );
00082     CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv);
00083     if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL ) return parse_return;
00084 
00085     TEST_FOR_EXCEPT( matrixFile == "" );
00086 
00087     Teuchos::ParameterList
00088       paramList("AztecOOLinearOpWithSolve");
00089     Teuchos::ParameterList
00090       &fwdSolveParamList = paramList.sublist("Forward Solve"),
00091       &adjSolveParamList = paramList.sublist("Adjoint Solve");
00092     fwdSolveParamList.set("Max Iterations",maxIterations);
00093     adjSolveParamList.set("Max Iterations",maxIterations);
00094 /*
00095     Teuchos::ParameterList
00096       &fwdAztecOOParamList = fwdSolveParamList.sublist("AztecOO"),
00097       &adjAztecOOParamList = fwdSolveParamList.sublist("AztecOO");
00098     if( aztecOutputLevel != "freq" ) {
00099       fwdAztecOOParamList.set("Output Frequency",aztecOutputLevel);
00100       adjAztecOOParamList.set("Output Frequency",aztecOutputLevel);
00101     }
00102     else {
00103       fwdAztecOOParamList.set("Output Frequency",aztecOutputFreq);
00104       adjAztecOOParamList.set("Output Frequency",aztecOutputFreq);
00105     }
00106     if( aztecPrec != "none" ) {
00107       fwdAztecOOParamList.set("Aztec Preconditioner",aztecPrec);
00108       adjAztecOOParamList.set("Aztec Preconditioner",aztecPrec);
00109       if(aztecPrec=="dom_decomp") {
00110         fwdAztecOOParamList.set("AZ_subdomain_solve",aztecSubdomainSolve);
00111         adjAztecOOParamList.set("AZ_subdomain_solve",aztecSubdomainSolve);
00112       }
00113     }
00114 */
00115     
00116     success
00117       = Thyra::test_single_aztecoo_thyra_solver(
00118         matrixFile,testTranspose,numRandomVectors
00119         ,maxFwdError,maxResid,maxSolutionError,showAllTests,dumpAll
00120         ,&paramList
00121         ,verbose?&out:0
00122         );
00123 
00124   }
00125   catch( const std::exception &excpt ) {
00126     std::cerr << "*** Caught standard exception : " << excpt.what() << std::endl;
00127     success = false;
00128   }
00129   catch( ... ) {
00130     std::cerr << "*** Caught an unknown exception\n";
00131     success = false;
00132   }
00133   
00134   if (verbose) {
00135     if(success)  out << "\nCongratulations! All of the tests checked out!\n";
00136     else         out << "\nOh no! At least one of the tests failed!\n";
00137   }
00138 
00139   return ( success ? 0 : 1 );
00140 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
Generated on Wed Apr 13 10:19:51 2011 for Stratimikos Package Browser (Single Doxygen Collection) by  doxygen 1.6.3