This file is indexed.

/usr/include/trilinos/ml_Epetra_wrap_CrsGraph_as_RowMatrix.H is in libtrilinos-ml-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
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
/*!
 * \file ml_Epetra_wrap_CrsGraph_as_RowMatrix.H
 *
 * \class ML_Epetra::CrsGraphWrapper
 *
 * \brief Wraps a Epetra_CrsGraph as an Epetra_RowMatrix
 *
 * \date Last update to Doxygen: 01-Apr-05
 *
 */
/* ******************************************************************** */
/* See the file COPYRIGHT for a complete copyright notice, contact      */
/* person and disclaimer.                                               */
/* ******************************************************************** */
#if defined(HAVE_ML_EPETRA)

#ifndef ML_EPETRA_CRSGRAPHWRAP_H
#define ML_EPETRA_CRSGRAPHWRAP_H

#include "Epetra_Import.h"
#include "Epetra_Comm.h"
#include "Epetra_SerialComm.h"
#ifdef ML_MPI
#include "Epetra_MpiComm.h"
#endif
#include "Epetra_Map.h"
#include "Epetra_BlockMap.h"
#include "Epetra_MultiVector.h"
#include "Epetra_Operator.h"
#include "Epetra_SrcDistObject.h"
#include "Epetra_RowMatrix.h"
class Epetra_Map;
class Epetra_Comm;
class Epetra_Import;
class Epetra_Export;
class Epetra_Vector;
class Epetra_MultiVector;
class Epetra_SrcDistObject;

namespace ML_Epetra
{

/*!

   \brief ML_Epetra::CrsGraphWrapper: a class to wrap an Epetra_CrsGraph as Epetra_RowMatrix

   Class ML_Epetra::CrsGraphWrapper takes an Epetra_CrsGraph object and wraps it as an
   Epetra_RowMatrix. It  can then be used as input
   to ML to generate a plain aggegration MG hierarchy. Note that
   the resulting coarse grid operators are rubbish and need to be replaced before
   actually applying this hierarchy to something.
   This class' destructor does not destoy any of the passed objects, so they need to be
   destoyed separately.


    To make use of the full functionality of this class it
    requires ML to be configured with the following options:
    - \c --enable-epetra

    \author Michael Gee, SNL 9214
*/
class CrsGraphWrapper: public virtual Epetra_RowMatrix
{

 public:
  //@{ \name Constructor.
  //! Constructs a CrsGraphWrapper class.
  /*!
   Constructs a CrsGraphWrapper class.
   As this wrapper implements an Epetra_RowMatrix, it can then be used as input
   to ML to generate a plain aggegration MG hierarchy. Note that
   the resulting coarse grid operators are rubbish and need to be replaced before
   actually applying this hierarchy to something.
   \param graph (In) : ref to Epetra_CrsGraph
   \param dm        (In) : ref to the DomainMap
   \param rm        (In) : ref to the RangeMap
   \param comm      (In) : the Epetra_Comm to be used
   */
    CrsGraphWrapper(const Epetra_CrsGraph& graph, const Epetra_Map& dm,const Epetra_Map& rm,const Epetra_Comm& comm) :
    graph_(graph),
    DomainMap_(dm),
    RangeMap_(rm),
    comm_(comm)
    {
      name_  = "ML_Epetra::CrsGraphWrapper";
      return;
    }

  //@{ \name Destructor.
    //! Destructor
    virtual ~CrsGraphWrapper() {};

  //@}

  //@{ \name Matrix data extraction routines

    //! Returns the number of nonzero entries in MyRow.
    /*!
    \param In
           MyRow - Local row.
    \param Out
	   NumEntries - Number of nonzero values present.

    \return Integer error code, set to 0 if successful.
  */
    int NumMyRowEntries(int MyRow, int & NumEntries) const
    {
      NumEntries = graph_.NumMyIndices(MyRow);
      return(0);
    }


