Thyra_DefaultAddedLinearOpDecl.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_ADDED_LINEAR_OP_DECL_HPP
00030 #define THYRA_DEFAULT_ADDED_LINEAR_OP_DECL_HPP
00031 
00032 #include "Thyra_AddedLinearOpBase.hpp"
00033 #include "Thyra_SingleScalarLinearOpBase.hpp"
00034 #include "Teuchos_ConstNonconstObjectContainer.hpp"
00035 #include "Teuchos_arrayArg.hpp"
00036 
00037 namespace Thyra {
00038 
00070 template<class Scalar>
00071 class DefaultAddedLinearOp
00072   : virtual public AddedLinearOpBase<Scalar>             // Public interface
00073   , virtual protected SingleScalarLinearOpBase<Scalar>   // Implementation detail
00074 {
00075 public:
00076 
00078   using SingleScalarLinearOpBase<Scalar>::apply;
00079 
00082 
00089   DefaultAddedLinearOp();
00090 
00096   DefaultAddedLinearOp(
00097     const int                                                   numOps
00098     ,const Teuchos::RefCountPtr<LinearOpBase<Scalar> >          Ops[]
00099     );
00100 
00106   DefaultAddedLinearOp(
00107     const int                                                   numOps
00108     ,const Teuchos::RefCountPtr<const LinearOpBase<Scalar> >    Ops[]
00109     );
00110 
00130   void initialize(
00131     const int                                                   numOps
00132     ,const Teuchos::RefCountPtr<LinearOpBase<Scalar> >          Ops[]
00133     );
00134 
00154   void initialize(
00155     const int                                                   numOps
00156     ,const Teuchos::RefCountPtr<const LinearOpBase<Scalar> >    Ops[]
00157     );
00158 
00165   void uninitialize();
00166 
00168 
00171 
00173   int numOps() const;
00175   bool opIsConst(const int k) const;
00177   Teuchos::RefCountPtr<LinearOpBase<Scalar> > getNonconstOp(const int k);
00179   Teuchos::RefCountPtr<const LinearOpBase<Scalar> > getOp(const int k) const;
00180 
00182 
00185 
00189   Teuchos::RefCountPtr< const VectorSpaceBase<Scalar> > range() const;
00190 
00194   Teuchos::RefCountPtr< const VectorSpaceBase<Scalar> > domain() const;
00195 
00197   Teuchos::RefCountPtr<const LinearOpBase<Scalar> > clone() const;
00198 
00200 
00203                                                 
00207   std::string description() const;
00208 
00216   void describe(
00217     Teuchos::FancyOStream                &out
00218     ,const Teuchos::EVerbosityLevel      verbLevel
00219     ) const;
00220 
00222 
00223 protected:
00224 
00227 
00231   bool opSupported(ETransp M_trans) const;
00232 
00234   void apply(
00235     const ETransp                     M_trans
00236     ,const MultiVectorBase<Scalar>    &X
00237     ,MultiVectorBase<Scalar>          *Y
00238     ,const Scalar                     alpha
00239     ,const Scalar                     beta
00240     ) const;
00241 
00243 
00244 private:
00245 
00246   std::vector<Teuchos::ConstNonconstObjectContainer<LinearOpBase<Scalar> > >   Ops_;
00247 
00248   void assertInitialized() const;
00249   void validateOps();
00250 
00251   // Not defined and not to be called
00252   DefaultAddedLinearOp(const DefaultAddedLinearOp&);
00253   DefaultAddedLinearOp& operator=(const DefaultAddedLinearOp&);
00254 
00255 };
00256 
00261 template<class Scalar>
00262 Teuchos::RefCountPtr<LinearOpBase<Scalar> >
00263 nonconstAdd(
00264   const Teuchos::RefCountPtr<LinearOpBase<Scalar> >    &A
00265   ,const Teuchos::RefCountPtr<LinearOpBase<Scalar> >   &B
00266   );
00267 
00272 template<class Scalar>
00273 Teuchos::RefCountPtr<const LinearOpBase<Scalar> >
00274 add(
00275   const Teuchos::RefCountPtr<const LinearOpBase<Scalar> >    &A
00276   ,const Teuchos::RefCountPtr<const LinearOpBase<Scalar> >   &B
00277   );
00278 
00279 // /////////////////////////////////
00280 // Inline members
00281 
00282 template<class Scalar>
00283 inline
00284 void DefaultAddedLinearOp<Scalar>::assertInitialized() const
00285 {
00286 #ifdef TEUCHOS_DEBUG
00287   TEST_FOR_EXCEPT( !( numOps() > 0 ) );
00288 #endif
00289 }
00290 
00291 } // end namespace Thyra
00292 
00293 #endif  // THYRA_DEFAULT_ADDED_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