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 
00039 namespace Thyra {
00040 
00041 
00109 template<class Scalar>
00110 class DefaultMultipliedLinearOp
00111   : virtual public MultipliedLinearOpBase<Scalar>,        // Public interface
00112     virtual protected SingleScalarLinearOpBase<Scalar>,   // Implementation detail
00113     virtual public Teuchos::Handleable<LinearOpBase<Scalar> >
00114 {
00115 public:
00116   /* */
00117   TEUCHOS_GET_RCP(LinearOpBase<Scalar>);
00118 
00120   using SingleScalarLinearOpBase<Scalar>::apply;
00121 
00124 
00131   DefaultMultipliedLinearOp();
00132 
00138   DefaultMultipliedLinearOp(
00139     const int numOps,
00140     const Teuchos::RCP<LinearOpBase<Scalar> > Ops[]
00141     );
00142 
00148   DefaultMultipliedLinearOp(
00149     const int numOps,
00150     const Teuchos::RCP<const LinearOpBase<Scalar> > Ops[]
00151     );
00152 
00172   void initialize(
00173     const int numOps,
00174     const Teuchos::RCP<LinearOpBase<Scalar> > Ops[]
00175     );
00176 
00196   void initialize(
00197     const int numOps,
00198     const Teuchos::RCP<const LinearOpBase<Scalar> > Ops[]
00199     );
00200 
00207   void uninitialize();
00208 
00210 
00213 
00215   int numOps() const;
00217   bool opIsConst(const int k) const;
00219   Teuchos::RCP<LinearOpBase<Scalar> > getNonconstOp(const int k);
00221   Teuchos::RCP<const LinearOpBase<Scalar> > getOp(const int k) const;
00222 
00224 
00227 
00231   Teuchos::RCP< const VectorSpaceBase<Scalar> > range() const;
00232 
00236   Teuchos::RCP< const VectorSpaceBase<Scalar> > domain() const;
00237 
00239   Teuchos::RCP<const LinearOpBase<Scalar> > clone() const;
00240 
00242 
00245                                                 
00249   std::string description() const;
00250 
00258   void describe(
00259     Teuchos::FancyOStream &out,
00260     const Teuchos::EVerbosityLevel verbLevel
00261     ) const;
00262 
00264 
00265 protected:
00266 
00269 
00273   bool opSupported(ETransp M_trans) const;
00274 
00276   void apply(
00277     const ETransp M_trans,
00278     const MultiVectorBase<Scalar> &X,
00279     MultiVectorBase<Scalar> *Y,
00280     const Scalar alpha,
00281     const Scalar beta
00282     ) const;
00283 
00285 
00286 private:
00287 
00288   Teuchos::Array<Teuchos::ConstNonconstObjectContainer<LinearOpBase<Scalar> > > Ops_;
00289 
00290   void assertInitialized() const;
00291   void validateOps();
00292   void setupDefaultObjectLabel();
00293 
00294   // Not defined and not to be called
00295   DefaultMultipliedLinearOp(const DefaultMultipliedLinearOp&);
00296   DefaultMultipliedLinearOp& operator=(const DefaultMultipliedLinearOp&);
00297 
00298 };
00299 
00300 
00305 template<class Scalar>
00306 Teuchos::RCP<LinearOpBase<Scalar> >
00307 nonconstMultiply(
00308   const Teuchos::RCP<LinearOpBase<Scalar> > &A,
00309   const Teuchos::RCP<LinearOpBase<Scalar> > &B,
00310   const std::string &M_label = ""
00311   );
00312 
00313 
00318 template<class Scalar>
00319 Teuchos::RCP<const LinearOpBase<Scalar> >
00320 multiply(
00321   const Teuchos::RCP<const LinearOpBase<Scalar> > &A,
00322   const Teuchos::RCP<const LinearOpBase<Scalar> > &B,
00323   const std::string &M_label = ""
00324   );
00325 
00326 
00331 template<class Scalar>
00332 Teuchos::RCP<const LinearOpBase<Scalar> >
00333 multiply(
00334   const Teuchos::RCP<const LinearOpBase<Scalar> > &A,
00335   const Teuchos::RCP<const LinearOpBase<Scalar> > &B,
00336   const Teuchos::RCP<const LinearOpBase<Scalar> > &C,
00337   const std::string &M_label = ""
00338   );
00339 
00340 
00341 // /////////////////////////////////
00342 // Inline members
00343 
00344 template<class Scalar>
00345 inline
00346 void DefaultMultipliedLinearOp<Scalar>::assertInitialized() const
00347 {
00348 #ifdef TEUCHOS_DEBUG
00349   TEST_FOR_EXCEPT( !( numOps() > 0 ) );
00350 #endif
00351 }
00352 
00353 } // end namespace Thyra
00354 
00355 #endif  // THYRA_DEFAULT_MULTIPLIED_LINEAR_OP_DECL_HPP

Generated on Tue Oct 20 12:47:25 2009 for Thyra Package Browser (Single Doxygen Collection) by doxygen 1.4.7