Thyra_DefaultClusteredSpmdProductVectorSpaceDecl.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 #ifndef THYRA_DEFAULT_CLUSTERED_SPMD_PRODUCT_VECTOR_SPACE_DECL_HPP
00030 #define THYRA_DEFAULT_CLUSTERED_SPMD_PRODUCT_VECTOR_SPACE_DECL_HPP
00031 
00032 #include "Thyra_VectorSpaceBaseDecl.hpp"
00033 #include "Thyra_ProductVectorSpaceBase.hpp"
00034 #include "Thyra_VectorSpaceDefaultBaseDecl.hpp"
00035 
00036 namespace Thyra {
00037 
00068 template<class Scalar>
00069 class DefaultClusteredSpmdProductVectorSpace
00070   : public ProductVectorSpaceBase<Scalar>
00071   , protected VectorSpaceDefaultBase<Scalar>
00072 {
00073 public:
00074 
00077 
00079   DefaultClusteredSpmdProductVectorSpace();
00080 
00082   DefaultClusteredSpmdProductVectorSpace(
00083     const Teuchos::RefCountPtr<const Teuchos::Comm<Index> >          &intraClusterComm
00084     ,const int                                                       clusterRootRank
00085     ,const Teuchos::RefCountPtr<const Teuchos::Comm<Index> >         &interClusterComm
00086     ,const int                                                       numBlocks
00087     ,const Teuchos::RefCountPtr<const VectorSpaceBase<Scalar> >      vecSpaces[]
00088     );
00089 
00110   void initialize(
00111     const Teuchos::RefCountPtr<const Teuchos::Comm<Index> >          &intraClusterComm
00112     ,const int                                                       clusterRootRank
00113     ,const Teuchos::RefCountPtr<const Teuchos::Comm<Index> >         &interClusterComm
00114     ,const int                                                       numBlocks
00115     ,const Teuchos::RefCountPtr<const VectorSpaceBase<Scalar> >      vecSpaces[]
00116     );
00117 
00119   Teuchos::RefCountPtr<const Teuchos::Comm<Index> > intraClusterComm() const;
00120 
00122   int clusterRootRank() const;
00123 
00125   Teuchos::RefCountPtr<const Teuchos::Comm<Index> > interClusterComm() const;
00126 
00130   int clusterSubDim() const;
00131 
00135   int clusterOffset() const;
00136   
00138   
00142   std::string description() const;
00144 
00148   Index dim() const;
00150   bool isCompatible(const VectorSpaceBase<Scalar>& vecSpc) const;
00152   Teuchos::RefCountPtr< const VectorSpaceFactoryBase<Scalar> > smallVecSpcFcty() const;
00154   Scalar scalarProd( const VectorBase<Scalar>& x, const VectorBase<Scalar>& y ) const;
00156   void scalarProds(
00157     const MultiVectorBase<Scalar>& X, const MultiVectorBase<Scalar>& Y, Scalar scalar_prods[]
00158     ) const;
00160   bool isEuclidean() const;
00162   bool hasInCoreView(
00163     const Range1D& rng, const EViewType viewType, const EStrideType strideType
00164     ) const;
00166   Teuchos::RefCountPtr< const VectorSpaceBase<Scalar> > clone() const;
00168 
00171 
00173   int numBlocks() const;
00175   Teuchos::RefCountPtr<const VectorSpaceBase<Scalar> > getBlock(const int k) const; 
00176 
00178 
00179 protected:
00180 
00183 
00185   Teuchos::RefCountPtr<VectorBase<Scalar> > createMember() const;
00187   Teuchos::RefCountPtr<MultiVectorBase<Scalar> > createMembers(int numMembers) const;
00188 
00190 
00191 private:
00192 
00193   // //////////////////////////////////////
00194   // Private types
00195 
00196   typedef std::vector<Teuchos::RefCountPtr<const VectorSpaceBase<Scalar> > >  vecSpaces_t;
00197 
00198   // //////////////////////////////////////
00199   // Private data members
00200 
00201   Teuchos::RefCountPtr<const Teuchos::Comm<Index> >  intraClusterComm_;
00202   int                                                      clusterRootRank_;
00203   Teuchos::RefCountPtr<const Teuchos::Comm<Index> >  interClusterComm_;
00204   vecSpaces_t vecSpaces_; // size == numBlocks
00205   bool isEuclidean_;
00206   Index globalDim_;     // The global dimension of all of the block vectors in
00207                         // all of the clusters.
00208   Index clusterSubDim_; // The some of the dimensions of the block vector
00209                         // spaces in this cluster
00210   Index clusterOffset_; // The offset of the first element in the first
00211                         // constituent vector in this cluster in the
00212                         // w.r.t. the global vector.
00213   
00214 };
00215 
00216 // ///////////////////////////
00217 // Inline defintions
00218 
00219 template<class Scalar>
00220 Teuchos::RefCountPtr<const Teuchos::Comm<Index> >
00221 DefaultClusteredSpmdProductVectorSpace<Scalar>::intraClusterComm() const
00222 {
00223   return intraClusterComm_;
00224 }
00225 
00226 template<class Scalar>
00227 int DefaultClusteredSpmdProductVectorSpace<Scalar>::clusterRootRank() const
00228 {
00229   return clusterRootRank_;
00230 }
00231 
00232 template<class Scalar>
00233 Teuchos::RefCountPtr<const Teuchos::Comm<Index> >
00234 DefaultClusteredSpmdProductVectorSpace<Scalar>::interClusterComm() const
00235 {
00236   return interClusterComm_;
00237 }
00238 
00239 template<class Scalar>
00240 int DefaultClusteredSpmdProductVectorSpace<Scalar>::clusterSubDim() const
00241 {
00242   return clusterSubDim_;
00243 }
00244 
00245 template<class Scalar>
00246 int DefaultClusteredSpmdProductVectorSpace<Scalar>::clusterOffset() const
00247 {
00248   return clusterOffset_;
00249 }
00250 
00251 } // end namespace Thyra
00252 
00253 #endif // THYRA_DEFAULT_CLUSTERED_SPMD_PRODUCT_VECTOR_SPACE_DECL_HPP

Generated on Thu Sep 18 12:32:31 2008 for Thyra Operator/Vector Support by doxygen 1.3.9.1