Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_VectorSpaceTester_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_SPACE_TESTER_DECL_HPP
43 #define THYRA_VECTOR_SPACE_TESTER_DECL_HPP
44 
45 #include "Thyra_OperatorVectorTypes.hpp"
46 #include "Thyra_VectorTester.hpp"
47 
48 namespace Thyra {
49 
50 
70 template<class Scalar>
72 public:
73 
76 
85 
92  const VectorTester<Scalar>& vectorTester() const;
93 
99  void warning_tol( const ScalarMag &warning_tol );
100 
102  ScalarMag warning_tol() const;
103 
109  void error_tol( const ScalarMag &error_tol );
110 
112  ScalarMag error_tol() const;
113 
118  void num_random_vectors( const int num_random_vectors );
119 
123  int num_random_vectors() const;
124 
127  STANDARD_MEMBER_COMPOSITION_MEMBERS( int, num_mv_cols );
128 
134  void show_all_tests( const bool show_all_tests );
135 
139  bool show_all_tests() const;
140 
146  void dump_all( const bool dump_all );
147 
151  bool dump_all() const;
152 
161  const ScalarMag warning_tol = 1e-13
162  ,const ScalarMag error_tol = 1e-10
163  ,const int num_random_vectors = 1
164  ,const int num_mv_cols = 4
165  ,const bool show_all_tests = false
166  ,const bool dump_all = false
167  );
168 
214  bool check(
215  const VectorSpaceBase<Scalar> &vs,
217  ) const;
218 
219 private:
220 
221  VectorTester<Scalar> vectorTester_;
222 
223  ScalarMag warning_tol_;
224  ScalarMag error_tol_;
225  int num_random_vectors_;
226  bool show_all_tests_;
227  bool dump_all_;
228 
229 }; // class VectorSpaceTester
230 
231 
232 // ///////////////////////////
233 // Inline members
234 
235 
236 template<class Scalar>
237 inline
239 {
240  return vectorTester_;
241 }
242 
243 
244 template<class Scalar>
245 inline
247 {
248  return vectorTester_;
249 }
250 
251 
252 template<class Scalar>
253 inline
255 {
256  warning_tol_ = warning_tol_in;
257  vectorTester_.warning_tol(warning_tol_in);
258 }
259 
260 
261 template<class Scalar>
262 inline
265 {
266  return warning_tol_;
267 }
268 
269 
270 template<class Scalar>
271 inline
273 {
274  error_tol_ = error_tol_in;
275  vectorTester_.error_tol(error_tol_in);
276 }
277 
278 
279 template<class Scalar>
280 inline
283 {
284  return error_tol_;
285 }
286 
287 
288 template<class Scalar>
289 inline
290 void VectorSpaceTester<Scalar>::num_random_vectors( const int num_random_vectors_in )
291 {
292  num_random_vectors_ = num_random_vectors_in;
293  vectorTester_.num_random_vectors(num_random_vectors_in);
294 }
295 
296 
297 template<class Scalar>
298 inline
300 {
301  return num_random_vectors_;
302 }
303 
304 
305 template<class Scalar>
306 inline
307 void VectorSpaceTester<Scalar>::show_all_tests( const bool show_all_tests_in )
308 {
309  show_all_tests_ = show_all_tests_in;
310  vectorTester_.show_all_tests(show_all_tests_in);
311 }
312 
313 
314 template<class Scalar>
315 inline
317 {
318  return show_all_tests_;
319 }
320 
321 
322 template<class Scalar>
323 inline
324 void VectorSpaceTester<Scalar>::dump_all( const bool dump_all_in )
325 {
326  dump_all_ = dump_all_in;
327  vectorTester_.dump_all(dump_all_in);
328 }
329 
330 
331 template<class Scalar>
332 inline
334 {
335  return dump_all_;
336 }
337 
338 
339 } // namespace Thyra
340 
341 
342 #endif // THYRA_VECTOR_SPACE_TESTER_DECL_HPP
ScalarMag warning_tol() const
Return the warning tolerance for *this.
int num_random_vectors() const
Return the number of random vectors used for *this objects tests.
Testing class for VectorSpace and the VectorBase and MultiVectorBase objects that it creates...
VectorTester< Scalar > & vectorTester()
Expose a non-const reference to the VectorTester object used to test the MultiVectorBase interface su...
STANDARD_MEMBER_COMPOSITION_MEMBERS(int, num_mv_cols)
Set the number of columns to use to create test MultiVectorBase objects.
Abstract interface for objects that represent a space for vectors.
Unit testing class for a VectorBase object.
ScalarMag error_tol() const
Return the error tolerance for *this.
VectorSpaceTester(const ScalarMag warning_tol=1e-13, const ScalarMag error_tol=1e-10, const int num_random_vectors=1, const int num_mv_cols=4, const bool show_all_tests=false, const bool dump_all=false)
Default constructor which sets default parameter values.
Teuchos::ScalarTraits< Scalar >::magnitudeType ScalarMag
Local typedef for scalar magnitude.
bool check(const VectorSpaceBase< Scalar > &vs, Teuchos::FancyOStream *out) const
Check a vector space and the objects it creates through a set of comprehensive tests.
bool dump_all() const
Return the number of random vectors used for *this objects tests.
bool show_all_tests() const
Return the number of random vectors used for *this objects tests.