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