    //! Returns the maximum of NumMyRowEntries() over all rows.
    int MaxNumEntries() const
    {
      return(graph_.MaxNumIndices());
    }

    //! Returns a copy of the specified local row in user-provided arrays.
    /*! As this class wraps a graph and implements an Epetra_RowMatrix,
        int-values are taken from the graph and converted to double values.
    \param In
           MyRow - Local row to extract.
    \param In
	   Length - Length of Values and Indices.
    \param Out
	   NumEntries - Number of nonzero entries extracted.
    \param Out
	   Values - Extracted values for this row.
    \param Out
	   Indices - Extracted global column indices for the corresponding values.

    \return Integer error code, set to 0 if successful.
  */
    int ExtractMyRowCopy(int MyRow, int Length, int& NumEntries, double *Values, int * Indices) const
    {
      int err = graph_.ExtractMyRowCopy(MyRow,Length,NumEntries,Indices);
      if (!err)
      {
        int i,min;
        if (NumEntries<Length) min = NumEntries;
        else                   min = Length;
        for (i=0; i<min; i++)
          Values[i] = 1.0;
      }
      return (err);
    }

    //! not implemented, method will throw error and terminate execution.
    int ExtractDiagonalCopy(Epetra_Vector & Diagonal) const
    {
       cout << "**ERR** ML_Epetra::CrsGraphWrapper.ExtractDiagonalCopy(...) is not impl!\n";
       throw -1;
       return(-1);
    }
  //@}

  //@{ \name Mathematical functions.

