|
Thyra Package Browser (Single Doxygen Collection) Version of the Day
|
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 00030 #ifndef THYRA_LINEAR_OP_TESTER_DECL_HPP 00031 #define THYRA_LINEAR_OP_TESTER_DECL_HPP 00032 00033 00034 #include "Thyra_OperatorVectorTypes.hpp" 00035 #include "Thyra_MultiVectorRandomizerBase.hpp" 00036 #include "Teuchos_ScalarTraits.hpp" 00037 #include "Teuchos_PromotionTraits.hpp" 00038 #include "Teuchos_StandardMemberCompositionMacros.hpp" 00039 #include "Teuchos_FancyOStream.hpp" 00040 00041 00042 namespace Thyra { 00043 00044 00061 template<class Scalar> 00062 class LinearOpTester { 00063 public: 00064 00066 typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType ScalarMag; 00067 00072 LinearOpTester(); 00073 00077 STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, check_linear_properties ); 00078 00082 STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, linear_properties_warning_tol ); 00083 00088 STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, linear_properties_error_tol ); 00089 00093 STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, check_adjoint ); 00094 00098 STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, adjoint_warning_tol ); 00099 00103 STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, adjoint_error_tol ); 00104 00108 STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, check_for_symmetry ); 00109 00113 STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, symmetry_warning_tol ); 00114 00118 STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, symmetry_error_tol ); 00119 00122 STANDARD_MEMBER_COMPOSITION_MEMBERS( int, num_random_vectors ); 00123 00126 STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, show_all_tests ); 00127 00131 STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, dump_all ); 00132 00135 STANDARD_MEMBER_COMPOSITION_MEMBERS( int, num_rhs ); 00136 00145 void enable_all_tests( const bool enable_all_tests ); 00146 00155 void set_all_warning_tol( const ScalarMag warning_tol ); 00156 00165 void set_all_error_tol( const ScalarMag error_tol ); 00166 00236 bool check( 00237 const LinearOpBase<Scalar> &op, 00238 const Ptr<MultiVectorRandomizerBase<Scalar> > &rangeRandomizer, 00239 const Ptr<MultiVectorRandomizerBase<Scalar> > &domainRandomizer, 00240 const Ptr<Teuchos::FancyOStream> &out 00241 ) const; 00242 00244 bool check( 00245 const LinearOpBase<Scalar> &op, 00246 const Ptr<Teuchos::FancyOStream> &out 00247 ) const; 00248 00287 bool compare( 00288 const LinearOpBase<Scalar> &op1, 00289 const LinearOpBase<Scalar> &op2, 00290 const Ptr<MultiVectorRandomizerBase<Scalar> > &domainRandomizer, 00291 const Ptr<Teuchos::FancyOStream> &out_arg 00292 ) const; 00293 00297 bool compare( 00298 const LinearOpBase<Scalar> &op1, 00299 const LinearOpBase<Scalar> &op2, 00300 const Ptr<Teuchos::FancyOStream> &out_arg 00301 ) const; 00302 00305 00307 bool check( 00308 const LinearOpBase<Scalar> &op, 00309 MultiVectorRandomizerBase<Scalar> *rangeRandomizer, 00310 MultiVectorRandomizerBase<Scalar> *domainRandomizer, 00311 Teuchos::FancyOStream *out 00312 ) const 00313 { 00314 using Teuchos::ptr; 00315 return check(op, ptr(rangeRandomizer), ptr(domainRandomizer), ptr(out)); 00316 } 00317 00319 bool check( 00320 const LinearOpBase<Scalar> &op, 00321 Teuchos::FancyOStream *out 00322 ) const 00323 { 00324 return check(op, Teuchos::ptr(out)); 00325 } 00326 00328 bool compare( 00329 const LinearOpBase<Scalar> &op1, 00330 const LinearOpBase<Scalar> &op2, 00331 MultiVectorRandomizerBase<Scalar> *domainRandomizer, 00332 Teuchos::FancyOStream *out_arg 00333 ) const 00334 { 00335 using Teuchos::ptr; 00336 return compare(op1, op2, ptr(domainRandomizer), ptr(out_arg)); 00337 } 00338 00340 bool compare( 00341 const LinearOpBase<Scalar> &op1, 00342 const LinearOpBase<Scalar> &op2, 00343 Teuchos::FancyOStream *out_arg 00344 ) const 00345 { 00346 return compare(op1, op2, Teuchos::ptr(out_arg)); 00347 } 00348 00350 00351 private: 00352 00353 void setDefaultTols(); 00354 00355 }; // class LinearOpTester 00356 00357 00358 } // namespace Thyra 00359 00360 00361 #endif // THYRA_LINEAR_OP_TESTER_DECL_HPP
1.7.4