MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | List of all members
AbstractLinAlgPack::VectorSpaceTester Class Reference

Testing class for VectorSpace, Vector and VectorMutable. More...

#include <AbstractLinAlgPack_VectorSpaceTester.hpp>

Public Member Functions

 STANDARD_MEMBER_COMPOSITION_MEMBERS (bool, print_all_tests)
 Members for option print_all_tests() (see Teuchos_StandardMemberCompositionMacros.hpp). More...
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (bool, print_vectors)
 Members for option print_vectors() (see Teuchos_StandardMemberCompositionMacros.hpp). More...
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (bool, throw_exception)
 Members for option throw_exception() (see Teuchos_StandardMemberCompositionMacros.hpp). More...
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (size_type, num_random_tests)
 Members for option num_random_tests() (see Teuchos_StandardMemberCompositionMacros.hpp). More...
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (value_type, warning_tol)
 Members for option () warning_tol(see Teuchos_StandardMemberCompositionMacros.hpp). More...
 
 STANDARD_MEMBER_COMPOSITION_MEMBERS (value_type, error_tol)
 Members for option error_tol() (see Teuchos_StandardMemberCompositionMacros.hpp). More...
 
 VectorSpaceTester (bool print_all_tests=false, bool print_vectors=false, bool throw_exception=true, size_type num_random_tests=4, value_type warning_tol=1e-14, value_type error_tol=1e-10)
 Constructor (set default options). More...
 
virtual ~VectorSpaceTester ()
 
virtual bool check_vector_space (const VectorSpace &space, std::ostream *out) const
 Run a vector space and the vectors it creates through a set of comprehensive tets. More...
 

Private Member Functions

void check_test (value_type err, std::ostream *out, bool *success) const
 

Detailed Description

Testing class for VectorSpace, Vector and VectorMutable.

The purpose of this class is to test a VectorSpace object and the VectorMutable objects that it creates. The testing function check_vector_space() calls all of the methods defined in the interfaces VectorSpace, Vector and VectorMutable and checks many of the post conditions but not all. It would be very difficult to completely verify every postcondition in every situation.

The behavior of the testing function check_vector_space() is strongly influenced by a set of options (see VectorSpaceTester()).

When writting new vector implementations, a developer is likely to spend a lot of time debuggin while in this testing function.

Definition at line 67 of file AbstractLinAlgPack_VectorSpaceTester.hpp.

Constructor & Destructor Documentation

AbstractLinAlgPack::VectorSpaceTester::VectorSpaceTester ( bool  print_all_tests = false,
bool  print_vectors = false,
bool  throw_exception = true,
size_type  num_random_tests = 4,
value_type  warning_tol = 1e-14,
value_type  error_tol = 1e-10 
)

Constructor (set default options).

These default options are appropriate for even the largest vector spaces.

Definition at line 75 of file AbstractLinAlgPack_VectorSpaceTester.cpp.

virtual AbstractLinAlgPack::VectorSpaceTester::~VectorSpaceTester ( )
inlinevirtual

Definition at line 115 of file AbstractLinAlgPack_VectorSpaceTester.hpp.

Member Function Documentation

AbstractLinAlgPack::VectorSpaceTester::STANDARD_MEMBER_COMPOSITION_MEMBERS ( bool  ,
print_all_tests   
)

Members for option print_all_tests() (see Teuchos_StandardMemberCompositionMacros.hpp).

AbstractLinAlgPack::VectorSpaceTester::STANDARD_MEMBER_COMPOSITION_MEMBERS ( bool  ,
print_vectors   
)

Members for option print_vectors() (see Teuchos_StandardMemberCompositionMacros.hpp).

AbstractLinAlgPack::VectorSpaceTester::STANDARD_MEMBER_COMPOSITION_MEMBERS ( bool  ,
throw_exception   
)

Members for option throw_exception() (see Teuchos_StandardMemberCompositionMacros.hpp).

AbstractLinAlgPack::VectorSpaceTester::STANDARD_MEMBER_COMPOSITION_MEMBERS ( size_type  ,
num_random_tests   
)

Members for option num_random_tests() (see Teuchos_StandardMemberCompositionMacros.hpp).

AbstractLinAlgPack::VectorSpaceTester::STANDARD_MEMBER_COMPOSITION_MEMBERS ( value_type  ,
warning_tol   
)

Members for option () warning_tol(see Teuchos_StandardMemberCompositionMacros.hpp).

AbstractLinAlgPack::VectorSpaceTester::STANDARD_MEMBER_COMPOSITION_MEMBERS ( value_type  ,
error_tol   
)

Members for option error_tol() (see Teuchos_StandardMemberCompositionMacros.hpp).

bool AbstractLinAlgPack::VectorSpaceTester::check_vector_space ( const VectorSpace space,
std::ostream *  out 
) const
virtual

Run a vector space and the vectors it creates through a set of comprehensive tets.

Parameters
space[in] The vector space object to test.
out[in/out] If out != NULL then output will be sent to *out.

The behavior of this function greatly depends on a number of options (see VectorSpaceTester() for the default values for these options). Access functions to set these options are provided by the prototypes of the macro STANDARD_MEMBER_COMPOSITION_MEMBERS().

  • print_all_tests(bool): If print_all_tests() == true, then some output will be sent to *out for every test performed. This is useful to see all of tests that are performed and in debugging.
  • print_vectors(bool): If print_vectors() == true, then all of the vectors will be printed that are created durring the tests. This option is really only needed durring initial debugging and should only be used with small vector spaces since it will produce a lot of O(space.dim()) output.
  • throw_exception(bool): If throw_exception() == true, then any object that throws an unexpected exception will cause that exception to be thrown clear of of this function. If out != NULL then the what() string will be printed to *out before the exception is rethrown. If throw_exception() == false, then all exceptions will be caught, printed to *out and then false is returned from the function.
  • num_random_tests(int): This is the number of random tests to perform per category of test. A higher number will result is better validation but will consume more CPU time.
  • warning_tol(value_type): Any test with a relative error greater than warning_tol() will result in a warning message printed to *out.
  • error_tol(value_type): Any test with a relative error greater than erfor_tol() will result in an error message printed to *out and the function will immediatly return false.

Definition at line 91 of file AbstractLinAlgPack_VectorSpaceTester.cpp.

void AbstractLinAlgPack::VectorSpaceTester::check_test ( value_type  err,
std::ostream *  out,
bool *  success 
) const
private

Definition at line 552 of file AbstractLinAlgPack_VectorSpaceTester.cpp.


The documentation for this class was generated from the following files: