Ifpack2 Templated Preconditioning Package Version 1.0
Ifpack2_Container.hpp
00001 /*@HEADER
00002 // ***********************************************************************
00003 //
00004 //       Ifpack2: Tempated Object-Oriented Algebraic Preconditioner Package
00005 //                 Copyright (2009) 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 
00030 #ifndef IFPACK2_CONTAINER_HPP
00031 #define IFPACK2_CONTAINER_HPP
00032 #include "Ifpack2_ConfigDefs.hpp"
00033 #include "Tpetra_RowMatrix.hpp"
00034 #include "Teuchos_RCP.hpp"
00035 #include "Teuchos_TypeNameTraits.hpp"
00036 #include "Teuchos_ScalarTraits.hpp"
00037 #include "Teuchos_ParameterList.hpp"
00038 #include "Teuchos_Describable.hpp"
00039 #include <iostream>
00040 
00042 
00088 namespace Ifpack2 {
00089 
00090 template<class MatrixType, class InverseType>
00091 class Container : public Teuchos::Describable {
00092 
00093 public:
00094   typedef typename MatrixType::scalar_type          MatrixScalar;
00095   typedef typename MatrixType::local_ordinal_type   MatrixLocalOrdinal;
00096   typedef typename MatrixType::global_ordinal_type  MatrixGlobalOrdinal;
00097   typedef typename MatrixType::node_type            MatrixNode;
00098 
00099   typedef typename InverseType::scalar_type         InverseScalar;
00100   typedef typename InverseType::local_ordinal_type  InverseLocalOrdinal;
00101   typedef typename InverseType::global_ordinal_type InverseGlobalOrdinal;
00102   typedef typename InverseType::node_type           InverseNode;
00103 
00105   virtual ~Container() {};
00106 
00108   virtual size_t getNumRows() const = 0;
00109 
00111 
00120   virtual MatrixLocalOrdinal & ID(const size_t i) = 0;
00121 
00123   virtual void initialize() = 0;
00124 
00126   virtual void compute(const Teuchos::RCP<const Tpetra::RowMatrix<MatrixScalar,MatrixLocalOrdinal,MatrixGlobalOrdinal,MatrixNode> >& Matrix) = 0;
00127 
00129   virtual void setParameters(const Teuchos::ParameterList& List) = 0;
00130 
00132   virtual bool isInitialized() const = 0;
00133 
00135   virtual bool isComputed() const = 0;
00136 
00138 
00140   virtual void apply(const Tpetra::MultiVector<MatrixScalar,MatrixLocalOrdinal,MatrixGlobalOrdinal,MatrixNode>& X,
00141          Tpetra::MultiVector<MatrixScalar,MatrixLocalOrdinal,MatrixGlobalOrdinal,MatrixNode>& Y,
00142          Teuchos::ETransp mode=Teuchos::NO_TRANS,
00143          MatrixScalar alpha=Teuchos::ScalarTraits< MatrixScalar >::one(),
00144          MatrixScalar beta=Teuchos::ScalarTraits< MatrixScalar >::zero())=0;
00145 
00147 
00151   virtual void weightedApply(const Tpetra::MultiVector<MatrixScalar,MatrixLocalOrdinal,MatrixGlobalOrdinal,MatrixNode>& X,
00152            Tpetra::MultiVector<MatrixScalar,MatrixLocalOrdinal,MatrixGlobalOrdinal,MatrixNode>& Y,
00153            const Tpetra::Vector<MatrixScalar,MatrixLocalOrdinal,MatrixGlobalOrdinal,MatrixNode>& D,
00154            Teuchos::ETransp mode=Teuchos::NO_TRANS,
00155            MatrixScalar alpha=Teuchos::ScalarTraits< MatrixScalar >::one(),
00156            MatrixScalar beta=Teuchos::ScalarTraits< MatrixScalar >::zero())=0;
00157 
00158 
00160   virtual std::ostream& print(std::ostream& os) const = 0;
00161 
00162 };
00163 
00164 template <class MatrixType, class InverseType>
00165 inline std::ostream& operator<<(std::ostream& os, const Ifpack2::Container<MatrixType,InverseType> & obj)
00166 {
00167   return(obj.print(os));
00168 }
00169 
00170 }
00171 
00172 #endif // IFPACK2_CONTAINER_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends