Thyra_DefaultMultipliedLinearOpDecl.hpp

Go to the documentation of this file.
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_MULTIPLIED_LINEAR_OP_DECL_HPP
00030 #define THYRA_DEFAULT_MULTIPLIED_LINEAR_OP_DECL_HPP
00031 
00032 #include "Thyra_MultipliedLinearOpBase.hpp"
00033 #include "Thyra_SingleScalarLinearOpBase.hpp"
00034 #include "Teuchos_ConstNonconstObjectContainer.hpp"
00035 #include "Teuchos_arrayArg.hpp"
00036 #include "Teuchos_Handleable.hpp"
00037 
00038 namespace Thyra {
00039 
00107 template<class Scalar>
00108 class DefaultMultipliedLinearOp
00109   : virtual public MultipliedLinearOpBase<Scalar>        // Public interface
00110   , virtual protected SingleScalarLinearOpBase<Scalar>   // Implementation detail
00111   , virtual public Teuchos::Handleable<LinearOpBase<Scalar> >
00112 {
00113 public:
00114   /* */
00115   TEUCHOS_GET_RCP(LinearOpBase<Scalar>);
00116 
00118   using SingleScalarLinearOpBase<Scalar>::apply;
00119 
00122 
00129   DefaultMultipliedLinearOp();
00130 
00136   DefaultMultipliedLinearOp(
00137     const int                                                   numOps
00138     ,const Teuchos::RefCountPtr<LinearOpBase<Scalar> >          Ops[]
00139     );
00140 
00146   DefaultMultipliedLinearOp(
00147     const int                                                   numOps
00148     ,const Teuchos::RefCountPtr<const LinearOpBase<Scalar> >    Ops[]
00149     );
00150 
00170   void initialize(
00171     const int                                                   numOps
00172     ,const Teuchos::RefCountPtr<LinearOpBase<Scalar> >          Ops[]
00173     );
00174 
00194   void initialize(
00195     const int                                                   numOps
00196     ,const Teuchos::RefCountPtr<const LinearOpBase<Scalar> >    Ops[]
00197     );
00198 
00205   void uninitialize();
00206 
00208 
00211 
00213   int numOps() const;
00215   bool opIsConst(const int k) const;
00217   Teuchos::RefCountPtr<LinearOpBase<Scalar> > getNonconstOp(const int k);
00219   Teuchos::RefCountPtr<const LinearOpBase<Scalar> > getOp(const int k) const;
00220 
00222 
00225 
00229   Teuchos::RefCountPtr< const VectorSpaceBase<Scalar> > range() const;
00230 
00234   Teuchos::RefCountPtr< const VectorSpaceBase<Scalar> > domain() const;
00235 
00237   Teuchos::RefCountPtr<const LinearOpBase<Scalar> > clone() const;
00238 
00240 
00243                                                 
00247   std::string description() const;
00248 
00256   void describe(
00257     Teuchos::FancyOStream                &out
00258     ,const Teuchos::EVerbosityLevel      verbLevel
00259     ) const;
00260 
00262 
00263 protected:
00264 
00267 
00271   bool opSupported(ETransp M_trans) const;
00272 
00274   void apply(
00275     const ETransp                     M_trans
00276     ,const MultiVectorBase<Scalar>    &X
00277     ,MultiVectorBase<Scalar>          *Y
00278     ,const Scalar                     alpha
00279     ,const Scalar                     beta
00280     ) const;
00281 
00283 
00284 private:
00285 
00286   std::vector<Teuchos::ConstNonconstObjectContainer<LinearOpBase<Scalar> > >   Ops_;
00287 
00288   void assertInitialized() const;
00289   void validateOps();
00290 
00291   // Not defined and not to be called
00292   DefaultMultipliedLinearOp(const DefaultMultipliedLinearOp&);
00293   DefaultMultipliedLinearOp& operator=(const DefaultMultipliedLinearOp&);
00294 
00295 };
00296 
00301 template<class Scalar>
00302 Teuchos::RefCountPtr<LinearOpBase<Scalar> >
00303 nonconstMultiply(
00304   const Teuchos::RefCountPtr<LinearOpBase<Scalar> >    &A
00305   ,const Teuchos::RefCountPtr<LinearOpBase<Scalar> >   &B
00306   );
00307 
00312 template<class Scalar>
00313 Teuchos::RefCountPtr<const LinearOpBase<Scalar> >
00314 multiply(
00315   const Teuchos::RefCountPtr<const LinearOpBase<Scalar> >    &A
00316   ,const Teuchos::RefCountPtr<const LinearOpBase<Scalar> >   &B
00317   );
00318 
00319 // /////////////////////////////////
00320 // Inline members
00321 
00322 template<class Scalar>
00323 inline
00324 void DefaultMultipliedLinearOp<Scalar>::assertInitialized() const
00325 {
00326 #ifdef TEUCHOS_DEBUG
00327   TEST_FOR_EXCEPT( !( numOps() > 0 ) );
00328 #endif
00329 }
00330 
00331 } // end namespace Thyra
00332 
00333 #endif  // THYRA_DEFAULT_MULTIPLIED_LINEAR_OP_DECL_HPP

Generated on Thu Sep 18 12:33:02 2008 for Thyra Package Browser (Single Doxygen Collection) by doxygen 1.3.9.1