/usr/include/trilinos/Ifpack_OverlappingRowMatrix.h is in libtrilinos-ifpack-dev 12.4.2-2.
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 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | /*@HEADER
// ***********************************************************************
//
// Ifpack: Object-Oriented Algebraic Preconditioner Package
// Copyright (2002) 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
*/
#ifndef IFPACK_OVERLAPPINGROWMATRIX_H
#define IFPACK_OVERLAPPINGROWMATRIX_H
#include "Ifpack_ConfigDefs.h"
#include "Epetra_RowMatrix.h"
#include "Epetra_CombineMode.h"
#include "Teuchos_RefCountPtr.hpp"
#include "Epetra_Import.h"
#include "Epetra_Map.h"
#ifdef HAVE_IFPACK_PARALLEL_SUBDOMAIN_SOLVERS
#include "Epetra_IntVector.h"
#else
# ifdef IFPACK_NODE_AWARE_CODE
# include "Epetra_IntVector.h"
# endif
#endif
class Epetra_Map;
class Epetra_BlockMap;
class Epetra_CrsMatrix;
class Epetra_Comm;
//! Ifpack_OverlappingRowMatrix: matrix with ghost rows, based on Epetra_RowMatrix
//
class Ifpack_OverlappingRowMatrix : public virtual Epetra_RowMatrix {
public:
//@{ Constructors/Destructors
#ifdef HAVE_IFPACK_PARALLEL_SUBDOMAIN_SOLVERS
Ifpack_OverlappingRowMatrix(const Teuchos::RefCountPtr<const Epetra_RowMatrix>& Matrix_in,
int OverlapLevel_in, int subdomainID);
#else
# ifdef IFPACK_NODE_AWARE_CODE
Ifpack_OverlappingRowMatrix(const Teuchos::RefCountPtr<const Epetra_RowMatrix>& Matrix_in,
int OverlapLevel_in, int myNodeID);
# endif
#endif
Ifpack_OverlappingRowMatrix(const Teuchos::RefCountPtr<const Epetra_RowMatrix>& Matrix_in,
int OverlapLevel_in);
#ifdef HAVE_IFPACK_PARALLEL_SUBDOMAIN_SOLVERS
~Ifpack_OverlappingRowMatrix() {};
#else
# ifdef IFPACK_NODE_AWARE_CODE
~Ifpack_OverlappingRowMatrix();
# else
~Ifpack_OverlappingRowMatrix() {};
# endif
#endif
//@}
//@{ \name Matrix data extraction routines
//! Returns the number of nonzero entries in MyRow.
/*!
\param
MyRow - (In) Local row.
\param
NumEntries - (Out) Number of nonzero values present.
\return Integer error code, set to 0 if successful.
*/
virtual int NumMyRowEntries(int MyRow, int & NumEntries) const;
//! Returns the maximum of NumMyRowEntries() over all rows.
virtual int MaxNumEntries() const
{
return(MaxNumEntries_);
}
//! Returns a copy of the specified local row in user-provided arrays.
/*!
\param
MyRow - (In) Local row to extract.
\param
Length - (In) Length of Values and Indices.
\param
NumEntries - (Out) Number of nonzero entries extracted.
\param
Values - (Out) Extracted values for this row.
\param
Indices - (Out) Extracted global column indices for the corresponding values.
\return Integer error code, set to 0 if successful.
*/
virtual int ExtractMyRowCopy(int MyRow, int Length, int & NumEntries, double *Values, int * Indices) const;
#ifdef HAVE_IFPACK_PARALLEL_SUBDOMAIN_SOLVERS
virtual int ExtractGlobalRowCopy(int MyRow, int Length, int & NumEntries, double* Values, int* Indices) const;
#else
# ifdef IFPACK_NODE_AWARE_CODE
virtual int ExtractGlobalRowCopy(int MyRow, int Length, int & NumEntries, double* Values, int* Indices) const;
# endif
#endif
//! Returns a copy of the main diagonal in a user-provided vector.
/*!
\param
Diagonal - (Out) Extracted main diagonal.
\return Integer error code, set to 0 if successful.
*/
virtual int ExtractDiagonalCopy(Epetra_Vector & Diagonal) const;
//@}
//@{ \name Mathematical functions.
//! Returns the result of a Epetra_RowMatrix multiplied by a Epetra_MultiVector X in Y.
/*!
\param
TransA -(In) If true, multiply by the transpose of matrix, otherwise just use matrix.
\param
X - (In) A Epetra_MultiVector of dimension NumVectors to multiply with matrix.
\param
Y -(Out) A Epetra_MultiVector of dimension NumVectorscontaining result.
\return Integer error code, set to 0 if successful.
*/
virtual int Multiply(bool TransA, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
//! Returns result of a local-only solve using a triangular Epetra_RowMatrix with Epetra_MultiVectors X and Y (NOT IMPLEMENTED).
virtual int Solve(bool Upper, bool Trans, bool UnitDiagonal, const Epetra_MultiVector& X,
Epetra_MultiVector& Y) const
{
IFPACK_RETURN(-1); // not implemented
}
virtual int Apply(const Epetra_MultiVector& X,
Epetra_MultiVector& Y) const;
virtual int ApplyInverse(const Epetra_MultiVector& X,
Epetra_MultiVector& Y) const;
//! Computes the sum of absolute values of the rows of the Epetra_RowMatrix, results returned in x (NOT IMPLEMENTED).
virtual int InvRowSums(Epetra_Vector& x) const
{
IFPACK_RETURN(-1); // not implemented
}
//! Scales the Epetra_RowMatrix on the left with a Epetra_Vector x (NOT IMPLEMENTED).
virtual int LeftScale(const Epetra_Vector& x)
{
IFPACK_RETURN(-1); // not implemented
}
//! Computes the sum of absolute values of the columns of the Epetra_RowMatrix, results returned in x (NOT IMPLEMENTED).
virtual int InvColSums(Epetra_Vector& x) const
{
IFPACK_RETURN(-1); // not implemented
}
//! Scales the Epetra_RowMatrix on the right with a Epetra_Vector x (NOT IMPLEMENTED).
virtual int RightScale(const Epetra_Vector& x)
{
IFPACK_RETURN(-1); // not implemented
}
//@}
//@{ \name Attribute access functions
//! If FillComplete() has been called, this query returns true, otherwise it returns false.
virtual bool Filled() const
{
return(true);
}
//! Returns the infinity norm of the global matrix.
/* Returns the quantity \f$ \| A \|_\infty\f$ such that
\f[\| A \|_\infty = \max_{1\lei\len} \sum_{i=1}^m |a_{ij}| \f].
*/
virtual double NormInf() const
{
return(A().NormInf());
}
//! Returns the one norm of the global matrix.
/* Returns the quantity \f$ \| A \|_1\f$ such that
\f[\| A \|_1= \max_{1\lej\len} \sum_{j=1}^n |a_{ij}| \f].
*/
virtual double NormOne() const
{
return(A().NormOne());
}
#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
//! Returns the number of nonzero entries in the global matrix.
virtual int NumGlobalNonzeros() const
{
if(A().RowMatrixRowMap().GlobalIndicesInt())
return (int) NumGlobalNonzeros_;
else
throw "Ifpack_OverlappingRowMatrix::NumGlobalNonzeros: Global indices not int";
}
//! Returns the number of global matrix rows.
virtual int NumGlobalRows() const
{
return(A().NumGlobalRows());
}
//! Returns the number of global matrix columns.
virtual int NumGlobalCols() const
{
return(A().NumGlobalCols());
}
//! Returns the number of global nonzero diagonal entries, based on global row/column index comparisons.
virtual int NumGlobalDiagonals() const
{
return(A().NumGlobalDiagonals());
}
#endif
//! Returns the number of nonzero entries in the global matrix.
virtual long long NumGlobalNonzeros64() const
{
return(NumGlobalNonzeros_);
}
//! Returns the number of global matrix rows.
virtual long long NumGlobalRows64() const
{
return(A().NumGlobalRows64());
}
//! Returns the number of global matrix columns.
virtual long long NumGlobalCols64() const
{
return(A().NumGlobalCols64());
}
//! Returns the number of global nonzero diagonal entries, based on global row/column index comparisons.
virtual long long NumGlobalDiagonals64() const
{
return(A().NumGlobalDiagonals64());
}
//! Returns the number of nonzero entries in the calling processor's portion of the matrix.
virtual int NumMyNonzeros() const
{
return(NumMyNonzeros_);
}
//! Returns the number of matrix rows owned by the calling processor.
virtual int NumMyRows() const
{
return(NumMyRows_);
}
//! Returns the number of matrix columns owned by the calling processor.
virtual int NumMyCols() const
{
return(NumMyCols_);
}
//! Returns the number of local nonzero diagonal entries, based on global row/column index comparisons.
virtual int NumMyDiagonals() const
{
return(NumMyDiagonals_);
}
//! If matrix is lower triangular in local index space, this query returns true, otherwise it returns false.
virtual bool LowerTriangular() const
{
return(A().LowerTriangular());
}
//! If matrix is upper triangular in local index space, this query returns true, otherwise it returns false.
virtual bool UpperTriangular() const
{
return(A().UpperTriangular());
}
//! Returns the Epetra_Map object associated with the rows of this matrix.
virtual const Epetra_Map & RowMatrixRowMap() const
{
return(*Map_);
}
//! Returns the Epetra_Map object associated with the columns of this matrix.
virtual const Epetra_Map & RowMatrixColMap() const
{
#ifdef HAVE_IFPACK_PARALLEL_SUBDOMAIN_SOLVERS
return(*colMap_);
#else
# ifdef IFPACK_NODE_AWARE_CODE
return(*colMap_);
# else
return(*Map_);
# endif
#endif
}
//! Returns the Epetra_Import object that contains the import operations for distributed operations.
virtual const Epetra_Import * RowMatrixImporter() const
{
return(&*Importer_);
}
//@}
// following functions are required to derive Epetra_RowMatrix objects.
//! Sets ownership.
int SetOwnership(bool ownership)
{
IFPACK_RETURN(-1);
}
//! Sets use transpose (not implemented).
int SetUseTranspose(bool UseTranspose_in)
{
UseTranspose_ = UseTranspose_in;
return(0);
}
//! Returns the current UseTranspose setting.
bool UseTranspose() const
{
return(UseTranspose_);
}
//! Returns true if the \e this object can provide an approximate Inf-norm, false otherwise.
bool HasNormInf() const
{
return(A().HasNormInf());
}
//! Returns a pointer to the Epetra_Comm communicator associated with this operator.
const Epetra_Comm & Comm() const
{
return(A().Comm());
}
//! Returns the Epetra_Map object associated with the domain of this operator.
const Epetra_Map & OperatorDomainMap() const
{
return(*Map_);
}
//! Returns the Epetra_Map object associated with the range of this operator.
const Epetra_Map & OperatorRangeMap() const
{
return(*Map_);
}
//@}
const Epetra_BlockMap& Map() const;
const char* Label() const{
return(Label_.c_str());
};
int OverlapLevel() const
{
return(OverlapLevel_);
}
int ImportMultiVector(const Epetra_MultiVector& X,
Epetra_MultiVector& OvX,
Epetra_CombineMode CM = Insert);
int ExportMultiVector(const Epetra_MultiVector& OvX,
Epetra_MultiVector& X,
Epetra_CombineMode CM = Add);
#ifdef HAVE_IFPACK_PARALLEL_SUBDOMAIN_SOLVERS
inline const Epetra_RowMatrix& A() const
{
return(*Matrix_);
}
inline Epetra_CrsMatrix& B() const
{
return(*ExtMatrix_);
}
#else
# ifdef IFPACK_NODE_AWARE_CODE
inline const Epetra_RowMatrix& A() const
{
return(*Matrix_);
}
inline Epetra_CrsMatrix& B() const
{
return(*ExtMatrix_);
}
# endif
#endif
private:
#ifndef HAVE_IFPACK_PARALLEL_SUBDOMAIN_SOLVERS
# ifndef IFPACK_NODE_AWARE_CODE
inline const Epetra_RowMatrix& A() const
{
return(*Matrix_);
}
inline Epetra_RowMatrix& B() const;
# endif
#endif
int NumMyRows_;
int NumMyCols_;
int NumMyDiagonals_;
int NumMyNonzeros_;
long long NumGlobalNonzeros_;
int MaxNumEntries_;
int NumMyRowsA_;
int NumMyRowsB_;
bool UseTranspose_;
Teuchos::RefCountPtr<const Epetra_Map> Map_;
#ifdef HAVE_IFPACK_PARALLEL_SUBDOMAIN_SOLVERS
const Epetra_Map *colMap_;
#else
# ifdef IFPACK_NODE_AWARE_CODE
const Epetra_Map *colMap_;
# endif
#endif
Teuchos::RefCountPtr<const Epetra_Import> Importer_;
Teuchos::RefCountPtr<const Epetra_RowMatrix> Matrix_;
Teuchos::RefCountPtr<Epetra_CrsMatrix> ExtMatrix_;
Teuchos::RefCountPtr<Epetra_Map> ExtMap_;
Teuchos::RefCountPtr<Epetra_Import> ExtImporter_;
int OverlapLevel_;
std::string Label_;
template<typename int_type>
void BuildMap(int OverlapLevel_in);
}; // class Ifpack_OverlappingRowMatrix
#endif // IFPACK_OVERLAPPINGROWMATRIX_H
|