Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_VectorTester_decl.hpp
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Thyra: Interfaces and Support for Abstract Numerical Algorithms
5 // Copyright (2004) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (bartlettra@ornl.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #ifndef THYRA_VECTOR_TESTER_DECL_HPP
43 #define THYRA_VECTOR_TESTER_DECL_HPP
44 
45 #include "Thyra_OperatorVectorTypes.hpp"
46 #include "Thyra_MultiVectorTester.hpp"
47 
48 namespace Thyra {
49 
56 template<class Scalar>
57 class VectorTester {
58 public:
59 
62 
71 
79 
85  void warning_tol( const ScalarMag &warning_tol );
86 
88  ScalarMag warning_tol() const;
89 
95  void error_tol( const ScalarMag &error_tol );
96 
98  ScalarMag error_tol() const;
99 
104  void num_random_vectors( const int num_random_vectors );
105 
109  int num_random_vectors() const;
110 
116  void show_all_tests( const bool show_all_tests );
117 
121  bool show_all_tests() const;
122 
128  void dump_all( const bool dump_all );
129 
133  bool dump_all() const;
134 
155  VectorTester(
156  const ScalarMag warning_tol = 1e-13
157  ,const ScalarMag error_tol = 1e-10
158  ,const int num_random_vectors = 1
159  ,const bool show_all_tests = false
160  ,const bool dump_all = false
161  );
162 
194  bool check(
195  const VectorBase<Scalar> &v
197  ) const;
198 
199 private:
200 
201  MultiVectorTester<Scalar> multiVectorTester_;
202 
203  ScalarMag warning_tol_;
204  ScalarMag error_tol_;
205  int num_random_vectors_;
206  bool show_all_tests_;
207  bool dump_all_;
208 
209 }; // class VectorTester
210 
211 // //////////////////////////////////
212 // Inline members
213 
214 template<class Scalar>
215 inline
217 {
218  return multiVectorTester_;
219 }
220 
221 template<class Scalar>
222 inline
224 {
225  return multiVectorTester_;
226 }
227 
228 template<class Scalar>
229 inline
230 void VectorTester<Scalar>::warning_tol( const ScalarMag &warning_tol_in )
231 {
232  warning_tol_ = warning_tol_in;
233  multiVectorTester_.warning_tol(warning_tol_in);
234 }
235 
236 template<class Scalar>
237 inline
240 {
241  return warning_tol_;
242 }
243 
244 template<class Scalar>
245 inline
246 void VectorTester<Scalar>::error_tol( const ScalarMag &error_tol_in )
247 {
248  error_tol_ = error_tol_in;
249  multiVectorTester_.error_tol(error_tol_in);
250 }
251 
252 template<class Scalar>
253 inline
256 {
257  return error_tol_;
258 }
259 
260 template<class Scalar>
261 inline
262 void VectorTester<Scalar>::num_random_vectors( const int num_random_vectors_in )
263 {
264  num_random_vectors_ = num_random_vectors_in;
265  multiVectorTester_.num_random_vectors(num_random_vectors_in);
266 }
267 
268 template<class Scalar>
269 inline
271 {
272  return num_random_vectors_;
273 }
274 
275 template<class Scalar>
276 inline
277 void VectorTester<Scalar>::show_all_tests( const bool show_all_tests_in )
278 {
279  show_all_tests_ = show_all_tests_in;
280  multiVectorTester_.show_all_tests(show_all_tests_in);
281 }
282 
283 template<class Scalar>
284 inline
286 {
287  return show_all_tests_;
288 }
289 
290 template<class Scalar>
291 inline
292 void VectorTester<Scalar>::dump_all( const bool dump_all_in )
293 {
294  dump_all_ = dump_all_in;
295  multiVectorTester_.dump_all(dump_all_in);
296 }
297 
298 template<class Scalar>
299 inline
301 {
302  return dump_all_;
303 }
304 
305 } // namespace Thyra
306 
307 #endif // THYRA_VECTOR_TESTER_DECL_HPP
bool dump_all() const
Return the number of random vectors used for *this objects tests.
int num_random_vectors() const
Return the number of random vectors used for *this objects tests.
ScalarMag warning_tol() const
Return the warning tolerance for *this.
bool check(const VectorBase< Scalar > &v, Teuchos::FancyOStream *out) const
Check a vector object in a set of comprehensive tests.
MultiVectorTester< Scalar > & multiVectorTester()
Expose a non-const reference to the MultiVectorTester object used to test the MultiVectorBase interfa...
ScalarMag error_tol() const
Return the error tolerance for *this.
Unit testing class for a VectorBase object.
Abstract interface for finite-dimensional dense vectors.
Teuchos::ScalarTraits< Scalar >::magnitudeType ScalarMag
Local typedef for scalar magnitude.
bool show_all_tests() const
Return the number of random vectors used for *this objects tests.
VectorTester(const ScalarMag warning_tol=1e-13, const ScalarMag error_tol=1e-10, const int num_random_vectors=1, const bool show_all_tests=false, const bool dump_all=false)
Default constructor which sets default parameter values.
Unit testing class for a MultiVectorBase object.