43 #ifndef _AztecDMSR_Matrix_h_
44 #define _AztecDMSR_Matrix_h_
46 #ifdef HAVE_FEI_AZTECOO
75 namespace fei_trilinos {
79 class AztecDMSR_Matrix {
86 AztecDMSR_Matrix(
const AztecDMSR_Matrix& src);
88 virtual ~AztecDMSR_Matrix ();
91 void matvec(
const Aztec_LSVector& x, Aztec_LSVector& y)
const;
94 void getDiagonal(Aztec_LSVector& diagVector)
const;
98 int rowLength(
int row)
const;
101 void getRow(
int row,
int& length,
double *coefs,
int *colInd)
const;
102 void getRow(
int row,
int& length,
double *coefs)
const;
103 void getRow(
int row,
int& length,
int *colInd)
const;
106 int setDiagEntry(
int row,
double value);
109 double getDiagEntry(
int row)
const;
112 int putRow(
int row,
int len,
const double *coefs,
115 int sumIntoRow(
int numRows,
const int* rows,
116 int numCols,
const int* cols,
117 const double*
const* coefs);
119 int sumIntoRow(
int row,
int len,
const double *coefs,
122 int addScaledMatrix(
double scalar,
const AztecDMSR_Matrix& source);
124 void scale(
double scalar);
128 int getOffDiagRowPointers(
int row,
int*& colIndices,
double*& coefs,
129 int& offDiagRowLength);
131 void allocate(
int *rowLengths);
135 void allocate(
int *rowLengths,
const int*
const* colIndices);
140 bool isFilled()
const {
return(isFilled_);};
141 void setFilled(
bool flag) {isFilled_ = flag;};
142 bool isAllocated()
const {
return(isAllocated_);};
143 void setAllocated(
bool flag) {isAllocated_ = flag;};
145 void copyStructure(AztecDMSR_Matrix& source);
147 bool readFromFile(
const char *filename);
148 bool writeToFile(
const char *fileName)
const;
149 bool rowMax()
const {
return true;};
150 double rowMax(
int row)
const;
152 int getNumNonZeros() {
return(nnzeros_);};
154 double* getBeginPointer() {
return val; }
156 int getOffset(
int row,
int col)
159 if (!amap_->inUpdate(row,localRow)){
160 std::ostringstream oss;
161 oss <<
"row "<<row<<
" not found";
162 std::string str = oss.str();
163 throw std::runtime_error(str.c_str());
166 if (row == col)
return localRow;
168 int* row_ptr = &bindx[bindx[localRow]];
169 int* end_row = &bindx[bindx[localRow+1]];
172 for(; row_ptr != end_row; ++row_ptr) {
173 if (amap_->getTransformedEqn(*row_ptr) == col)
break;
176 if (row_ptr == end_row){
178 osstr <<
"Col "<<col <<
" not found for row "<<row;
179 throw std::runtime_error(osstr.str());
181 return bindx[localRow] + col_offset;
186 AZ_MATRIX* getAZ_MATRIX_PTR() {
return(Amat_);};
189 void messageAbort(
const char* mesg);
190 int insert(
int item,
int offset,
int* list,
int& len,
int allocLen);
191 int insert(
double item,
int offset,
double* list,
int& len,
int allocLen);
192 void expand_array(
int*& array,
int& arraylen,
int newlen);
193 void expand_array(
double*& array,
int& arraylen,
int newlen);
205 bool arraysAllocated_;
223 #endif //HAVE_FEI_AZTECOO
#define FEI_OSTRINGSTREAM