44 #ifndef TPETRA_EPETRAROWMATRIX_HPP 45 #define TPETRA_EPETRAROWMATRIX_HPP 47 #include <Tpetra_ConfigDefs.hpp> 49 #if defined(HAVE_TPETRA_EPETRA) 51 #include <Epetra_Comm.h> 52 #include <Epetra_BasicRowMatrix.h> 53 #include <Tpetra_CrsMatrix.hpp> 59 template<
class TpetraMatrixType>
60 class EpetraRowMatrix :
public Epetra_BasicRowMatrix {
63 virtual ~EpetraRowMatrix();
65 int ExtractMyRowCopy(
int MyRow,
int Length,
int & NumEntries,
double *Values,
int * Indices)
const;
68 int ExtractMyEntryView(
int CurEntry,
double * & Value,
int & RowIndex,
int & ColIndex);
71 int ExtractMyEntryView(
int CurEntry,
double const * & Value,
int & RowIndex,
int & ColIndex)
const;
73 int NumMyRowEntries(
int MyRow,
int & NumEntries)
const;
79 template<
class TpetraMatrixType>
80 EpetraRowMatrix<TpetraMatrixType>::EpetraRowMatrix(
83 : Epetra_BasicRowMatrix(comm),
86 int globalNumRows = tpetra_matrix_->getRowMap()->getGlobalNumElements();
87 int globalNumCols = tpetra_matrix_->getColMap()->getGlobalNumElements();
90 Epetra_Map rowmap(globalNumRows, row_elem_list.
size(), row_elem_list.
getRawPtr(), 0, comm);
91 Epetra_Map colmap(globalNumCols, col_elem_list.
size(), col_elem_list.
getRawPtr(), 0, comm);
92 SetMaps(rowmap, colmap);
95 template<
class TpetraMatrixType>
96 EpetraRowMatrix<TpetraMatrixType>::~EpetraRowMatrix()
100 template<
class TpetraMatrixType>
101 int EpetraRowMatrix<TpetraMatrixType>::ExtractMyRowCopy(
int MyRow,
int Length,
int & NumEntries,
double *Values,
int * Indices)
const 105 size_t num_entries = NumEntries;
106 tpetra_matrix_->getLocalRowCopy(MyRow, inds, vals, num_entries);
107 NumEntries = num_entries;
111 template<
class TpetraMatrixType>
112 int EpetraRowMatrix<TpetraMatrixType>::ExtractMyEntryView(
int CurEntry,
double * & Value,
int & RowIndex,
int & ColIndex)
118 template<
class TpetraMatrixType>
119 int EpetraRowMatrix<TpetraMatrixType>::ExtractMyEntryView(
int CurEntry,
double const * & Value,
int & RowIndex,
int & ColIndex)
const 125 template<
class TpetraMatrixType>
126 int EpetraRowMatrix<TpetraMatrixType>::NumMyRowEntries(
int MyRow,
int & NumEntries)
const 128 NumEntries = tpetra_matrix_->getNumEntriesInLocalRow(MyRow);
134 #endif // defined(HAVE_TPETRA_EPETRA) Namespace Tpetra contains the class and methods constituting the Tpetra library.