Thyra Package Browser (Single Doxygen Collection) Version of the Day
DefaultMultiVectorProductVectorSpace_UnitTests.cpp
Go to the documentation of this file.
00001 
00002 #include "Thyra_DefaultMultiVectorProductVectorSpace.hpp"
00003 #include "Thyra_DefaultSpmdVectorSpace.hpp"
00004 #include "Thyra_VectorSpaceTester.hpp"
00005 #include "Teuchos_DefaultComm.hpp"
00006 
00007 #include "Teuchos_UnitTestHarness.hpp"
00008 #include "Thyra_UnitTestHelpers.hpp"
00009 
00010 
00011 namespace Thyra {
00012 
00013 
00014 //
00015 // Helper code and declarations
00016 //
00017 
00018 
00019 using Teuchos::as;
00020 using Teuchos::null;
00021 using Teuchos::RCP;
00022 
00023 
00024 const int g_localDim = 4; // ToDo: Make variable!
00025 
00026 
00027 template<class Scalar>
00028 RCP<VectorSpaceBase<Scalar> > 
00029 createSpmdVectorSpace(const Teuchos_Ordinal localDim)
00030 {
00031   return defaultSpmdVectorSpace<Scalar>(
00032     Teuchos::DefaultComm<Teuchos_Ordinal>::getComm(),
00033     localDim, -1 );
00034 }
00035 
00036 
00037 //
00038 // Unit Tests
00039 //
00040 
00041 
00042 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( DefaultMultiVectorProductVectorSpace, defaultConstruct,
00043   Scalar )
00044 {
00045 
00046   RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > vs =
00047     multiVectorProductVectorSpace<Scalar>();
00048   TEST_EQUALITY(vs->dim(), as<Ordinal>(-1));
00049   out << "vs = " << *vs;
00050 }
00051 THYRA_UNIT_TEST_TEMPLATE_1_INSTANT_SCALAR_TYPES( DefaultMultiVectorProductVectorSpace,
00052   defaultConstruct )
00053 
00054 
00055 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( DefaultMultiVectorProductVectorSpace, standard,
00056   Scalar )
00057 {
00058 
00059   const Ordinal numCols = 3;
00060   RCP<const VectorSpaceBase<Scalar> > spmdVs =
00061     createSpmdVectorSpace<Scalar>(g_localDim);
00062   RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > vs =
00063     multiVectorProductVectorSpace<Scalar>(spmdVs, numCols);
00064   TEST_EQUALITY(vs->dim(), (numCols * spmdVs->dim()));
00065   out << "vs = " << *vs;
00066   VectorSpaceTester<Scalar> vsTester;
00067   TEST_ASSERT(vsTester.check(*vs, &out));
00068 }
00069 THYRA_UNIT_TEST_TEMPLATE_1_INSTANT_SCALAR_TYPES( DefaultMultiVectorProductVectorSpace,
00070   standard )
00071 
00072 
00073 } // namespace Thyra
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines