Thyra Package Browser (Single Doxygen Collection) Version of the Day
EpetraThyraWrappers_UnitTests.cpp
Go to the documentation of this file.
00001 #include "Thyra_EpetraThyraWrappers.hpp"
00002 #include "Thyra_DefaultProductVectorSpace.hpp"
00003 #include "Thyra_VectorStdOps.hpp"
00004 #include "Thyra_MultiVectorStdOps.hpp"
00005 #include "Thyra_TestingTools.hpp"
00006 #include "EpetraThyraAdaptersTestHelpers.hpp"
00007 
00008 #include "Teuchos_UnitTestHarness.hpp"
00009 
00010 
00011 namespace {
00012 
00013 
00014 //
00015 // Unit Tests
00016 //
00017 
00018 
00019 TEUCHOS_UNIT_TEST( get_Epetra_MultiVector, singleBlockProductVector )
00020 {
00021   using Teuchos::Comm;
00022   typedef Teuchos_Ordinal Ordinal;
00023   using Thyra::VectorSpaceBase;
00024   using Thyra::MultiVectorBase;
00025 
00026   const RCP<const Epetra_Comm> epetra_comm = getEpetraComm();
00027   const RCP<const Comm<Ordinal> > comm = Thyra::create_Comm(epetra_comm);
00028   
00029   const RCP<const Epetra_Map> epetra_map = rcp(new Epetra_Map(g_localDim, 0, *epetra_comm));
00030   const RCP<const VectorSpaceBase<double> > vs =  Thyra::create_VectorSpace(epetra_map);
00031 
00032   const RCP<const VectorSpaceBase<double> > pvs = Thyra::productVectorSpace(vs, 1);
00033 
00034   const RCP<MultiVectorBase<double> > pmv = Thyra::createMembers(pvs, 1);
00035 
00036   const double alpha = 3.5;
00037   Thyra::assign<double>( pmv.ptr(), alpha );
00038 
00039   const RCP<Epetra_MultiVector> epetra_mv =
00040     Thyra::get_Epetra_MultiVector(*epetra_map, pmv);
00041 
00042   const RCP<MultiVectorBase<double> > mv2 =
00043     Thyra::create_MultiVector(epetra_mv, pvs);
00044 
00045   Thyra::testRelNormDiffErr<double>(
00046     "*pmv->col(0)", *pmv->col(0),
00047     "*mv2->col(0)", *mv2->col(0),
00048     "max-error", 0.0,
00049     "max-warning", 0.0,
00050     &out
00051     );
00052    
00053 }
00054 
00055 
00056 } // namespace
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines