Thyra_LinearOpTesterDecl.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 // 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 #ifndef THYRA_LINEAR_OP_TESTER_DECL_HPP
00030 #define THYRA_LINEAR_OP_TESTER_DECL_HPP
00031 
00032 #include "Thyra_OperatorVectorTypes.hpp"
00033 #include "Thyra_MultiVectorRandomizerBase.hpp"
00034 #include "Teuchos_ScalarTraits.hpp"
00035 #include "Teuchos_StandardMemberCompositionMacros.hpp"
00036 
00037 namespace Thyra {
00038 
00055 template<class RangeScalar, class DomainScalar = RangeScalar>
00056 class LinearOpTester {
00057 public:
00058 
00060   typedef typename Teuchos::PromotionTraits<RangeScalar,DomainScalar>::promote Scalar;
00061 
00063   typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType ScalarMag;
00064 
00072   LinearOpTester(
00073     const bool          check_linear_properties         = true
00074     ,const ScalarMag    linear_properties_warning_tol   = 1e-13
00075     ,const ScalarMag    linear_properties_error_tol     = 1e-10
00076     ,const bool         check_adjoint                   = true
00077     ,const ScalarMag    adjoint_warning_tol             = 1e-13
00078     ,const ScalarMag    adjoint_error_tol               = 1e-10
00079     ,const bool         check_for_symmetry              = false
00080     ,const ScalarMag    symmetry_warning_tol            = 1e-13
00081     ,const ScalarMag    symmetry_error_tol              = 1e-10
00082     ,const int          num_random_vectors              = 1
00083     ,const bool         show_all_tests                  = false
00084     ,const bool         dump_all                        = false
00085     );
00086 
00090   STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, check_linear_properties )
00091 
00092   
00095   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, linear_properties_warning_tol )
00096 
00101   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, linear_properties_error_tol )
00102 
00106   STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, check_adjoint  )
00107 
00111   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, adjoint_warning_tol )
00112 
00116   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, adjoint_error_tol )
00117 
00121   STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, check_for_symmetry  )
00122 
00126   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, symmetry_warning_tol )
00127 
00131   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, symmetry_error_tol )
00132 
00135   STANDARD_MEMBER_COMPOSITION_MEMBERS( int, num_random_vectors )
00136 
00139   STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, show_all_tests )
00140 
00144   STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, dump_all )
00145 
00154   void set_all_warning_tol( const ScalarMag warning_tol );
00155 
00164   void set_all_error_tol( const ScalarMag error_tol );
00165 
00238   bool check(
00239     const LinearOpBase<RangeScalar,DomainScalar>  &op
00240     ,MultiVectorRandomizerBase<RangeScalar>       *rangeRandomizer
00241     ,MultiVectorRandomizerBase<DomainScalar>      *domainRandomizer
00242     ,std::ostream                                 *out
00243     ,const std::string                            &leadingIndent  = ""
00244     ,const std::string                            &indentSpacer   = "  "
00245     ) const;
00246 
00248   bool check(
00249     const LinearOpBase<RangeScalar,DomainScalar>  &op
00250     ,std::ostream                                 *out
00251     ,const std::string                            &leadingIndent  = ""
00252     ,const std::string                            &indentSpacer   = "  "
00253     ) const;
00254 
00255 
00290   bool compare(
00291     const LinearOpBase<RangeScalar,DomainScalar>  &op1
00292     ,const LinearOpBase<RangeScalar,DomainScalar> &op2
00293     ,MultiVectorRandomizerBase<DomainScalar>      *domainRandomizer
00294     ,std::ostream                                 *out
00295     ,const std::string                            &leadingIndent  = ""
00296     ,const std::string                            &indentSpacer   = "  "
00297     ) const;
00298   
00300   bool compare(
00301     const LinearOpBase<RangeScalar,DomainScalar>  &op1
00302     ,const LinearOpBase<RangeScalar,DomainScalar> &op2
00303     ,std::ostream                                 *out
00304     ,const std::string                            &leadingIndent  = ""
00305     ,const std::string                            &indentSpacer   = "  "
00306     ) const;
00307 
00308 }; // class LinearOpTester
00309 
00310 } // namespace Thyra
00311 
00312 #endif // THYRA_LINEAR_OP_TESTER_DECL_HPP

Generated on Thu Sep 18 12:39:52 2008 for Thyra ANA Operator/VectorBase Interfaces and Related Software by doxygen 1.3.9.1