42 #ifndef THYRA_VECTOR_SPACE_TESTER_HPP
43 #define THYRA_VECTOR_SPACE_TESTER_HPP
45 #include "Thyra_VectorSpaceTester_decl.hpp"
46 #include "Thyra_TestingTools.hpp"
47 #include "Thyra_VectorStdOps.hpp"
48 #include "Thyra_MultiVectorStdOps.hpp"
49 #include "Teuchos_TestingHelpers.hpp"
55 template <
class Scalar>
59 ,
const int num_random_vectors_in
60 ,
const int num_mv_cols_in
61 ,
const bool show_all_tests_in
62 ,
const bool dump_all_in
64 :num_mv_cols_(num_mv_cols_in)
65 ,warning_tol_(warning_tol_in)
66 ,error_tol_(error_tol_in)
67 ,num_random_vectors_(num_random_vectors_in)
68 ,show_all_tests_(show_all_tests_in)
69 ,dump_all_(dump_all_in)
73 template <
class Scalar>
80 using Teuchos::describe;
89 OSTab tab(out,1,
"THYRA");
91 bool result, success =
true;
93 if (
nonnull(out)) *out <<endl<<
"*** Entering Thyra::VectorSpaceTester<"<<ST::name()<<
">::check(vs,...) ...\n";
95 if (
nonnull(out)) *out <<endl<<
"Testing a vector space vs described as:\n" << describe(vs,verbLevel);
99 <<endl<<
"A) Calling basic query functions ...\n"
100 <<endl<<
"vs.dim() = " << vs.
dim()
101 <<endl<<
"vs.hasInCoreView() = " << vs.
hasInCoreView() << std::endl;
103 if (
nonnull(out)) *out <<endl<<
"B) Checking that vs is compatible with itself, cloning, etc. ...\n";
112 if (
nonnull(out)) *out <<endl<<
"C) Creating a randomized vector member v ...\n";
114 v = createMember(vs);
115 randomize(Scalar(-ST::one()),Scalar(+ST::one()),v.
ptr());
117 if (
nonnull(out)) *out <<endl<<
"D) Testing the VectorBase interface of v ...\n";
119 result = vectorTester_.check(*v,out.
get());
120 if(!result) success =
false;
122 if (
nonnull(out)) *out <<endl<<
"C) Creating a randomized MultiVector member mv ...\n";
124 mv = createMembers(vs,num_mv_cols());
125 randomize(Scalar(-ST::one()),Scalar(+ST::one()),mv.
ptr());
127 if (
nonnull(out)) *out <<endl<<
"D) Testing the MultiVectorBase interface of mv ...\n";
129 result = vectorTester_.multiVectorTester().check(*mv, out.
ptr());
130 if(!result) success =
false;
134 *out << endl <<
"Congratulations, this VectorSpaceBase object seems to check out!\n";
136 *out << endl <<
"Oh no, at least one of the tests performed with this VectorSpaceBase object failed (see above failures)!\n";
137 *out << endl <<
"*** Leaving VectorSpaceTester<"<<ST::name()<<
">::check(vs,...)\n";
148 #endif // THYRA_VECTOR_SPACE_TESTER_HPP
basic_OSTab< char > OSTab
virtual RCP< const VectorSpaceBase< Scalar > > clone() const
Clone this object (if supported).
basic_FancyOStream< char > FancyOStream
Abstract interface for objects that represent a space for vectors.
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_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
#define TEUCHOS_TEST_ASSERT(v1, out, success)
bool nonnull(const boost::shared_ptr< T > &p)
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.
virtual bool isCompatible(const VectorSpaceBase< Scalar > &vecSpc) const =0
Compare the compatibility of two vector spaces.
virtual Ordinal dim() const =0
Return the dimension of the vector space.
virtual bool hasInCoreView(const Range1D &rng=Range1D(), const EViewType viewType=VIEW_TYPE_DETACHED, const EStrideType strideType=STRIDE_TYPE_NONUNIT) const
Returns true if this->acquireDetachedView(rng,...) returns a direct view of the range of data request...