10#ifndef THYRA_MULTI_VECTOR_TESTER_DEF_HPP
11#define THYRA_MULTI_VECTOR_TESTER_DEF_HPP
13#include "Thyra_MultiVectorTester_decl.hpp"
14#include "Thyra_MultiVectorBase.hpp"
15#include "Thyra_MultiVectorStdOps.hpp"
16#include "Thyra_VectorSpaceBase.hpp"
17#include "Thyra_VectorStdOps.hpp"
28 const int num_random_vectors_in,
29 const bool show_all_tests_in,
30 const bool dump_all_in
32 :warning_tol_(warning_tol_in),
33 error_tol_(error_tol_in),
34 num_random_vectors_(num_random_vectors_in),
35 show_all_tests_(show_all_tests_in),
36 dump_all_(dump_all_in)
48 using Teuchos::describe;
57 if (!is_null(out_inout))
58 out = Teuchos::rcpFromPtr(out_inout);
65 OSTab tab(out,1,
"THYRA");
69 *out <<
"\n*** Entering "<<this->
description()<<
"::checkMultiVector(vs,...) ...\n";
71 *out <<
"\nTesting MultiVectorBase objects created from vs = " <<
describe(vs, verbLevel);
73 const Ordinal dim = vs.
dim();
74 const Scalar scalarDim = as<Scalar>(dim);
78 *out <<
"\n"<<tc<<
") Checking non-contiguous non-const multi-vector views ...\n";
82 const int numCols = 6;
86 one = as<Scalar>(1.0),
87 three = as<Scalar>(3.0),
88 five = as<Scalar>(5.0);
109 *out <<
"\n"<<tc<<
") Checking non-contiguous const multi-vector views ...\n";
113 const int numCols = 6;
116 one = as<Scalar>(1.0),
117 three = as<Scalar>(3.0),
118 five = as<Scalar>(5.0);
125 mv.
getConst()->subView(tuple<int>(1, 3, 4, 5)());
138 *out <<
"\nCongratulations, this MultiVectorBase objects"
139 <<
" created form this vector space seems to check out!\n";
141 *out <<
"\nOh no, at least one of the tests performed failed!\n";
143 *out <<
"\n*** Leaving "<<this->
description()<<
"::checkMultiVector(vs,...) ...\n";
150template<
class Scalar>
157 using Teuchos::describe;
164 if (!is_null(out_inout))
165 out = Teuchos::rcpFromPtr(out_inout);
172 OSTab tab(out,1,
"THYRA");
174 bool result, success =
true;
176 *out <<
"\n*** Entering Thyra::MultiVectorTester<"<<ST::name()<<
">::check(mv,...) ...\n";
178 *out <<
"\nTesting a MultiVectorBase object mv described as:\n" <<
describe(mv,verbLevel);
182 *out <<
"\nChecking the LinearOpBase interface of mv ...\n";
183 result =linearOpTester_.check(mv, out.
ptr());
184 if(!result) success =
false;
187 *out <<
"\nCongratulations, this MultiVectorBase object seems to check out!\n";
189 *out <<
"\nOh no, at least one of the tests performed with this MultiVectorBase object failed (see above failures)!\n";
191 *out <<
"\n*** Leaving MultiVectorTester<"<<ST::name()<<
">::check(mv,...)\n";
virtual void describe(FancyOStream &out, const EVerbosityLevel verbLevel=verbLevel_default) const
virtual std::string description() const
RCP< const T > getConst() const
Interface for a collection of column vectors called a multi-vector.
void assign(const Ptr< MultiVectorBase< Scalar > > &V, Scalar alpha)
V = alpha.
bool checkMultiVector(const VectorSpaceBase< Scalar > &vs, const Ptr< Teuchos::FancyOStream > &out) const
Check a multi-vector as created by a VectorSpaceBase object.
Teuchos::ScalarTraits< Scalar >::magnitudeType ScalarMag
Local typedef for scalar magnitude.
MultiVectorTester(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.
bool check(const MultiVectorBase< Scalar > &mv, const Ptr< Teuchos::FancyOStream > &out) const
Check a multi-vector object in a set of comprehensive teats.
void dump_all(const bool dump_all)
Set whether all of the vectors and multi-vectors will be dumped or not.
Scalar sum(const VectorBase< Scalar > &v)
Sum of vector elements: result = sum( v(i), i = 0...v.space()->dim()-1 ).
Abstract interface for objects that represent a space for vectors.
virtual Ordinal dim() const =0
Return the dimension of the vector space.
RCP< MultiVectorBase< Scalar > > createMembers(const RCP< const VectorSpaceBase< Scalar > > &vs, int numMembers, const std::string &label="")
Create a set of vector members (a MultiVectorBase) from the vector space.
TypeTo as(const TypeFrom &t)
basic_FancyOStream< char > FancyOStream
basic_OSTab< char > OSTab
basic_oblackholestream< char, std::char_traits< char > > oblackholestream
#define TEUCHOS_TEST_FLOATING_EQUALITY(v1, v2, tol, out, success)