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 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00038 // 
00039 // ***********************************************************************
00040 // @HEADER
00041 
00042 #ifndef THYRA_VECTOR_SPACE_BASE_DECL_HPP
00043 #define THYRA_VECTOR_SPACE_BASE_DECL_HPP
00044 
00045 #include "Thyra_OperatorVectorTypes.hpp"
00046 #include "Teuchos_Describable.hpp"
00047 
00048 
00049 namespace Thyra {
00050 
00051 
00057 template<class Scalar>
00058 RCP<const VectorSpaceBase<Scalar> >
00059 makeHaveOwnership( const RCP<const VectorSpaceBase<Scalar> > &vs );
00060 
00061 
00069 template<class Scalar>
00070 RCP< VectorBase<Scalar> >
00071 createMember(
00072   const RCP<const VectorSpaceBase<Scalar> > &vs,
00073   const std::string &label=""
00074   );
00075 
00076 
00081 template<class Scalar>
00082 RCP< VectorBase<Scalar> >
00083 createMember( const VectorSpaceBase<Scalar> &vs, const std::string &label="" );
00084 
00085 
00093 template<class Scalar>
00094 RCP< MultiVectorBase<Scalar> >
00095 createMembers(
00096   const RCP<const VectorSpaceBase<Scalar> > &vs, int numMembers,
00097   const std::string &label=""
00098   );
00099 
00100 
00108 template<class Scalar>
00109 RCP< MultiVectorBase<Scalar> >
00110 createMembers(
00111   const RCP<const VectorSpaceBase<Scalar> > &vs,
00112   const RCP<const VectorSpaceBase<Scalar> > &domain,
00113   const std::string &label=""
00114   );
00115 
00116 
00121 template<class Scalar>
00122 RCP< MultiVectorBase<Scalar> >
00123 createMembers(
00124   const VectorSpaceBase<Scalar> &vs, int numMembers,
00125   const std::string &label=""
00126   );
00127 
00128 
00136 template<class Scalar>
00137 RCP<VectorBase<Scalar> >
00138 createMemberView(
00139   const RCP<const VectorSpaceBase<Scalar> > &vs,
00140   const RTOpPack::SubVectorView<Scalar> &raw_v,
00141   const std::string &label=""
00142   );
00143 
00144 
00149 template<class Scalar>
00150 RCP<VectorBase<Scalar> >
00151 createMemberView(
00152   const VectorSpaceBase<Scalar> &vs,
00153   const RTOpPack::SubVectorView<Scalar> &raw_v,
00154   const std::string &label=""
00155   );
00156 
00157 
00165 template<class Scalar>
00166 RCP<const VectorBase<Scalar> >
00167 createMemberView(
00168   const RCP<const VectorSpaceBase<Scalar> > &vs,
00169   const RTOpPack::ConstSubVectorView<Scalar> &raw_v,
00170   const std::string &label=""
00171   );
00172 
00173 
00178 template<class Scalar>
00179 RCP<const VectorBase<Scalar> >
00180 createMemberView(
00181   const VectorSpaceBase<Scalar> &vs,
00182   const RTOpPack::ConstSubVectorView<Scalar> &raw_v,
00183   const std::string &label=""
00184   );
00185 
00186 
00194 template<class Scalar>
00195 RCP<MultiVectorBase<Scalar> >
00196 createMembersView(
00197   const RCP<const VectorSpaceBase<Scalar> > &vs,
00198   const RTOpPack::SubMultiVectorView<Scalar> &raw_mv,
00199   const std::string &label=""
00200   );
00201 
00202 
00207 template<class Scalar>
00208 RCP<MultiVectorBase<Scalar> >
00209 createMembersView(
00210   const VectorSpaceBase<Scalar> &vs,
00211   const RTOpPack::SubMultiVectorView<Scalar> &raw_mv,
00212   const std::string &label=""
00213   );
00214 
00215 
00223 template<class Scalar>
00224 RCP<const MultiVectorBase<Scalar> >
00225 createMembersView(
00226   const RCP<const VectorSpaceBase<Scalar> > &vs,
00227   const RTOpPack::ConstSubMultiVectorView<Scalar> &raw_mv,
00228   const std::string &label=""
00229   );
00230 
00231 
00236 template<class Scalar>
00237 RCP<const MultiVectorBase<Scalar> >
00238 createMembersView(
00239   const VectorSpaceBase<Scalar> &vs,
00240   const RTOpPack::ConstSubMultiVectorView<Scalar> &raw_mv,
00241   const std::string &label=""
00242   );
00243 
00244 
00298 template<class Scalar>
00299 class VectorSpaceBase : virtual public Teuchos::Describable {
00300 public:
00301 
00304 
00310   virtual Ordinal dim() const = 0;
00311 
00335   virtual bool isCompatible( const VectorSpaceBase<Scalar>& vecSpc ) const = 0;
00336 
00344   virtual RCP< const VectorSpaceFactoryBase<Scalar> > smallVecSpcFcty() const = 0;
00345 
00358   virtual Scalar scalarProd(
00359     const VectorBase<Scalar>& x, const VectorBase<Scalar>& y
00360     ) const = 0;
00361 
00387   void scalarProds(
00388     const MultiVectorBase<Scalar>& X, const MultiVectorBase<Scalar>& Y,
00389     const ArrayView<Scalar> &scalarProds_out
00390     ) const
00391     {
00392       scalarProdsImpl(X, Y, scalarProds_out);
00393     }
00394 
00396 
00399 
00406   virtual bool isEuclidean() const;
00407 
00452   virtual bool hasInCoreView(
00453     const Range1D &rng = Range1D(),
00454     const EViewType viewType = VIEW_TYPE_DETACHED,
00455     const EStrideType strideType = STRIDE_TYPE_NONUNIT
00456     ) const;
00457 
00469   virtual RCP< const VectorSpaceBase<Scalar> > clone() const;
00470 
00472 
00473 #ifndef DOXYGEN_COMPILE
00474 
00475 #ifndef TEMPLATE_FRIENDS_NOT_SUPPORTED
00476 
00479 
00480   friend RCP< VectorBase<Scalar> >
00481   createMember<>( 
00482     const RCP<const VectorSpaceBase<Scalar> > &vs,
00483     const std::string &label
00484     );
00485 
00486   friend RCP< MultiVectorBase<Scalar> >
00487   createMembers<>(
00488     const RCP<const VectorSpaceBase<Scalar> > &vs,
00489     int numMembers, const std::string &label
00490     );
00491 
00492   friend RCP<VectorBase<Scalar> >
00493   createMemberView<>(
00494     const RCP<const VectorSpaceBase<Scalar> > &vs,
00495     const RTOpPack::SubVectorView<Scalar> &raw_v,
00496     const std::string &label
00497     );
00498 
00499   friend RCP<const VectorBase<Scalar> >
00500   createMemberView<>(
00501     const RCP<const VectorSpaceBase<Scalar> > &vs,
00502     const RTOpPack::ConstSubVectorView<Scalar> &raw_v,
00503     const std::string &label
00504     );
00505 
00506   friend RCP<MultiVectorBase<Scalar> >
00507   createMembersView<>(
00508     const RCP<const VectorSpaceBase<Scalar> > &vs,
00509     const RTOpPack::SubMultiVectorView<Scalar> &raw_mv,
00510     const std::string &label
00511     );
00512 
00513   friend RCP<const MultiVectorBase<Scalar> >
00514   createMembersView<>(
00515     const RCP<const VectorSpaceBase<Scalar> > &vs,
00516     const RTOpPack::ConstSubMultiVectorView<Scalar> &raw_mv,
00517     const std::string &label
00518     );
00519 
00521 
00522 #endif // DOXYGEN_COMPILE
00523 
00524 #endif // TEMPLATE_FRIENDS_NOT_SUPPORTED
00525 
00526 #ifndef TEMPLATE_FRIENDS_NOT_SUPPORTED
00527 protected:
00528 #endif
00529 
00532 
00558   virtual RCP< VectorBase<Scalar> > createMember() const = 0;
00559 
00586   virtual RCP< MultiVectorBase<Scalar> >
00587   createMembers(int numMembers) const = 0;
00588 
00620   virtual RCP<VectorBase<Scalar> >
00621   createMemberView( const RTOpPack::SubVectorView<Scalar> &raw_v ) const = 0;
00622 
00644   virtual RCP<const VectorBase<Scalar> >
00645   createMemberView( const RTOpPack::ConstSubVectorView<Scalar> &raw_v ) const = 0;
00646 
00678   virtual RCP<MultiVectorBase<Scalar> >
00679   createMembersView( const RTOpPack::SubMultiVectorView<Scalar> &raw_mv ) const = 0;
00680 
00708   virtual RCP<const MultiVectorBase<Scalar> >
00709   createMembersView(
00710     const RTOpPack::ConstSubMultiVectorView<Scalar> &raw_mv ) const = 0;
00711 
00713 
00714 protected:
00715 
00719   virtual void scalarProdsImpl(
00720     const MultiVectorBase<Scalar>& X, const MultiVectorBase<Scalar>& Y,
00721     const ArrayView<Scalar> &scalarProds
00722     ) const = 0;
00723 
00724 public:
00725 
00728 
00730   void scalarProds(
00731     const MultiVectorBase<Scalar>& X, const MultiVectorBase<Scalar>& Y,
00732     Scalar scalarProds[]
00733     ) const;
00734 
00736 
00737 private:
00738   
00739   // Not defined and not to be called
00740   VectorSpaceBase<Scalar>&
00741   operator=(const VectorSpaceBase<Scalar>&);
00742 
00743 };
00744 
00745 
00746 } // end namespace Thyra
00747 
00748 
00749 #endif  // THYRA_VECTOR_SPACE_BASE_DECL_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines