Thyra Package Browser (Single Doxygen Collection) Version of the Day
DefaultMultiVectorLinearOpWithSolve_UnitTests.cpp
Go to the documentation of this file.
00001 
00002 #include "Thyra_DefaultMultiVectorLinearOpWithSolve.hpp"
00003 #include "Thyra_DefaultSerialDenseLinearOpWithSolveFactory.hpp"
00004 #include "Thyra_DefaultMultiVectorProductVectorSpace.hpp"
00005 #include "Thyra_LinearOpWithSolveFactoryHelpers.hpp"
00006 #include "Thyra_DefaultSpmdVectorSpace.hpp"
00007 #include "Thyra_DefaultLinearOpSource.hpp"
00008 #include "Thyra_MultiVectorStdOps.hpp"
00009 #include "Thyra_LinearOpTester.hpp"
00010 #include "Thyra_LinearOpWithSolveTester.hpp"
00011 
00012 #include "OperatorSolveHelpers.hpp"
00013 
00014 #include "Teuchos_UnitTestHarness.hpp"
00015 #include "Thyra_UnitTestHelpers.hpp"
00016 
00017 
00018 namespace Thyra {
00019 
00020 
00021 //
00022 // Helper code and declarations
00023 //
00024 
00025 
00026 using Teuchos::as;
00027 using Teuchos::null;
00028 using Teuchos::RCP;
00029 using Teuchos::inOutArg;
00030 
00031 
00032 //
00033 // Unit Tests
00034 //
00035 
00036 
00037 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( DefaultMultiVectorLinearOpWithSolve, defaultConstruct,
00038   Scalar )
00039 {
00040   const RCP<DefaultMultiVectorLinearOpWithSolve<Scalar> > dmvlows =
00041     multiVectorLinearOpWithSolve<Scalar>();
00042   TEST_ASSERT(nonnull(dmvlows));
00043   TEST_EQUALITY_CONST(dmvlows->range(), null);
00044   TEST_EQUALITY_CONST(dmvlows->domain(), null);
00045   out << "dmvlows = " << *dmvlows;
00046 }
00047 THYRA_UNIT_TEST_TEMPLATE_1_INSTANT_SCALAR_TYPES( DefaultMultiVectorLinearOpWithSolve,
00048   defaultConstruct )
00049 
00050 
00051 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( DefaultMultiVectorLinearOpWithSolve, basic,
00052   Scalar )
00053 {
00054   typedef Teuchos::ScalarTraits<Scalar> ST;
00055 
00056   const Ordinal dim = 4;
00057   const int numBlocks = 3;
00058 
00059   const RCP<const VectorSpaceBase<Scalar> > vs =
00060     defaultSpmdVectorSpace<Scalar>(dim);
00061 
00062   const RCP<const MultiVectorBase<Scalar> > M =
00063     createNonsingularMultiVector(vs);
00064 
00065   const RCP<const LinearOpWithSolveFactoryBase<Scalar> > lowsf = 
00066     defaultSerialDenseLinearOpWithSolveFactory<Scalar>();
00067 
00068   const RCP<LinearOpWithSolveBase<Scalar> > Minv = 
00069     linearOpWithSolve<Scalar>(*lowsf, M);
00070       
00071   const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > dmvpvs =
00072     multiVectorProductVectorSpace<Scalar>(vs, numBlocks);
00073 
00074   const RCP<DefaultMultiVectorLinearOpWithSolve<Scalar> > dmvlows =
00075     multiVectorLinearOpWithSolve<Scalar>(Minv, dmvpvs, dmvpvs);
00076 
00077   TEST_ASSERT(nonnull(dmvlows));
00078   TEST_EQUALITY(dmvlows->range(), dmvpvs);
00079   TEST_EQUALITY(dmvlows->domain(), dmvpvs);
00080   out << "dmvlows = " << *dmvlows;
00081 
00082   Thyra::LinearOpTester<Scalar> linearOpTester;
00083   const bool checkOpResult = linearOpTester.check(*dmvlows, inOutArg(out));
00084   TEST_ASSERT(checkOpResult);
00085 
00086   Thyra::LinearOpWithSolveTester<Scalar> linearOpWithSolveTester;
00087   const bool checkSolveResult = linearOpWithSolveTester.check(*dmvlows, &out);
00088   TEST_ASSERT(checkSolveResult);
00089 
00090 }
00091 THYRA_UNIT_TEST_TEMPLATE_1_INSTANT_SCALAR_TYPES( DefaultMultiVectorLinearOpWithSolve,
00092   basic )
00093 
00094 
00095 } // namespace Thyra
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines