Thyra Version of the Day
Thyra_VectorTester_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 #ifndef THYRA_VECTOR_TESTER_DECL_HPP
00043 #define THYRA_VECTOR_TESTER_DECL_HPP
00044 
00045 #include "Thyra_OperatorVectorTypes.hpp"
00046 #include "Thyra_MultiVectorTester.hpp"
00047 
00048 namespace Thyra {
00049 
00056 template<class Scalar>
00057 class VectorTester {
00058 public:
00059 
00061   typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType ScalarMag;
00062 
00070   MultiVectorTester<Scalar>& multiVectorTester();
00071 
00078   const MultiVectorTester<Scalar>& multiVectorTester() const;
00079 
00085   void warning_tol( const ScalarMag &warning_tol );
00086 
00088   ScalarMag warning_tol() const;
00089 
00095   void error_tol( const ScalarMag &error_tol );
00096 
00098   ScalarMag error_tol() const;
00099 
00104   void num_random_vectors( const int num_random_vectors );
00105 
00109   int num_random_vectors() const;
00110 
00116   void show_all_tests( const bool show_all_tests );
00117 
00121   bool show_all_tests() const;
00122 
00128   void dump_all( const bool dump_all );
00129 
00133   bool dump_all() const;
00134 
00155   VectorTester(
00156     const ScalarMag     warning_tol            = 1e-13
00157     ,const ScalarMag    error_tol              = 1e-10
00158     ,const int          num_random_vectors     = 1
00159     ,const bool         show_all_tests         = false
00160     ,const bool         dump_all               = false
00161     );
00162 
00194   bool check(
00195     const VectorBase<Scalar>       &v
00196     ,Teuchos::FancyOStream         *out
00197     ) const;
00198 
00199 private:
00200 
00201   MultiVectorTester<Scalar> multiVectorTester_;
00202 
00203   ScalarMag    warning_tol_;
00204   ScalarMag    error_tol_;
00205   int          num_random_vectors_;
00206   bool         show_all_tests_;
00207   bool         dump_all_;
00208 
00209 }; // class VectorTester
00210 
00211 // //////////////////////////////////
00212 // Inline members
00213 
00214 template<class Scalar>
00215 inline
00216 MultiVectorTester<Scalar>& VectorTester<Scalar>::multiVectorTester()
00217 {
00218   return multiVectorTester_;
00219 }
00220 
00221 template<class Scalar>
00222 inline
00223 const MultiVectorTester<Scalar>& VectorTester<Scalar>::multiVectorTester() const
00224 {
00225   return multiVectorTester_;
00226 }
00227 
00228 template<class Scalar>
00229 inline
00230 void VectorTester<Scalar>::warning_tol( const ScalarMag &warning_tol_in )
00231 {
00232   warning_tol_ = warning_tol_in;
00233   multiVectorTester_.warning_tol(warning_tol_in);
00234 }
00235 
00236 template<class Scalar>
00237 inline
00238 typename VectorTester<Scalar>::ScalarMag
00239 VectorTester<Scalar>::warning_tol() const
00240 {
00241   return warning_tol_;
00242 }
00243 
00244 template<class Scalar>
00245 inline
00246 void VectorTester<Scalar>::error_tol( const ScalarMag &error_tol_in )
00247 {
00248   error_tol_ = error_tol_in;
00249   multiVectorTester_.error_tol(error_tol_in);
00250 }
00251 
00252 template<class Scalar>
00253 inline
00254 typename VectorTester<Scalar>::ScalarMag
00255 VectorTester<Scalar>::error_tol() const
00256 {
00257   return error_tol_;
00258 }
00259 
00260 template<class Scalar>
00261 inline
00262 void VectorTester<Scalar>::num_random_vectors( const int num_random_vectors_in )
00263 {
00264   num_random_vectors_ = num_random_vectors_in;
00265   multiVectorTester_.num_random_vectors(num_random_vectors_in);
00266 }
00267 
00268 template<class Scalar>
00269 inline
00270 int VectorTester<Scalar>::num_random_vectors() const
00271 {
00272   return num_random_vectors_;
00273 }
00274 
00275 template<class Scalar>
00276 inline
00277 void VectorTester<Scalar>::show_all_tests( const bool show_all_tests_in )
00278 {
00279   show_all_tests_ = show_all_tests_in;
00280   multiVectorTester_.show_all_tests(show_all_tests_in);
00281 }
00282 
00283 template<class Scalar>
00284 inline
00285 bool VectorTester<Scalar>::show_all_tests() const
00286 {
00287   return show_all_tests_;
00288 }
00289 
00290 template<class Scalar>
00291 inline
00292 void VectorTester<Scalar>::dump_all( const bool dump_all_in )
00293 {
00294   dump_all_ = dump_all_in;
00295   multiVectorTester_.dump_all(dump_all_in);
00296 }
00297 
00298 template<class Scalar>
00299 inline
00300 bool VectorTester<Scalar>::dump_all() const
00301 {
00302   return dump_all_;
00303 }
00304 
00305 } // namespace Thyra
00306 
00307 #endif // THYRA_VECTOR_TESTER_DECL_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines