This file is indexed.

/usr/include/trilinos/fei_MatrixTraits_FillableMat.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
/*--------------------------------------------------------------------*/
/*    Copyright 2008 Sandia Corporation.                              */
/*    Under the 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.  Export of this program may require     */
/*    a license from the United States Government.                    */
/*--------------------------------------------------------------------*/

#ifndef _fei_MatrixTraits_FillableMat_hpp_
#define _fei_MatrixTraits_FillableMat_hpp_

//This file defines matrix traits for fei::FillableMat matrices
//

#include <fei_CSRMat.hpp>
#include <fei_CSVec.hpp>
#include <fei_Vector_Impl.hpp>

namespace fei {

  /** Specialization for FillableMat. */
  template<>
  struct MatrixTraits<FillableMat> {

    /** Return a string type-name for the underlying matrix */
    static const char* typeName()
      { return("FillableMat"); }

    /** Set a specified scalar value throughout the matrix.
     */
    static int setValues(FillableMat* mat, double scalar)
      {
        mat->setValues(scalar);
        return(0);
      }

    /** Query the number of rows. This is expected to be the number of rows
        on the local processor.
    */
    static int getNumLocalRows(FillableMat* mat, int& numRows)
    {
      numRows = mat->getNumRows();
      return(0);
    }

    /** Given a global (zero-based) row number, query the length of that row.
     */
    static int getRowLength(FillableMat* mat, int row, int& length)
      {
        try {
          FillableVec* matrixrow = mat->getRow(row);
          length = matrixrow->size();
        }
        catch(...) {
          length = 0;
        }
        return( 0 );
      }

    /** Given a global (zero-based) row number, pass out a copy of the contents
        of that row.
        @param mat
        @param row
        @param len Length of the user-allocated arrays coefs and indices.
        @param coefs User-allocated array which will hold matrix coefficients
        on output.
        @param indices User-allocated array which will hold column-indices on
        output.
        @return error-code 0 if successful. Non-zero return-value may indicate
        that the specified row is not locally owned.
    */
    static int copyOutRow(FillableMat* mat,
                      int row, int len, double* coefs, int* indices)
      {
        try {
          FillableVec* matrixrow = mat->getRow(row);

          FillableVec::iterator
            row_iter = matrixrow->begin(),
            row_end = matrixrow->end();

          int i=0;
          for(; row_iter != row_end; ++row_iter, ++i) {
            if (i >= len) break;
            coefs[i] = row_iter->second;
            indices[i] = row_iter->first;
          }
        }
        catch(...) {
          //what should we do here???
        }

        return( 0 );
      }

    /** Sum a C-style table of coefficient data into the underlying matrix.
     */
    static int putValuesIn(FillableMat* mat,
                           int numRows, const int* rows,
                           int numCols, const int* cols,
                           const double* const* values,
                           bool sum_into)
      {
        if (numCols < 1 || numRows < 1) return(0);
        if (sum_into) {
          for(int i=0; i<numRows; ++i) {
            mat->sumInRow(rows[i], cols, values[i], numCols);
          }
        }
        else {
          for(int i=0; i<numRows; ++i) {
            mat->putRow(rows[i], cols, values[i], numCols);
          }
        }

        return( 0 );
      }

    /** Perform any necessary internal communications/synchronizations or other
        operations appropriate at end of data input. For some implementations this
        will be a no-op, so this "default implementation" will return 0.
    */
    static int globalAssemble(FillableMat* mat)
    {
      return(0);
    }

    /** Compute the matrix-vector product y = A*x */
    static int matvec(FillableMat* mat,
                      fei::Vector* x,
                      fei::Vector* y)
    {
      fei::Vector_Impl<FillableVec>* fvx =
        dynamic_cast<fei::Vector_Impl<FillableVec>* >(x);
      fei::Vector_Impl<FillableVec>* fvy =
        dynamic_cast<fei::Vector_Impl<FillableVec>* >(y);

      if (fvx == NULL || fvy == NULL) {
        return(-1);
      }

      fei::CSRMat A(*mat);
      fei::CSVec csx(*(fvx->getUnderlyingVector()));
      fei::CSVec csy(*(fvy->getUnderlyingVector()));

      fei::multiply_CSRMat_CSVec(A, csx, csy);

      return( 0 );
    }

  };//struct MatrixTraits
}//namespace fei

#endif // _fei_MatrixTraits_FillableMat_hpp_