PlayaSerialVectorSpace.cpp

00001 /* @HEADER@ */
00002 //
00003  /* @HEADER@ */
00004 
00005 #include "PlayaSerialVectorSpace.hpp"
00006 #include "PlayaSerialVector.hpp"
00007 #include "PlayaMPIComm.hpp"
00008 #include "PlayaOut.hpp"
00009 
00010 #ifndef HAVE_TEUCHOS_EXPLICIT_INSTANTIATION
00011 #include "PlayaVectorSpaceImpl.hpp"
00012 #endif
00013 
00014 
00015 
00016 
00017 namespace Playa
00018 {
00019 using Teuchos::RCP;
00020 
00021 
00022 SerialVectorSpace::SerialVectorSpace(int dim)
00023   : dim_(dim), comm_(MPIComm::self())
00024 {}
00025 
00026 
00027 // Overridden from VectorSpaceBase
00028 
00029 RCP<VectorBase<double> >
00030 SerialVectorSpace::createMember(const VectorSpace<double>& self) const
00031 {
00032   TEUCHOS_TEST_FOR_EXCEPTION(self.ptr().get() != this,
00033     InternalError, 
00034     "inconsistency between space and self-reference in SerialVectorSpace::createMember()");
00035 
00036   return rcp(new SerialVector(self));
00037 }
00038 
00039 bool SerialVectorSpace::isCompatible(const VectorSpaceBase<double>* other) const
00040 {
00041   const SerialVectorSpace* svs = dynamic_cast<const SerialVectorSpace*>(other);
00042   if (svs == 0) return false;
00043   return this->dim() == svs->dim();
00044 }
00045 
00046 string SerialVectorSpace::description() const
00047 {
00048   std::string rtn = "SerialVS[d=" + Teuchos::toString(this->dim()) + "]";
00049   return rtn;
00050 }
00051 
00052 }
00053 
00054 

doxygen