00001 /* @HEADER@ */ 00002 // ************************************************************************ 00003 // 00004 // Playa: Programmable Linear Algebra 00005 // Copyright 2012 Sandia Corporation 00006 // 00007 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00008 // the U.S. Government retains certain rights in this software. 00009 // 00010 // Redistribution and use in source and binary forms, with or without 00011 // modification, are permitted provided that the following conditions are 00012 // met: 00013 // 00014 // 1. Redistributions of source code must retain the above copyright 00015 // notice, this list of conditions and the following disclaimer. 00016 // 00017 // 2. Redistributions in binary form must reproduce the above copyright 00018 // notice, this list of conditions and the following disclaimer in the 00019 // documentation and/or other materials provided with the distribution. 00020 // 00021 // 3. Neither the name of the Corporation nor the names of the 00022 // contributors may be used to endorse or promote products derived from 00023 // this software without specific prior written permission. 00024 // 00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 // 00037 // Questions? Contact Kevin Long (kevin.long@ttu.edu) 00038 // 00039 00040 /* @HEADER@ */ 00041 00042 #ifndef PLAYA_IFPACKICCOPERATOR_HPP 00043 #define PLAYA_IFPACKICCOPERATOR_HPP 00044 00045 00046 #include "PlayaEpetraMatrix.hpp" 00047 #include "PlayaLinearOpWithSpacesDecl.hpp" 00048 #include "Ifpack_ICT.h" 00049 00050 00051 namespace Playa 00052 { 00053 /** 00054 * This is the operator representation of the inverse upper triangular factor 00055 * \f${\tilde R}^{-1}\f$ 00056 * in the incomplete Cholesky factorization of a matrix \f$ A \approx {\tilde R}{\tilde R}^T\f$. 00057 * 00058 * @author Kimberly Kennedy, with some small modifications by Kevin Long 00059 */ 00060 class IfpackICCOperator : 00061 public LinearOpWithSpaces<double>, 00062 public Printable 00063 { 00064 public: 00065 /** Construct the operator. During construction, the matrix A will be 00066 * approximately factored using the options given in the arguments. 00067 * 00068 * \param A The matrix to be factored 00069 * \param fillLevels Specifies the number of on-processor 00070 * nonzeros allowed in each 00071 * row of the factorization, given as a ratio of the 00072 * allowed nnz per row in the factor to nnz per row in A. 00073 * \param overlapFill Fill allowed for off-processor elements 00074 * \param dropTol New elements are dropped if |R_ij| < dropTol*R_jj. 00075 * \param relaxationValue Fraction of dropped element mass to be added to 00076 * diagonal. 00077 * \param relativeThreshold Fraction of diagonal element to be added to diagonal 00078 * \param absoluteThreshold Amount to be added to each diagonal element 00079 */ 00080 IfpackICCOperator(const EpetraMatrix* A, 00081 int fillLevels, 00082 int overlapFill, 00083 double dropTol, 00084 double relaxationValue, 00085 double relativeThreshold, 00086 double absoluteThreshold); 00087 00088 /** 00089 * Apply the operator. 00090 */ 00091 virtual void apply( 00092 Teuchos::ETransp applyType, 00093 const Vector<double>& in, 00094 Vector<double> out) const ; 00095 00096 /** \name Diagnostic output */ 00097 //@{ 00098 /** Print the matrix */ 00099 virtual void print(std::ostream& os) const ; 00100 //@} 00101 00102 /** */ 00103 std::ostream& describe( 00104 std::ostream &out 00105 ,const Teuchos::EVerbosityLevel verbLevel 00106 ,const std::string leadingIndent 00107 , const std::string indentSpacer 00108 ) const 00109 { 00110 out << leadingIndent << indentSpacer << this->description() << std::endl; 00111 return out; 00112 } 00113 /** */ 00114 std::string description() const ; 00115 //@} 00116 00117 00118 00119 private: 00120 RCP<Ifpack_ICT> precond_; 00121 00122 }; 00123 00124 00125 } 00126 00127 #endif