Thyra_DefaultSpmdVectorSpace_decl.hpp

00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 //    Thyra: Interfaces and Support for Abstract Numerical Algorithms
00005 //                 Copyright (2004) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
00028 
00029 
00030 #ifndef THYRA_DEFAULT_SPMD_VECTOR_SPACE_DECL_HPP
00031 #define THYRA_DEFAULT_SPMD_VECTOR_SPACE_DECL_HPP
00032 
00033 
00034 #include "Thyra_SpmdVectorSpaceDefaultBase_decl.hpp"
00035 #include "Thyra_ProductVectorSpaceBase.hpp"
00036 #include "Teuchos_Handleable.hpp"
00037 
00038 
00039 namespace Thyra {
00040 
00041 
00056 template<class Scalar>
00057 class DefaultSpmdVectorSpace
00058   : public SpmdVectorSpaceDefaultBase<Scalar>,
00059     public Teuchos::Handleable<VectorSpaceBase<Scalar> >
00060 {
00061 public:
00062   /* handleable interface */
00063   TEUCHOS_GET_RCP(VectorSpaceBase<Scalar>);
00064 
00067 
00069   static RCP<DefaultSpmdVectorSpace<Scalar> > create();
00070 
00078   void initialize(
00079     const Ordinal dim
00080     );
00081 
00136   void initialize(
00137     const RCP<const Teuchos::Comm<Ordinal> > &comm,
00138     const Ordinal localSubDim, const Ordinal globalDim
00139     );
00140 
00149   void uninitialize();
00150 
00152 
00158   bool hasInCoreView(
00159     const Range1D& rng, const EViewType viewType, const EStrideType strideType
00160     ) const;
00162   RCP< const VectorSpaceBase<Scalar> > clone() const;
00164 
00165 protected:
00166 
00169 
00171   RCP<VectorBase<Scalar> >
00172   createMember() const;
00174   RCP<MultiVectorBase<Scalar> >
00175   createMembers(int numMembers) const;
00177   RCP<VectorBase<Scalar> >
00178   createMemberView( const RTOpPack::SubVectorView<Scalar> &raw_v ) const;
00180   RCP<const VectorBase<Scalar> >
00181   createMemberView( const RTOpPack::ConstSubVectorView<Scalar> &raw_v ) const;
00183   RCP<MultiVectorBase<Scalar> >
00184   createMembersView( const RTOpPack::SubMultiVectorView<Scalar> &raw_mv ) const;
00186   RCP<const MultiVectorBase<Scalar> >
00187   createMembersView( const RTOpPack::ConstSubMultiVectorView<Scalar> &raw_mv ) const;
00188 
00190 
00191 public:
00192 
00195 
00197   RCP<const Teuchos::Comm<Ordinal> > getComm() const;
00199   Ordinal localSubDim() const;
00200 
00202 
00203 private:
00204 
00205   // //////////////////////////////////////
00206   // Private data members
00207 
00208   RCP<const Teuchos::Comm<Ordinal> > comm_;
00209   Ordinal localSubDim_;
00210   int numProc_;
00211   int procRank_;
00212   RCP<DefaultSpmdVectorSpace<Scalar> > weakSelfPtr_;
00213 
00214   // /////////////////////////////////////
00215   // Private member functions
00216  
00217   DefaultSpmdVectorSpace();
00218 
00219 public:
00220 
00223 
00225   DefaultSpmdVectorSpace(
00226     const Ordinal dim
00227     );
00228 
00230   DefaultSpmdVectorSpace(
00231     const RCP<const Teuchos::Comm<Ordinal> > &comm,
00232     const Ordinal localSubDim, const Ordinal globalDim
00233     );
00234 
00236  
00237 }; // end class DefaultSpmdVectorSpace
00238 
00239 
00244 template<class Scalar>
00245 RCP<DefaultSpmdVectorSpace<Scalar> >
00246 defaultSpmdVectorSpace()
00247 {
00248   return DefaultSpmdVectorSpace<Scalar>::create();
00249 }
00250 
00251 
00256 template<class Scalar>
00257 RCP<DefaultSpmdVectorSpace<Scalar> >
00258 defaultSpmdVectorSpace( const Ordinal dim )
00259 {
00260   RCP<DefaultSpmdVectorSpace<Scalar> > vs =
00261     DefaultSpmdVectorSpace<Scalar>::create();
00262   vs->initialize(dim);
00263   return vs;
00264 }
00265 
00266 
00272 template<class Scalar>
00273 RCP<DefaultSpmdVectorSpace<Scalar> >
00274 defaultSpmdVectorSpace(
00275   const RCP<const Teuchos::Comm<Ordinal> > &comm,
00276   const Ordinal localSubDim, const Ordinal globalDim
00277   )
00278 {
00279   RCP<DefaultSpmdVectorSpace<Scalar> > vs =
00280     DefaultSpmdVectorSpace<Scalar>::create();
00281   vs->initialize(comm, localSubDim, globalDim);
00282   return vs;
00283 }
00284 
00285 
00286 } // end namespace Thyra
00287 
00288 
00289 #endif // THYRA_DEFAULT_SPMD_VECTOR_SPACE_DECL_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Wed Apr 13 10:00:10 2011 for Thyra by  doxygen 1.6.3