    //! not implemented, method will throw error and terminate execution.
    int Multiply(bool TransA, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const
    {
       cout << "**ERR** ML_Epetra::CrsGraphWrapper.Multiply(...) is not impl!\n";
       throw -1;
       return(-1);
    }

    //! not implemented, method will throw error and terminate execution.
    int Solve(bool Upper, bool Trans, bool UnitDiagonal, const Epetra_MultiVector& X,
	      Epetra_MultiVector& Y) const
    {
       cout << "**ERR** ML_Epetra::CrsGraphWrapper.Solve(...) is not impl!\n";
       throw -1;
       return(-1);
    }

    //! not implemented, method will throw error and terminate execution.
    int InvRowSums(Epetra_Vector& x) const
    {
       cout << "**ERR** ML_Epetra::CrsGraphWrapper.InvRowSums(...) is not impl!\n";
       throw -1;
       return(-1);
    }

    //! not implemented, method will throw error and terminate execution.
    int LeftScale(const Epetra_Vector& x)
    {
       cout << "**ERR** ML_Epetra::CrsGraphWrapper.LeftScale(...) is not impl!\n";
       throw -1;
       return(-1);
    }

    //! not implemented, method will throw error and terminate execution.
    int InvColSums(Epetra_Vector& x) const
    {
       cout << "**ERR** ML_Epetra::CrsGraphWrapper.InvColSums(...) is not impl!\n";
       throw -1;
       return(-1);
    }

    //! not implemented, method will throw error and terminate execution.
    int RightScale(const Epetra_Vector& x)
    {
       cout << "**ERR** ML_Epetra::CrsGraphWrapper.RightScale(...) is not impl!\n";
       throw -1;
       return(-1);
    }
  //@}

  //@{ \name Attribute access functions

    //! If FillComplete() has been called, this query returns true, otherwise it returns false.
    bool Filled() const
    {
       return(graph_.Filled());
    }

    //! not implemented, method will throw error and terminate execution.
    double NormInf() const
    {
       cout << "**ERR** ML_Epetra::CrsGraphWrapper.NormInf(...) is not impl!\n";
       throw -1;
       return(-1.0);
    }

    //! not implemented, method will throw error and terminate execution.
    double NormOne() const
    {
       cout << "**ERR** ML_Epetra::CrsGraphWrapper.NormOne(...) is not impl!\n";
       throw -1;
       return(-1.0);
    }

    //! Returns the number of nonzero entries in the global matrix.
    long long NumGlobalNonzeros() const {return(graph_.NumGlobalNonzeros()); }

    //! Returns the number of global matrix rows.
    long long NumGlobalRows() const {return(graph_.NumGlobalRows()); }

    //! Returns the number of global matrix columns.
    long long NumGlobalCols() const {return(graph_.NumGlobalCols()); }

    //! Returns the number of global nonzero diagonal entries, based on global row/column index comparisons.
    long long NumGlobalDiagonals() const {return(graph_.NumGlobalDiagonals()); }

    //! Returns the number of nonzero entries in the calling processor's portion of the matrix.
    int NumMyNonzeros() const {return(graph_.NumMyNonzeros()); }

    //! Returns the number of matrix rows owned by the calling processor.
    int NumMyRows() const {return(graph_.NumMyRows()); }

    //! Returns the number of matrix columns owned by the calling processor.
    int NumMyCols() const {return(graph_.NumMyCols()); }

    //! Returns the number of local nonzero diagonal entries, based on global row/column index comparisons.
    int NumMyDiagonals() const {return(graph_.NumMyDiagonals()); }

    //! If matrix is lower triangular in local index space, this query returns true, otherwise it returns false.
    bool LowerTriangular() const {return(graph_.LowerTriangular()); }

    //! If matrix is upper triangular in local index space, this query returns true, otherwise it returns false.
    bool UpperTriangular() const {return(graph_.UpperTriangular()); }

    //! Returns the Epetra_Map object associated with the rows of this matrix.
    const Epetra_Map & RowMatrixRowMap() const
    {
      return(dynamic_cast<const Epetra_Map&>(graph_.RowMap()));
    }

    //! Returns the Epetra_Map object associated with the columns of this matrix.
    const Epetra_Map & RowMatrixColMap() const
    {
      return(dynamic_cast<const Epetra_Map &>(graph_.ColMap()));
    }

    //! Returns the Epetra_Import object that contains the import operations for distributed operations.
    const Epetra_Import * RowMatrixImporter() const
    {
      return(graph_.Importer());
    }

    //! Returns the Epetra_Map object associated with the rows of this matrix, derived from Epetra_Operator
    const Epetra_BlockMap& Map() const
    {
      return(graph_.RowMap());
    }

    //! not implemented, method will always return -1
    int SetUseTranspose(bool UseTranspose)
    {
      usetranspose_ = UseTranspose;
      return(-1); //  the implementation does not support use of transpose
    }

    //! not implemented, method will throw error and terminate execution.
    int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const
    {
       cout << "ML_Epetra::CrsGraphWrapper::Apply() is not implemented\n"; throw -1;
       return(-1);
    }

    //! not implemented, method will throw error and terminate execution.
    int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const
    {
       cout << "**ERR** ML_Epetra::CrsGraphWrapper.ApplyInverse(...) is not impl!\n";
       throw -1;
       return(-1);
    }

    //! returns the label of this class
    const char * Label() const                   {return(name_);}

    //! returns the usetranspose_ flag
    bool UseTranspose() const                    {return(usetranspose_);}

    //! always returns false
    bool HasNormInf() const                      {return(false);}

    //! returns ref to the Epetra_Comm associated with this class
    const Epetra_Comm & Comm() const             {return(comm_);}

    //! returns ref to the OperatorDomainMap associated with this class
    const Epetra_Map & OperatorDomainMap() const {return(DomainMap_);}

    //! returns ref to the OperatorRangeMap associated with this class
    const Epetra_Map & OperatorRangeMap() const  {return(RangeMap_);}

  //@}
 private:

    const Epetra_CrsGraph& graph_;
    bool                   usetranspose_;
    const char*            name_;
    Epetra_Map             DomainMap_;
    Epetra_Map             RangeMap_;
    const Epetra_Comm&     comm_;
};

} // namespace ML_Epetra

#endif // defined(HAVE_ML_EPETRA)
#endif // ML_EPETRA_CRSGRAPHWRAP_H