48 namespace epetra_test {
57 blocksize_(blocksize_in),
66 int dim = blocksize_in*blocksize_in;
71 coefs_[i] =
new double[rowlengths_[i]*dim];
73 for(
int j=0; j<rowlengths_[i]; ++j) {
75 for(
int k=0; k<dim; ++k)
coefs_[i][j*dim+k] = 0.0;
83 int num_off_diagonals,
89 blocksize_(blocksize_in),
99 int max_row_length = 1+num_off_diagonals*2;
103 if (i >= num_off_diagonals && numrows_-i > num_off_diagonals) {
107 if (i<num_off_diagonals) {
115 int dim = blocksize_in*blocksize_in;
116 coefs_[i] =
new double[rowlengths_[i]*dim];
118 int first_col = i - max_row_length/2;
119 if (first_col < 0) first_col = 0;
121 for(
int j=0; j<rowlengths_[i]; ++j) {
123 for(
int k=0; k<dim; ++k) {
135 int first_node = 2*elem_id;
140 int num_dof_per_node,
141 bool make_numerically_nonsymmetric)
146 blocksize_(num_dof_per_node),
178 for(i=0; i<num_quad_elements; ++i) {
182 int node_j = nodes[j];
184 int insertPoint = -1;
200 coefs_[i] =
new double[len];
201 for(j=0; j<len; ++j) {
202 if (make_numerically_nonsymmetric) {
229 int insertPoint = -1;
233 std::cerr <<
"ERROR, row " << row
234 <<
" not found in matrix_data"<< std::endl;
241 std::cerr <<
"ERROR, col " << col
242 <<
" not found in matrix_data"<< std::endl;
247 return( &(
coefs_[row_idx][col_idx*dim]) );
276 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
278 for(
int i=0; i<numMyRows; ++i) {
279 int row = myRows_int[i];
285 int* indices =
new int[rowLen];
286 double* values =
new double[rowLen];
289 util.
Sort(
true, rowLen, indices, 1, &values, 0, 0, 0, 0);
293 double* this_coefs =
coefs_[row];
295 for(
int j=0; j<rowLen; ++j) {
296 if (indices[j] != this_indices[j]) {
299 if (values[j] != this_coefs[j]) {
307 if (!same)
return(
false);
311 throw "matrix_data::compare_local_data: global index int but no API for it.";
315 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
317 for(
int i=0; i<numMyRows; ++i) {
318 long long row = myRows_LL[i];
324 long long* indices =
new long long[rowLen];
325 double* values =
new double[rowLen];
328 util.
Sort(
true, rowLen, indices, 1, &values, 0, 0, 0, 0);
332 double* this_coefs =
coefs_[row];
334 for(
int j=0; j<rowLen; ++j) {
335 if (indices[j] != this_indices[j]) {
338 if (values[j] != this_coefs[j]) {
346 if (!same)
return(
false);
350 throw "matrix_data::compare_local_data: global index long long but no API for it.";
355 throw "matrix_data::compare_local_data: global index type of map unknown.";
Epetra_Map: A class for partitioning vectors and matrices.
int NumGlobalEntries(long long Row) const
Returns the current number of nonzero entries in specified global row on this processor.
bool compare_local_data(const Epetra_CrsMatrix &A)
The portion of this matrix_data object's data that corresponds to the locally-owned rows of A...
bool GlobalIndicesLongLong() const
Returns true if map create with long long NumGlobalElements.
int MyGlobalElements(int *MyGlobalElementList) const
Puts list of global elements on this processor into the user-provided array.
bool GlobalIndicesInt() const
Returns true if map create with int NumGlobalElements.
void get_node_ids(int elem_id, int *node_ids)
Epetra_Util: The Epetra Util Wrapper Class.
const Epetra_Map & RowMap() const
Returns the Epetra_Map object associated with the rows of this matrix.
int NumMyElements() const
Number of elements on the calling processor.
matrix_data(int num_rows, int *rowlengths, int blocksize=1)
int ExtractGlobalRowCopy(int GlobalRow, int Length, int &NumEntries, double *Values, int *Indices) const
Returns a copy of the specified global row in user-provided arrays.
int Epetra_Util_binary_search(T item, const T *list, int len, int &insertPoint)
Utility function to perform a binary-search on a list of data.
static const int nodes_per_elem
Epetra_CrsMatrix: A class for constructing and using real-valued double-precision sparse compressed r...
static void Sort(bool SortAscending, int NumKeys, T *Keys, int NumDoubleCompanions, double **DoubleCompanions, int NumIntCompanions, int **IntCompanions, int NumLongLongCompanions, long long **LongLongCompanions)
Epetra_Util Sort Routine (Shell sort)
long long * MyGlobalElements64() const
int Epetra_Util_insert(T item, int offset, T *&list, int &usedLength, int &allocatedLength, int allocChunkSize=32)
Function to insert an item in a list, at a specified offset.