44 #ifndef _fei_MatrixTraits_Epetra_h_
45 #define _fei_MatrixTraits_Epetra_h_
47 #include <fei_trilinos_macros.hpp>
49 #ifdef HAVE_FEI_EPETRA
55 #include <fei_MatrixTraits.hpp>
56 #include <snl_fei_BlockMatrixTraits.hpp>
57 #include <fei_VectorTraits_Epetra.hpp>
58 #include <fei_Include_Trilinos.hpp>
59 #include <fei_Vector_Impl.hpp>
71 {
return(
"Epetra_CrsMatrix"); }
82 int local_row = erowmap.
LID(row);
83 int local_col = ecolmap.
LID(col);
90 int* row_ptr = &colIndices[rowOffsets[local_row]];
91 int* end_row = &colIndices[rowOffsets[local_row+1]];
94 for(; row_ptr != end_row; ++row_ptr) {
95 if (*row_ptr == local_col)
break;
99 return rowOffsets[local_row] + col_offset;
116 if (length < 0)
return(-1);
121 int row,
int len,
double* coefs,
int* indices)
128 int numRows,
const int* rows,
129 int numCols,
const int* cols,
130 const double*
const* values,
134 static std::vector<int> idx;
135 idx.resize(numRows+numCols);
136 int* idx_row = &idx[0];
137 int* idx_col = idx_row+numRows;
138 for(
int i=0; i<numRows; ++i) {
141 for(
int i=0; i<numCols; ++i) {
145 for(
int i=0; i<numRows; ++i) {
155 for(
int i=0; i<numRows; ++i) {
173 <<
" ERROR in mat->FillComplete" << FEI_ENDL;
194 if (evx == NULL || evy == NULL) {
201 return( mat->
Multiply(
false, *ex, *ey) );
217 {
return(
"Epetra_VbrMatrix"); }
221 return( mat->PutScalar(scalar) );
226 length = mat->NumGlobalBlockEntries(row);
234 int localRow = row - minLocalRow;
240 int row,
int numBlkCols,
249 int error = mat->BeginExtractGlobalBlockRowCopy(row, numBlkCols,
253 if (error != 0 || checkRowDim != rowDim || blkRowLength != numBlkCols) {
258 for(
int i=0; i<numBlkCols; ++i) {
259 if (offset >= coefsLen) {
260 std::cerr <<
"BlockMatrixTraits::copyOutRow ran off end of coefs array."
264 int numValues = rowDim*colDims[i];
265 error = mat->ExtractEntryCopy(numValues, &(coefs[offset]),
277 int firstLocalOffset,
289 for(
int i=0; i<len; ++i) {
290 indices[i] = colmap.
GID(indices[i]);
300 const int* blockCols,
303 const double* values)
305 int err, voffset = 0;
306 for(
int j=0; j<numBlockCols; ++j) {
307 err = mat->DirectSubmitBlockEntry(blockRow, blockCols[j],
308 &(values[voffset]), LDA,
309 rowDim, colDims[j],
true);
310 if (err != 0)
return(err);
312 voffset += colDims[j]*LDA;
322 const int* blockCols,
325 const double* values)
327 int err, voffset = 0;
328 for(
int j=0; j<numBlockCols; ++j) {
329 err = mat->DirectSubmitBlockEntry(blockRow, blockCols[j],
330 &(values[voffset]), LDA,
331 rowDim, colDims[j],
false);
332 if (err != 0)
return(err);
334 voffset += colDims[j]*LDA;
347 const double*
const* values)
350 for(
int i=0; i<numCols; ++i) {
351 err = mat->DirectSubmitBlockEntry(row, cols[i], values[i],
352 LDAs[i], rowDim, colDims[i],
true);
353 if (err != 0)
return(err);
366 const double*
const* values)
369 for(
int i=0; i<numCols; ++i) {
370 err = mat->DirectSubmitBlockEntry(row, cols[i], values[i],
371 LDAs[i], rowDim, colDims[i],
false);
372 if (err != 0)
return(err);
380 return( mat->FillComplete() );
384 #endif //HAVE_FEI_EPETRA
385 #endif // _fei_MatrixTraits_Epetra_hpp_
int NumGlobalEntries(long long Row) const
bool StorageOptimized() const
virtual const Epetra_Map & RowMatrixRowMap() const =0
static int getPointRowLength(T *, int, int &)
int Multiply(bool TransA, const Epetra_Vector &x, Epetra_Vector &y) const
static int copyIn(T *, int, int, int, const int *, const int *, int, const double *)
static const char * typeName()
static int matvec(T *A, fei::Vector *x, fei::Vector *y)
const Epetra_Map & ColMap() const
int FillComplete(bool OptimizeDataStorage=true)
int PutScalar(double ScalarConstant)
const Epetra_Map & RowMap() const
virtual int NumMyRowEntries(int MyRow, int &NumEntries) const =0
static int getRowLength(T *mat, int row, int &length)
static int copyOutPointRow(T *, int, int, int, double *, int *, int &)
static int getNumLocalRows(T *mat, int &numRows)
int ExtractGlobalRowCopy(int GlobalRow, int Length, int &NumEntries, double *Values, int *Indices) const
static const char * typeName()
static int getRowLength(T *, int, int &)
static int putScalar(T *, double)
int SumIntoMyValues(int MyRow, int NumEntries, const double *Values, const int *Indices)
std::ostream & console_out()
static int copyOutRow(T *, int, int, int, int *, int *, double *, int, int &)
T * getUnderlyingVector()
static int setValues(T *mat, double scalar)
virtual int ExtractMyRowCopy(int MyRow, int Length, int &NumEntries, double *Values, int *Indices) const =0
virtual const Epetra_Map & RowMatrixColMap() const =0
static int sumIn(T *, int, int, int, const int *, const int *, int, const double *)
static int copyOutRow(T *mat, int row, int len, double *coefs, int *indices)
int ReplaceMyValues(int MyRow, int NumEntries, const double *Values, const int *Indices)
static int putValuesIn(T *mat, int numRows, const int *rows, int numCols, const int *cols, const double *const *values, bool sum_into)
int ExtractCrsDataPointers(int *&IndexOffset, int *&Indices, double *&Values_in) const
static int globalAssemble(T *A)
static int globalAssemble(T *)