Thyra Version of the Day
Thyra_LinearOpTester_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 Roscoe A. Bartlett (bartlettra@ornl.gov) 
00038 // 
00039 // ***********************************************************************
00040 // @HEADER
00041 
00042 
00043 #ifndef THYRA_LINEAR_OP_TESTER_DECL_HPP
00044 #define THYRA_LINEAR_OP_TESTER_DECL_HPP
00045 
00046 
00047 #include "Thyra_OperatorVectorTypes.hpp"
00048 #include "Thyra_MultiVectorRandomizerBase.hpp"
00049 #include "Teuchos_ScalarTraits.hpp"
00050 #include "Teuchos_PromotionTraits.hpp"
00051 #include "Teuchos_StandardMemberCompositionMacros.hpp"
00052 #include "Teuchos_FancyOStream.hpp"
00053 
00054 
00055 namespace Thyra {
00056 
00057 
00074 template<class Scalar>
00075 class LinearOpTester {
00076 public:
00077 
00079   typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType ScalarMag;
00080 
00085   LinearOpTester();
00086   
00090   STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, check_linear_properties );
00091 
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 
00148   STANDARD_MEMBER_COMPOSITION_MEMBERS( int, num_rhs );
00149 
00158   void enable_all_tests( const bool enable_all_tests );
00159 
00168   void set_all_warning_tol( const ScalarMag warning_tol );
00169 
00178   void set_all_error_tol( const ScalarMag error_tol );
00179 
00249   bool check(
00250     const LinearOpBase<Scalar> &op,
00251     const Ptr<MultiVectorRandomizerBase<Scalar> > &rangeRandomizer,
00252     const Ptr<MultiVectorRandomizerBase<Scalar> > &domainRandomizer,
00253     const Ptr<FancyOStream> &out
00254     ) const;
00255 
00257   bool check(
00258     const LinearOpBase<Scalar> &op,
00259     const Ptr<FancyOStream> &out
00260     ) const;
00261 
00300   bool compare(
00301     const LinearOpBase<Scalar> &op1,
00302     const LinearOpBase<Scalar> &op2,
00303     const Ptr<MultiVectorRandomizerBase<Scalar> > &domainRandomizer,
00304     const Ptr<FancyOStream> &out_arg
00305     ) const;
00306  
00310   bool compare(
00311     const LinearOpBase<Scalar> &op1,
00312     const LinearOpBase<Scalar> &op2,
00313     const Ptr<FancyOStream> &out_arg
00314     ) const;
00315 
00318 
00320   THYRA_DEPRECATED bool check(
00321     const LinearOpBase<Scalar> &op,
00322     MultiVectorRandomizerBase<Scalar> *rangeRandomizer,
00323     MultiVectorRandomizerBase<Scalar> *domainRandomizer,
00324     FancyOStream *out
00325     ) const
00326     {
00327       using Teuchos::ptr;
00328       return check(op, ptr(rangeRandomizer), ptr(domainRandomizer), ptr(out));
00329     }
00330 
00332   THYRA_DEPRECATED bool check(
00333     const LinearOpBase<Scalar> &op,
00334     FancyOStream *out
00335     ) const
00336     {
00337       return check(op, Teuchos::ptr(out));
00338     }
00339 
00341   THYRA_DEPRECATED bool compare(
00342     const LinearOpBase<Scalar> &op1,
00343     const LinearOpBase<Scalar> &op2,
00344     MultiVectorRandomizerBase<Scalar> *domainRandomizer,
00345     FancyOStream *out_arg
00346     ) const
00347     {
00348       using Teuchos::ptr;
00349       return compare(op1, op2, ptr(domainRandomizer), ptr(out_arg));
00350     }
00351  
00353   THYRA_DEPRECATED bool compare(
00354     const LinearOpBase<Scalar> &op1,
00355     const LinearOpBase<Scalar> &op2,
00356     FancyOStream *out_arg
00357     ) const
00358     {
00359       return compare(op1, op2, Teuchos::ptr(out_arg));
00360     }
00361 
00363 
00364 private:
00365 
00366   void setDefaultTols();
00367 
00368 }; // class LinearOpTester
00369 
00370 
00371 } // namespace Thyra
00372 
00373 
00374 #endif // THYRA_LINEAR_OP_TESTER_DECL_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines