Thyra Version of the Day
Thyra_LinearOpWithSolveTester_decl.hpp
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 //    Thyra: Interfaces and Support for Abstract Numerical Algorithms
00005 //                 Copyright (2004) 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 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00038 // 
00039 // ***********************************************************************
00040 // @HEADER
00041 
00042 #ifndef THYRA_LINEAR_OP_WITH_SOLVE_TESTER_DECL_HPP
00043 #define THYRA_LINEAR_OP_WITH_SOLVE_TESTER_DECL_HPP
00044 
00045 
00046 #include "Thyra_LinearOpWithSolveBase.hpp"
00047 #include "Teuchos_StandardMemberCompositionMacros.hpp"
00048 #include "Teuchos_ParameterListAcceptorDefaultBase.hpp"
00049 #include "Teuchos_FancyOStream.hpp"
00050 
00051 
00052 namespace Thyra {
00053 
00054 
00091 template<class Scalar>
00092 class LinearOpWithSolveTester
00093   : virtual public Teuchos::ParameterListAcceptorDefaultBase
00094 {
00095 public:
00096 
00099 
00101   typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType ScalarMag;
00102 
00104 
00107 
00109   LinearOpWithSolveTester();
00110   
00112   STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, check_forward_default );
00114   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag,
00115     forward_default_residual_warning_tol );
00117   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag,
00118     forward_default_residual_error_tol );
00120   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag,
00121     forward_default_solution_error_warning_tol );
00123   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag,
00124     forward_default_solution_error_error_tol );
00125 
00127   STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, check_forward_residual );
00130   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag,
00131     forward_residual_solve_tol );
00133   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag,
00134     forward_residual_slack_warning_tol );
00136   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag,
00137     forward_residual_slack_error_tol );
00138 
00140   STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, check_adjoint_default );
00142   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag,
00143     adjoint_default_residual_warning_tol );
00145   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag,
00146     adjoint_default_residual_error_tol );
00148   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag,
00149     adjoint_default_solution_error_warning_tol );
00151   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag,
00152     adjoint_default_solution_error_error_tol );
00153 
00156   STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, check_adjoint_residual );
00159   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag,
00160     adjoint_residual_solve_tol );
00162   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag,
00163     adjoint_residual_slack_warning_tol );
00165   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag,
00166     adjoint_residual_slack_error_tol );
00167 
00170   STANDARD_MEMBER_COMPOSITION_MEMBERS( int, num_random_vectors );
00171 
00174   STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, show_all_tests );
00175 
00179   STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, dump_all );
00180 
00183   STANDARD_MEMBER_COMPOSITION_MEMBERS( int, num_rhs );
00184 
00191   void turn_off_all_tests();
00192 
00199   void set_all_solve_tol( const ScalarMag solve_tol );
00200 
00207   void set_all_slack_warning_tol( const ScalarMag slack_warning_tol );
00208 
00215   void set_all_slack_error_tol( const ScalarMag slack_error_tol );
00216 
00218 
00221 
00223   void setParameterList(const RCP<ParameterList>& paramList);
00224 
00226   RCP<const ParameterList> getValidParameters() const;
00227 
00229 
00232   
00237   bool check(
00238     const LinearOpWithSolveBase<Scalar> &op,
00239     Teuchos::FancyOStream *out
00240     ) const;
00241 
00243 
00244 private:
00245 
00246   static const bool check_forward_default_default_;
00247   static const bool check_forward_residual_default_;
00248   static const bool check_adjoint_default_default_;
00249   static const bool check_adjoint_residual_default_;
00250 
00251   static const ScalarMag warning_tol_default_;
00252   static const ScalarMag error_tol_default_;
00253   static const ScalarMag solve_tol_default_;
00254   static const ScalarMag slack_warning_tol_default_;
00255   static const ScalarMag slack_error_tol_default_;
00256 
00257   static const int num_random_vectors_default_;
00258   static const bool show_all_tests_default_;
00259   static const bool dump_all_default_;
00260   static const int num_rhs_default_;
00261 
00262   static const std::string AllSolveTol_name_;
00263   static const std::string AllSlackWarningTol_name_;
00264   static const std::string AllSlackErrorTol_name_;
00265   static const std::string ShowAllTests_name_;
00266   static const std::string DumpAll_name_;
00267 
00268 }; // class LinearOpWithSolveTester
00269 
00270 
00271 } // namespace Thyra
00272 
00273 
00274 #endif // THYRA_LINEAR_OP_WITH_SOLVE_TESTER_DECL_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines