Thyra Version of the Day
Thyra_VectorSpaceBase_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 #ifndef THYRA_VECTOR_SPACE_BASE_DECL_HPP
00030 #define THYRA_VECTOR_SPACE_BASE_DECL_HPP
00031 
00032 #include "Thyra_OperatorVectorTypes.hpp"
00033 #include "Teuchos_Describable.hpp"
00034 
00035 
00036 namespace Thyra {
00037 
00038 
00044 template<class Scalar>
00045 RCP<const VectorSpaceBase<Scalar> >
00046 makeHaveOwnership( const RCP<const VectorSpaceBase<Scalar> > &vs );
00047 
00048 
00056 template<class Scalar>
00057 RCP< VectorBase<Scalar> >
00058 createMember(
00059   const RCP<const VectorSpaceBase<Scalar> > &vs,
00060   const std::string &label=""
00061   );
00062 
00063 
00068 template<class Scalar>
00069 RCP< VectorBase<Scalar> >
00070 createMember( const VectorSpaceBase<Scalar> &vs, const std::string &label="" );
00071 
00072 
00080 template<class Scalar>
00081 RCP< MultiVectorBase<Scalar> >
00082 createMembers(
00083   const RCP<const VectorSpaceBase<Scalar> > &vs, int numMembers,
00084   const std::string &label=""
00085   );
00086 
00087 
00095 template<class Scalar>
00096 RCP< MultiVectorBase<Scalar> >
00097 createMembers(
00098   const RCP<const VectorSpaceBase<Scalar> > &vs,
00099   const RCP<const VectorSpaceBase<Scalar> > &domain,
00100   const std::string &label=""
00101   );
00102 
00103 
00108 template<class Scalar>
00109 RCP< MultiVectorBase<Scalar> >
00110 createMembers(
00111   const VectorSpaceBase<Scalar> &vs, int numMembers,
00112   const std::string &label=""
00113   );
00114 
00115 
00123 template<class Scalar>
00124 RCP<VectorBase<Scalar> >
00125 createMemberView(
00126   const RCP<const VectorSpaceBase<Scalar> > &vs,
00127   const RTOpPack::SubVectorView<Scalar> &raw_v,
00128   const std::string &label=""
00129   );
00130 
00131 
00136 template<class Scalar>
00137 RCP<VectorBase<Scalar> >
00138 createMemberView(
00139   const VectorSpaceBase<Scalar> &vs,
00140   const RTOpPack::SubVectorView<Scalar> &raw_v,
00141   const std::string &label=""
00142   );
00143 
00144 
00152 template<class Scalar>
00153 RCP<const VectorBase<Scalar> >
00154 createMemberView(
00155   const RCP<const VectorSpaceBase<Scalar> > &vs,
00156   const RTOpPack::ConstSubVectorView<Scalar> &raw_v,
00157   const std::string &label=""
00158   );
00159 
00160 
00165 template<class Scalar>
00166 RCP<const VectorBase<Scalar> >
00167 createMemberView(
00168   const VectorSpaceBase<Scalar> &vs,
00169   const RTOpPack::ConstSubVectorView<Scalar> &raw_v,
00170   const std::string &label=""
00171   );
00172 
00173 
00181 template<class Scalar>
00182 RCP<MultiVectorBase<Scalar> >
00183 createMembersView(
00184   const RCP<const VectorSpaceBase<Scalar> > &vs,
00185   const RTOpPack::SubMultiVectorView<Scalar> &raw_mv,
00186   const std::string &label=""
00187   );
00188 
00189 
00194 template<class Scalar>
00195 RCP<MultiVectorBase<Scalar> >
00196 createMembersView(
00197   const VectorSpaceBase<Scalar> &vs,
00198   const RTOpPack::SubMultiVectorView<Scalar> &raw_mv,
00199   const std::string &label=""
00200   );
00201 
00202 
00210 template<class Scalar>
00211 RCP<const MultiVectorBase<Scalar> >
00212 createMembersView(
00213   const RCP<const VectorSpaceBase<Scalar> > &vs,
00214   const RTOpPack::ConstSubMultiVectorView<Scalar> &raw_mv,
00215   const std::string &label=""
00216   );
00217 
00218 
00223 template<class Scalar>
00224 RCP<const MultiVectorBase<Scalar> >
00225 createMembersView(
00226   const VectorSpaceBase<Scalar> &vs,
00227   const RTOpPack::ConstSubMultiVectorView<Scalar> &raw_mv,
00228   const std::string &label=""
00229   );
00230 
00231 
00285 template<class Scalar>
00286 class VectorSpaceBase : virtual public Teuchos::Describable {
00287 public:
00288 
00291 
00297   virtual Ordinal dim() const = 0;
00298 
00322   virtual bool isCompatible( const VectorSpaceBase<Scalar>& vecSpc ) const = 0;
00323 
00331   virtual RCP< const VectorSpaceFactoryBase<Scalar> > smallVecSpcFcty() const = 0;
00332 
00345   virtual Scalar scalarProd(
00346     const VectorBase<Scalar>& x, const VectorBase<Scalar>& y
00347     ) const = 0;
00348 
00374   void scalarProds(
00375     const MultiVectorBase<Scalar>& X, const MultiVectorBase<Scalar>& Y,
00376     const ArrayView<Scalar> &scalarProds_out
00377     ) const
00378     {
00379       scalarProdsImpl(X, Y, scalarProds_out);
00380     }
00381 
00383 
00386 
00393   virtual bool isEuclidean() const;
00394 
00439   virtual bool hasInCoreView(
00440     const Range1D &rng = Range1D(),
00441     const EViewType viewType = VIEW_TYPE_DETACHED,
00442     const EStrideType strideType = STRIDE_TYPE_NONUNIT
00443     ) const;
00444 
00456   virtual RCP< const VectorSpaceBase<Scalar> > clone() const;
00457 
00459 
00460 #ifndef DOXYGEN_COMPILE
00461 
00462 #ifndef TEMPLATE_FRIENDS_NOT_SUPPORTED
00463 
00466 
00467   friend RCP< VectorBase<Scalar> >
00468   createMember<>( 
00469     const RCP<const VectorSpaceBase<Scalar> > &vs,
00470     const std::string &label
00471     );
00472 
00473   friend RCP< MultiVectorBase<Scalar> >
00474   createMembers<>(
00475     const RCP<const VectorSpaceBase<Scalar> > &vs,
00476     int numMembers, const std::string &label
00477     );
00478 
00479   friend RCP<VectorBase<Scalar> >
00480   createMemberView<>(
00481     const RCP<const VectorSpaceBase<Scalar> > &vs,
00482     const RTOpPack::SubVectorView<Scalar> &raw_v,
00483     const std::string &label
00484     );
00485 
00486   friend RCP<const VectorBase<Scalar> >
00487   createMemberView<>(
00488     const RCP<const VectorSpaceBase<Scalar> > &vs,
00489     const RTOpPack::ConstSubVectorView<Scalar> &raw_v,
00490     const std::string &label
00491     );
00492 
00493   friend RCP<MultiVectorBase<Scalar> >
00494   createMembersView<>(
00495     const RCP<const VectorSpaceBase<Scalar> > &vs,
00496     const RTOpPack::SubMultiVectorView<Scalar> &raw_mv,
00497     const std::string &label
00498     );
00499 
00500   friend RCP<const MultiVectorBase<Scalar> >
00501   createMembersView<>(
00502     const RCP<const VectorSpaceBase<Scalar> > &vs,
00503     const RTOpPack::ConstSubMultiVectorView<Scalar> &raw_mv,
00504     const std::string &label
00505     );
00506 
00508 
00509 #endif // DOXYGEN_COMPILE
00510 
00511 #endif // TEMPLATE_FRIENDS_NOT_SUPPORTED
00512 
00513 #ifndef TEMPLATE_FRIENDS_NOT_SUPPORTED
00514 protected:
00515 #endif
00516 
00519 
00545   virtual RCP< VectorBase<Scalar> > createMember() const = 0;
00546 
00573   virtual RCP< MultiVectorBase<Scalar> >
00574   createMembers(int numMembers) const = 0;
00575 
00607   virtual RCP<VectorBase<Scalar> >
00608   createMemberView( const RTOpPack::SubVectorView<Scalar> &raw_v ) const = 0;
00609 
00631   virtual RCP<const VectorBase<Scalar> >
00632   createMemberView( const RTOpPack::ConstSubVectorView<Scalar> &raw_v ) const = 0;
00633 
00665   virtual RCP<MultiVectorBase<Scalar> >
00666   createMembersView( const RTOpPack::SubMultiVectorView<Scalar> &raw_mv ) const = 0;
00667 
00695   virtual RCP<const MultiVectorBase<Scalar> >
00696   createMembersView(
00697     const RTOpPack::ConstSubMultiVectorView<Scalar> &raw_mv ) const = 0;
00698 
00700 
00701 protected:
00702 
00706   virtual void scalarProdsImpl(
00707     const MultiVectorBase<Scalar>& X, const MultiVectorBase<Scalar>& Y,
00708     const ArrayView<Scalar> &scalarProds
00709     ) const = 0;
00710 
00711 public:
00712 
00715 
00717   void scalarProds(
00718     const MultiVectorBase<Scalar>& X, const MultiVectorBase<Scalar>& Y,
00719     Scalar scalarProds[]
00720     ) const;
00721 
00723 
00724 private:
00725   
00726   // Not defined and not to be called
00727   VectorSpaceBase<Scalar>&
00728   operator=(const VectorSpaceBase<Scalar>&);
00729 
00730 };
00731 
00732 
00733 } // end namespace Thyra
00734 
00735 
00736 #endif  // THYRA_VECTOR_SPACE_BASE_DECL_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines