|
Ifpack2 Templated Preconditioning Package
Version 1.0
|
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 00031 #ifndef IFPACK2_BORDEREDOPERATOR_DEF_HPP 00032 #define IFPACK2_BORDEREDOPERATOR_DEF_HPP 00033 00034 #include "Ifpack2_BorderedOperator_decl.hpp" 00035 00036 namespace Ifpack2 { 00037 00038 //Definitions for the BorderedOperator methods: 00039 00040 //============================================================================== 00041 template< class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node > 00042 BorderedOperator<Scalar, LocalOrdinal, GlobalOrdinal, Node >:: 00043 BorderedOperator(const Teuchos::RCP<const Tpetra::Operator<Scalar, LocalOrdinal, GlobalOrdinal, Node > >& A) : 00044 A_(A) 00045 { 00046 TEUCHOS_TEST_FOR_EXCEPTION(A_ == Teuchos::null, std::runtime_error, 00047 Teuchos::typeName(*this) << "::BordredOperator(): input matrix reference was null."); 00048 } 00049 //============================================================================== 00050 //template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node > 00051 //BorderedOperator<Scalar, LocalOrdinal, GlobalOrdinal, Node>::~BorderedOperator(){ 00052 //} 00053 //============================================================================== 00054 template< class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node > 00055 const Teuchos::RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >& 00056 BorderedOperator<Scalar, LocalOrdinal, GlobalOrdinal, Node >::getDomainMap() const 00057 { 00058 return A_->getDomainMap(); 00059 } 00060 //============================================================================== 00061 template< class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node > 00062 const Teuchos::RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >& 00063 BorderedOperator<Scalar, LocalOrdinal, GlobalOrdinal, Node >::getRangeMap() const 00064 { 00065 return A_->getRangeMap(); 00066 } 00067 //============================================================================== 00068 template< class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node > 00069 bool 00070 BorderedOperator<Scalar, LocalOrdinal, GlobalOrdinal, Node >::hasTransposeApply() const 00071 { 00072 return A_->hasTransposeApply(); 00073 } 00074 //============================================================================== 00075 template< class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node > 00076 void BorderedOperator<Scalar, LocalOrdinal, GlobalOrdinal, Node >::apply( 00077 const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node >& X, 00078 Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node >& Y, 00079 Teuchos::ETransp mode, 00080 Scalar coefAx, 00081 Scalar coefY ) const 00082 { 00083 //bool opHasTrans = A_->hasTransposeApply(); 00084 //TEUCHOS_TEST_FOR_EXCEPTION( mode && !opHasTrans, std::runtime_error, 00085 //"Ifpack2::BorderedOperator::apply() ERROR: The operator does not implement transpose."); 00086 TEUCHOS_TEST_FOR_EXCEPTION(X.getNumVectors() != Y.getNumVectors(), std::runtime_error, 00087 "Ifpack2::BorderedOperator::apply() ERROR: X.getNumVectors() != Y.getNumVectors()."); 00088 A_->apply(X, Y, mode, coefAx, coefY ); 00089 } 00090 00091 00092 }//namespace Ifpack2 00093 00094 #endif /* IFPACK2_BorderedOperator_DEF_HPP */ 00095
1.7.6.1