PlayaSerialVectorType.cpp

00001 /* @HEADER@ */
00002 //
00003  /* @HEADER@ */
00004 
00005 
00006 #include "PlayaSerialVectorType.hpp"
00007 #include "PlayaSerialVectorSpace.hpp"
00008 #include "PlayaDenseSerialMatrixFactory.hpp"
00009 #include "PlayaSerialGhostImporter.hpp"
00010 #include "PlayaOut.hpp"
00011 
00012 #include "Teuchos_RefCountPtr.hpp"
00013 
00014 namespace Playa
00015 {
00016 
00017 using namespace Teuchos;
00018 
00019 SerialVectorType::SerialVectorType()
00020 {;}
00021 
00022 
00023 RCP<const VectorSpaceBase<double> > 
00024 SerialVectorType::createSpace(int dimension,
00025   int nLocal,
00026   const int* localIndices,
00027   const MPIComm& comm) const
00028 {
00029   TEUCHOS_TEST_FOR_EXCEPTION(nLocal < 0, std::runtime_error, "negative vector size n=" << nLocal);
00030   TEUCHOS_TEST_FOR_EXCEPTION(dimension != nLocal, std::runtime_error, 
00031     "nLocal=" << nLocal << " and dimension=" << dimension
00032     << " should be equal for a replicated space");
00033 
00034   return rcp(new SerialVectorSpace(dimension));
00035 }
00036 
00037 RCP<GhostImporter<double> > 
00038 SerialVectorType::createGhostImporter(const VectorSpace<double>& space,
00039                                       int nGhost,
00040                                       const int* ghostIndices) const
00041 {
00042   TEUCHOS_TEST_FOR_EXCEPTION(dynamic_cast<const SerialVectorSpace*>(space.ptr().get())==0, std::runtime_error, "expected " 
00043     << space << " to be a SerialVectorSpace");
00044   return rcp(new SerialGhostImporter());
00045 }
00046 
00047 RCP<MatrixFactory<double> >
00048 SerialVectorType::createMatrixFactory(const VectorSpace<double>& domain,
00049                                       const VectorSpace<double>& range) const
00050 {
00051   RCP<MatrixFactory<double> > rtn 
00052     = rcp(new DenseSerialMatrixFactory(domain, range));
00053 
00054   return rtn;
00055 }
00056 
00057 
00058 VectorSpace<double> SerialVectorType
00059 ::createEvenlyPartitionedSpace(const MPIComm& /* comm */,
00060   int nLocal) const
00061 {
00062   RCP<const VectorSpaceBase<double> > rtn = rcp(new SerialVectorSpace(nLocal));
00063   return rtn;
00064 }
00065 
00066 }
00067 
00068 
00069 
00070 

doxygen