/usr/include/trilinos/Tifpack_ILUT_decl.hpp is in libtrilinos-dev 10.4.0.dfsg-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | /*@HEADER
// ***********************************************************************
//
// Tifpack: Tempated Object-Oriented Algebraic Preconditioner Package
// Copyright (2009) Sandia Corporation
//
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
// license for use of this work by or on behalf of the U.S. Government.
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
//
// ***********************************************************************
//@HEADER
*/
//-----------------------------------------------------
// Tifpack::ILUT is a translation of the Aztec ILUT
// implementation. The Aztec ILUT implementation was
// written by Ray Tuminaro.
// See notes in the Tifpack::ILUT::Compute method.
// ABW.
//------------------------------------------------------
#ifndef TIFPACK_ILUT_DECL_HPP
#define TIFPACK_ILUT_DECL_HPP
#include "Tifpack_ConfigDefs.hpp"
#include "Tifpack_Preconditioner.hpp"
#include "Tifpack_Condest.hpp"
#include "Tifpack_Heap.hpp"
#include "Tifpack_Parameters.hpp"
#include <Teuchos_TestForException.hpp>
#include <Teuchos_RCP.hpp>
#include <Teuchos_Time.hpp>
#include <Teuchos_TypeNameTraits.hpp>
#include <Teuchos_ScalarTraits.hpp>
#include <string>
#include <sstream>
#include <iostream>
#include <cmath>
namespace Teuchos {
// forward declaration
class ParameterList;
}
namespace Tifpack {
//! A class for constructing and using an ILUT factorization
// of a given Tpetra::RowMatrix.
/*! Tifpack::ILUT computes an ILUT factorization with specified fill
and drop-tolerance, of a given Tpetra::RowMatrix.
For all valid parameters, see the method ILUT::setParameters.
*/
template<class MatrixType>
class ILUT: virtual public Tifpack::Preconditioner<typename MatrixType::scalar_type,typename MatrixType::local_ordinal_type,typename MatrixType::global_ordinal_type,typename MatrixType::node_type> {
public:
typedef typename MatrixType::scalar_type Scalar;
typedef typename MatrixType::local_ordinal_type LocalOrdinal;
typedef typename MatrixType::global_ordinal_type GlobalOrdinal;
typedef typename MatrixType::node_type Node;
typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType magnitudeType;
// \name Constructors and Destructors
//@{
//! ILUT explicit constuctor with Tpetra::RowMatrix input.
explicit ILUT(const Teuchos::RCP<const Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &A);
//! ILUT Destructor
virtual ~ILUT();
//@}
//@{ Construction methods
//! Set parameters for the preconditioner.
/**
<ul>
<li> "fact: ilut level-of-fill" (int)<br>
<li> "fact: drop tolerance" (magnitude-type)<br>
<li> "fact: absolute threshold" (magnitude-type)<br>
<li> "fact: relative threshold" (magnitude-type)<br>
<li> "fact: relax value" (magnitude-type)<br>
</ul>
*/
void setParameters(const Teuchos::ParameterList& params);
//! Initialize ILUT preconditioner object.
/*! Clear away any previously-allocated L and U objects.
*/
void initialize();
//! Returns \c true if the preconditioner has been successfully initialized.
inline bool isInitialized() const {
return(IsInitialized_);
}
//! Compute factors L and U using the specified diagonal perturbation thresholds and relaxation parameters.
/*! This function computes the ILUT factors L and U using the current:
<ol>
<li> Value for the drop tolerance
<li> Value for the level of fill
<li> Value for the \e a \e priori diagonal threshold values.
</ol>
*/
void compute();
//! If compute() is completed, this query returns true, otherwise it returns false.
inline bool isComputed() const {
return(IsComputed_);
}
//@}
//! @name Methods implementing Tpetra::Operator.
//@{
//! Returns the result of a ILUT forward/back solve on a Tpetra::MultiVector X in Y.
/*!
\param
X - (In) A Tpetra::MultiVector of dimension NumVectors to solve for.
\param
Y - (Out) A Tpetra::MultiVector of dimension NumVectorscontaining result.
\return Integer error code, set to 0 if successful.
*/
void apply(
const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& X,
Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& Y,
Teuchos::ETransp mode = Teuchos::NO_TRANS,
Scalar alpha = Teuchos::ScalarTraits<Scalar>::one(),
Scalar beta = Teuchos::ScalarTraits<Scalar>::zero()) const;
//! Returns the Tpetra::Map object associated with the domain of this operator.
const Teuchos::RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >& getDomainMap() const;
//! Returns the Tpetra::Map object associated with the range of this operator.
const Teuchos::RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >& getRangeMap() const;
bool hasTransposeApply() const;
//@}
//@{
//! \name Mathematical functions.
//! Computes the estimated condition number and returns the value.
magnitudeType computeCondEst(CondestType CT = Cheap,
LocalOrdinal MaxIters = 1550,
magnitudeType Tol = 1e-9,
const Teuchos::Ptr<const Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &Matrix_in = Teuchos::null);
//! Returns the computed estimated condition number, or -1.0 if no computed.
magnitudeType getCondEst() const { return Condest_; }
//! Returns the Tpetra::BlockMap object associated with the range of this matrix operator.
const Teuchos::RCP<const Teuchos::Comm<int> > & getComm() const;
//! Returns a reference to the matrix to be preconditioned.
Teuchos::RCP<const Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> > getMatrix() const;
//! Returns a reference to the L factor.
const Teuchos::RCP<const MatrixType> getL() const { return L_; }
//! Returns a reference to the U factor.
const Teuchos::RCP<const MatrixType> getU() const { return U_; }
//! Returns the number of calls to Initialize().
int getNumInitialize() const;
//! Returns the number of calls to Compute().
int getNumCompute() const;
//! Returns the number of calls to apply().
int getNumApply() const;
//! Returns the time spent in Initialize().
double getInitializeTime() const;
//! Returns the time spent in Compute().
double getComputeTime() const;
//! Returns the time spent in apply().
double getApplyTime() const;
inline double getLevelOfFill() const {
return(LevelOfFill_);
}
//! Get absolute threshold value
inline double getAbsoluteThreshold() const {
return(Athresh_);
}
//! Get relative threshold value
inline double getRelativeThreshold() const {
return(Rthresh_);
}
//! Get the relax value
inline magnitudeType getRelaxValue() const {
return(RelaxValue_);
}
//! Gets the dropping tolerance
inline magnitudeType getDropTolerance() const {
return(DropTolerance_);
}
//! Returns the number of nonzero entries in the global graph.
global_size_t getGlobalNumEntries() const;
//! Returns the number of nonzero entries in the local graph.
size_t getNodeNumEntries() const;
// @}
//! @name Overridden from Teuchos::Describable
//@{
/** \brief Return a simple one-line description of this object. */
std::string description() const;
/** \brief Print the object with some verbosity level to an FancyOStream object. */
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const;
//@}
private:
// @{ Internal methods
//! Copy constructor (should never be used)
ILUT(const ILUT<MatrixType>& RHS);
//! operator= (should never be used)
ILUT<MatrixType>& operator=(const ILUT<MatrixType>& RHS);
//@}
// @{ Internal data and parameters
//! reference to the matrix to be preconditioned.
const Teuchos::RCP<const Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> > A_;
//! Reference to the communicator object.
const Teuchos::RCP<const Teuchos::Comm<int> > Comm_;
//! L factor
Teuchos::RCP<MatrixType> L_;
//! U factor
Teuchos::RCP<MatrixType> U_;
//! Absolute threshold
double Athresh_;
//! Relative threshold
double Rthresh_;
magnitudeType RelaxValue_;
//! Level-of-fill
double LevelOfFill_;
//! Discards all elements below this tolerance
magnitudeType DropTolerance_;
//! Condition number estimate.
magnitudeType Condest_;
//! \c true if \c this object has been initialized
bool IsInitialized_;
//! \c true if \c this object has been computed
bool IsComputed_;
//! Contains the number of successful calls to Initialize().
int NumInitialize_;
//! Contains the number of successful call to Compute().
int NumCompute_;
//! Contains the number of successful call to apply().
mutable int NumApply_;
//! Contains the time for all successful calls to Initialize().
double InitializeTime_;
//! Contains the time for all successful calls to Compute().
double ComputeTime_;
//! Contains the time for all successful calls to apply().
mutable double ApplyTime_;
//! Used for timing purposes
mutable Teuchos::Time Time_;
//! Number of local rows.
LocalOrdinal NumMyRows_;
//! Global number of nonzeros in L and U factors
global_size_t NumGlobalNonzeros_;
//@}
}; // class ILUT
}//namespace Tifpack
#endif /* TIFPACK_ILUT_HPP */
|