/usr/include/trilinos/mrtr_ml_preconditioner.H 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 310 311 312 313 314 315 316 317 | /*
#@HEADER
# ************************************************************************
#
# Moertel FE Package
# Copyright (2006) 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 Glen Hansen (Glen.Hansen@inl.gov)
#
# ************************************************************************
#@HEADER
*/
/* ******************************************************************** */
/* See the file COPYRIGHT for a complete copyright notice, contact */
/* person and disclaimer. */
/* ******************************************************************** */
/*!
* \file mrtr_ml_preconditioner.H
*
* \class MOERTEL::Mortar_ML_Preconditioner
*
* \brief
*
* \date Last update do Doxygen: 20-March-06
*
*/
#ifndef MOERTEL_ML_PRECONDITIONER_H
#define MOERTEL_ML_PRECONDITIONER_H
#include <ctime>
#include <iostream>
#include <vector>
// Trilinos includes
#include <Epetra_Operator.h>
#include <Epetra_CrsMatrix.h>
#include <Epetra_RowMatrix.h>
#ifdef EPETRA_MPI
#include <Epetra_MpiComm.h>
#else
#include <Epetra_SerialComm.h>
#endif
#include "Teuchos_RefCountPtr.hpp"
#include "Teuchos_ParameterList.hpp"
#include "ml_common.h"
#include "ml_include.h"
#include "ml_epetra_utils.h"
#include "ml_epetra.h"
#include "ml_epetra_operator.h"
#include "ml_MultiLevelPreconditioner.h"
#include "ml_agg_genP.h"
#include "MLAPI_Error.h"
#include "MLAPI_CompObject.h"
#include "MLAPI_TimeObject.h"
#include "MLAPI_Operator.h"
#include "MLAPI_Operator_Utils.h"
#include "MLAPI_MultiVector.h"
#include "MLAPI_InverseOperator.h"
#include "MLAPI_Expressions.h"
#include "MLAPI_BaseOperator.h"
#include "MLAPI_Workspace.h"
#include "MLAPI_Aggregation.h"
#include "MLAPI_Eig.h"
#include "mrtr_utils.H"
using namespace std;
using namespace Teuchos;
using namespace MLAPI;
/*!
\brief MOERTEL: namespace of the Moertel package
The Moertel package depends on \ref Epetra, \ref EpetraExt, \ref Teuchos,
\ref Amesos, \ref ML and \ref AztecOO:<br>
Use at least the following lines in the configure of Trilinos:<br>
\code
--enable-moertel
--enable-epetra
--enable-epetraext
--enable-teuchos
--enable-ml
--enable-aztecoo --enable-aztecoo-teuchos
--enable-amesos
\endcode
*/
namespace MOERTEL
{
/*!
\class Mortar_ML_Preconditioner
\brief
\author Glen Hansen (Glen.Hansen@inl.gov)
*/
class Mortar_ML_Preconditioner : public virtual Epetra_Operator
{
public:
// @{ \name Constructors and destructors
/*!
\brief Construct the mortar modified ml preocnditioner
Construct the mortar modified ml preconditioner using ML's MLAPI
\param Atilde (In) : The mortar modified spd system of equations
\param A (In) : The original (uncoupled) system matrix
\param WT (In) : Mortar scaling object
\param B (In) : Mortar constraints equations
\param params (In) : ML parameters
\param constructnow (In) : If true, the preconditioner is constructed immediately
*/
explicit Mortar_ML_Preconditioner(RefCountPtr<Epetra_CrsMatrix> Atilde,
RefCountPtr<Epetra_CrsMatrix> A,
RefCountPtr<Epetra_CrsMatrix> WT,
RefCountPtr<Epetra_CrsMatrix> B,
RefCountPtr<Epetra_Map> Annmap,
ParameterList& mlparams,
bool constructnow = true);
/*!
\brief Destroys an instance of this class
Destructor
*/
virtual ~Mortar_ML_Preconditioner() {}
//@}
// @{ \name Query methods
/*!
\brief Returns the label of this class.
*/
const char* Label() const {return(&(label_[0]));}
/*!
\brief get Comm of this class
Derived from Epetra_Operator, returns ref to the Epetra_Comm of this class
*/
const Epetra_Comm & Comm() const {return(Atilde_->Comm());}
/*!
\brief Get fine level OperatorDomainMap
Derived from Epetra_Operator, get fine level OperatorDomainMap
*/
const Epetra_Map & OperatorDomainMap() const {return Atilde_->OperatorDomainMap();}
/*!
\brief Get fine level OperatorRangeMap
Derived from Epetra_Operator, get fine level OperatorRangeMap
*/
const Epetra_Map & OperatorRangeMap() const {return Atilde_->OperatorRangeMap();}
//@}
// @{ \name Apply methods
/*!
\brief Compute the preconditioner
Compute the mortar modified ml preconditioner
*/
bool Compute();
/*!
\brief ApplyInverse the preconditioner
ApplyInverse the preconditioner. Method is derived from Epetra_Operator.
\param X (In) : Epetra_MultiVector matching the fine level map of this
preconditioner
\param Y (Out) : Epetra_MultiVector containing the result on output
*/
int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const ;
// @{ \name Not implemented methods derived from Epetra_Operator
/*!
\brief not implemented
*/
int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const
{ cout << "Mortar_ML_Preconditioner::Apply does not make sense for an ML-Multilevel Operator\n"
<< "Use ApplyInverse\n";throw -1;return(-1);}
/*!
\brief not implemented
*/
int SetUseTranspose(bool UseTranspose) { cout << "Mortar_ML_Preconditioner::SetUseTranspose not impl.\n";return -1;}
/*!
\brief not implemented
*/
double NormInf() const {cout << "Mortar_ML_Preconditioner::NormInf not impl.\n";
return(-1.0);}
/*!
\brief not implemented
*/
bool UseTranspose() const {cout << "Mortar_ML_Preconditioner::UseTranspose not impl.\n"; return false;}
/*!
\brief not implemented
*/
bool HasNormInf() const {cout << "Mortar_ML_Preconditioner::HasNormInf not impl.\n"; return false;}
//@}
private:
// don't want copy-ctor and = operator
Mortar_ML_Preconditioner(Mortar_ML_Preconditioner& old);
Mortar_ML_Preconditioner operator = (const Mortar_ML_Preconditioner& old);
// the v-cycle
#if 1 // old working version
int MultiLevelSA(const MultiVector& b_f,MultiVector& x_f, int level) const;
#endif
#if 0 // experimental version I
int MultiLevelSA(const MultiVector& b1_f,
const MultiVector& b2_f,
MultiVector& x1_f,
MultiVector& x2_f,
int level) const;
#endif
#if 0 // experimental version II
int MultiLevelSA(const MultiVector& b_f,MultiVector& x_f, int level) const;
#endif
// some helpers
inline const Operator& P(const int i) const { return (mlapiPmod_[i]); }
inline const Operator& R(const int i) const { return (mlapiRmod_[i]); }
inline const Operator& A(const int i) const { return (mlapiAtilde_[i]); }
inline const Operator& ImBWT(const int i) const { return (mlapiImBWT_[i]); }
inline const Operator& ImWBT(const int i) const { return (mlapiImWBT_[i]); }
inline const InverseOperator& S(const int i) const { return (mlapiS_[i]); }
const char* label_; // the label of this class
bool iscomputed_; // flag indicating whether preconditioner is ready for use
ParameterList& mlparams_; // ML parameter list
int maxlevels_; // number of levels
RefCountPtr<Epetra_CrsMatrix> Atilde_; // mortar modified spd system
RefCountPtr<Epetra_CrsMatrix> A_; // original uncoupled system
RefCountPtr<Epetra_CrsMatrix> WT_; // mortar scaling
RefCountPtr<Epetra_CrsMatrix> B_; // mortar constraints
RefCountPtr<Epetra_Map> Annmap_; // row map of Ann
vector<Operator> mlapiImBWT_; // operator I - B * W^TT on each grid
vector<Operator> mlapiImWBT_; // operator I - W * B^T on each grid
vector<Operator> mlapiRmod_; // modified restriction
vector<Operator> mlapiPmod_; // modified prolongation
vector<Operator> mlapiAtilde_; // operator Atilde on each grid
vector<InverseOperator> mlapiS_; // smoother on each grid
#if 0 // additional data for experimental version I
RefCountPtr<Epetra_Map> Arrmap_; // row map of Arr
RefCountPtr<Epetra_CrsMatrix> Atilde11_;
RefCountPtr<Epetra_CrsMatrix> Ahat11_;
RefCountPtr<Epetra_CrsMatrix> M_;
RefCountPtr<Epetra_CrsMatrix> MT_;
Operator mlapiAtilde11_;
Operator mlapiAhat11_;
Operator mlapiM_;
Operator mlapiMT_;
InverseOperator G_;
#endif
#if 0 // additional data for experimental version II
RefCountPtr<Epetra_Map> Arrmap_; // row map of Arr
RefCountPtr<Epetra_CrsMatrix> Asplit_; // uncoupled version of A
RefCountPtr<Epetra_CrsMatrix> Atildesplit_; // uncoupled modified version of Atilde
RefCountPtr<Epetra_CrsMatrix> Ahat_;
vector<Operator> mlapiAtildesplit_;
vector<Operator> mlapiAhat_;
inline const Operator& Ahat(const int i) const { return (mlapiAhat_[i]); }
#endif
}; // class ConstrainedPreconditioner : public virtual Epetra_Operator
} // namespace ConstrainedPreconditioner
#endif // MOERTEL_ML_PRECONDITIONER_H
|