/usr/include/trilinos/Ifpack2_Hiptmair_decl.hpp is in libtrilinos-ifpack2-dev 12.12.1-5.
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 | /*@HEADER
// ***********************************************************************
//
// Ifpack2: 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.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
//
// ***********************************************************************
//@HEADER
*/
/// \file Ifpack2_Hiptmair_decl.hpp
/// \brief Declaration of Ifpack2::Hiptmair class.
/// \author Paul Tsuji
#ifndef IFPACK2_HIPTMAIR_DECL_HPP
#define IFPACK2_HIPTMAIR_DECL_HPP
#include "Ifpack2_Preconditioner.hpp"
#include <type_traits>
namespace Teuchos {
class ParameterList; // forward declaration
}
namespace Ifpack2 {
/// \class Hiptmair
/// \brief Wrapper for Hiptmair smoothers.
/// \tparam A specialization of Tpetra::RowMatrix.
///
/// Ifpack2::Hiptmair does smoothing on two spaces; a primary space
/// and an auxiliary space. This situation arises when preconditioning
/// Maxwell's equations discretized by edge elements.
///
/// For a list of all run-time parameters that this class accepts,
/// see the documentation of setParameters().
template<class MatrixType>
class Hiptmair :
virtual public Ifpack2::Preconditioner<typename MatrixType::scalar_type,
typename MatrixType::local_ordinal_type,
typename MatrixType::global_ordinal_type,
typename MatrixType::node_type>
{
public:
// \name Public typedefs
//@{
//! The type of the entries of the input MatrixType.
typedef typename MatrixType::scalar_type scalar_type;
//! The type of local indices in the input MatrixType.
typedef typename MatrixType::local_ordinal_type local_ordinal_type;
//! The type of global indices in the input MatrixType.
typedef typename MatrixType::global_ordinal_type global_ordinal_type;
//! The Node type used by the input MatrixType.
typedef typename MatrixType::node_type node_type;
//! The type of the magnitude (absolute value) of a matrix entry.
typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType magnitude_type;
//! Type of the Tpetra::RowMatrix specialization that this class uses.
typedef Tpetra::RowMatrix<scalar_type,
local_ordinal_type,
global_ordinal_type,
node_type> row_matrix_type;
static_assert(std::is_same<MatrixType, row_matrix_type>::value, "Ifpack2::Hiptmair: The template parameter MatrixType must be a Tpetra::RowMatrix specialization. Please don't use Tpetra::CrsMatrix (a subclass of Tpetra::RowMatrix) here anymore. The constructor can take either a RowMatrix or a CrsMatrix just fine.");
//! Type of the Ifpack2::Preconditioner specialization from which this class inherits.
typedef Ifpack2::Preconditioner<scalar_type,
local_ordinal_type,
global_ordinal_type,
node_type> prec_type;
//@}
// \name Constructors and Destructors
//@{
//! Constructor that takes 3 Tpetra matrices.
explicit Hiptmair (const Teuchos::RCP<const row_matrix_type>& A,
const Teuchos::RCP<const row_matrix_type>& PtAP,
const Teuchos::RCP<const row_matrix_type>& P);
//! Destructor
virtual ~Hiptmair ();
//@}
//! \name Methods for setting parameters and initialization
//@{
/// \brief Set the preconditioner's parameters.
///
/// This preconditioner accepts the following parameters:
/// - "hiptmair: smoother type 1" (\c std::string)
/// - "hiptmair: smoother type 2" (\c std::string)
/// - "hiptmair: smoother list 1" (\c Teuchos::ParameterList)
/// - "hiptmair: smoother list 2" (\c Teuchos::ParameterList)
/// - "hiptmair: pre or post" (\c std::string)
/// - "hiptmair: zero starting solution" (\c bool)
void setParameters (const Teuchos::ParameterList& params);
//! Do any initialization that depends on the input matrix's structure.
void initialize ();
//! Return \c true if initialize() completed successfully, else \c false.
inline bool isInitialized () const {
return IsInitialized_;
}
//! Do any initialization that depends on the input matrix's values.
void compute ();
//! Return \c true if compute() completed successfully, else \c false.
inline bool isComputed() const {
return IsComputed_;
}
//@}
//! @name Implementation of Tpetra::Operator
//@{
//! Apply the preconditioner to X, putting the result in Y.
void
apply (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
Teuchos::ETransp mode = Teuchos::NO_TRANS,
scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero()) const;
void
applyHiptmairSmoother(const Tpetra::MultiVector<typename MatrixType::scalar_type,
typename MatrixType::local_ordinal_type,
typename MatrixType::global_ordinal_type,
typename MatrixType::node_type>& X,
Tpetra::MultiVector<typename MatrixType::scalar_type,
typename MatrixType::local_ordinal_type,
typename MatrixType::global_ordinal_type,
typename MatrixType::node_type>& Y) const;
//! Tpetra::Map representing the domain of this operator.
Teuchos::RCP<const Tpetra::Map<local_ordinal_type,global_ordinal_type,node_type> > getDomainMap() const;
//! Tpetra::Map representing the range of this operator.
Teuchos::RCP<const Tpetra::Map<local_ordinal_type,global_ordinal_type,node_type> > getRangeMap() const;
//! Whether this object's apply() method can apply the transpose (or conjugate transpose, if applicable).
bool hasTransposeApply() const;
//@}
//! \name Mathematical functions.
//@{
//! Returns the operator's communicator.
Teuchos::RCP<const Teuchos::Comm<int> > getComm() const;
//! Returns a reference to the matrix to be preconditioned.
Teuchos::RCP<const Tpetra::RowMatrix<scalar_type,local_ordinal_type,global_ordinal_type,node_type> > getMatrix() const;
//! 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;
//! @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:
typedef Teuchos::ScalarTraits<scalar_type> STS;
typedef Teuchos::ScalarTraits<magnitude_type> STM;
//! Copy constructor (should never be used)
Hiptmair (const Hiptmair<MatrixType>& RHS);
//! operator= (should never be used)
Hiptmair<MatrixType>& operator= (const Hiptmair<MatrixType>& RHS);
//! The 3 matrices necessary:
// A - matrix in primary space
// PtAP - matrix in auxiliary space
// P - prolongator matrix
Teuchos::RCP<const row_matrix_type> A_, PtAP_, P_;
//! Preconditioner types
std::string precType1_, precType2_, preOrPost_;
//! If true, the starting solution is always the zero vector.
bool ZeroStartingSolution_;
//! Preconditioner parameters.
Teuchos::ParameterList precList1_, precList2_;
//! \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_;
//! preconditioners for the two spaces
Teuchos::RCP<prec_type> ifpack2_prec1_, ifpack2_prec2_;
};
} // namespace Ifpack2
#endif // IFPACK2_HIPTMAIR_DECL_HPP
|