int ierr;
if (last_action == Insert)
{
+ // TODO: this could lead to a dead lock when only one processor
+ // calls GlobalAssemble.
ierr = matrix->GlobalAssemble(col_map, row_map, false);
AssertThrow (ierr == 0, ExcTrilinosError(ierr));
Epetra_FECrsMatrix::ROW_MAJOR);
}
- Assert (ierr <= 0, ExcAccessToNonPresentElement(row, col_index_ptr[0]));
+#ifdef DEBUG
+ if (ierr > 0)
+ {
+ std::cout << "Got error " << ierr << " in row " << row
+ << " of proc " << row_map.Comm().MyPID()
+ << " with columns:" << std::endl;
+ for (int i=0; i<n_columns; ++i)
+ std::cout << col_index_ptr[i] << " ";
+ std::cout << endl;
+ std::cout << " Matrix row has indices:" << std::endl;
+ int n_indices, *indices;
+ trilinos_sparsity_pattern().ExtractMyRowView(row_map.LID(row),
+ n_indices,
+ indices);
+ for (int i=0; i<n_indices; ++i)
+ std::cout << indices[i] << " ";
+ std::cout << endl;
+ Assert (ierr <= 0,
+ ExcAccessToNonPresentElement(row, col_index_ptr[0]));
+ }
+#endif
AssertThrow (ierr >= 0, ExcTrilinosError(ierr));
}
const Epetra_CrsMatrix &
SparseMatrix::trilinos_matrix () const
{
- return static_cast<Epetra_CrsMatrix&>(*matrix);
+ return static_cast<const Epetra_CrsMatrix&>(*matrix);
}
* sparsity pattern.
*/
SparsityPattern (const Epetra_Map &InputMap,
- const unsigned int n_entries_per_row = 1);
+ const unsigned int n_entries_per_row = 0);
/**
* Same as before, but now use the
*/
SparsityPattern (const Epetra_Map &InputRowMap,
const Epetra_Map &InputColMap,
- const unsigned int n_entries_per_row = 1);
+ const unsigned int n_entries_per_row = 0);
/**
* This constructor is similar to the
*/
SparsityPattern (const unsigned int m,
const unsigned int n,
- const unsigned int n_entries_per_row = 1);
+ const unsigned int n_entries_per_row = 0);
/**
* Generate a sparsity pattern that
*/
void
reinit (const Epetra_Map &InputMap,
- const unsigned int n_entries_per_row = 1);
+ const unsigned int n_entries_per_row = 0);
/**
* Same as before, but now use the
void
reinit (const Epetra_Map &InputRowMap,
const Epetra_Map &InputColMap,
- const unsigned int n_entries_per_row = 1);
+ const unsigned int n_entries_per_row = 0);
/**
* This reinit function is similar to
void
reinit (const unsigned int m,
const unsigned int n,
- const unsigned int n_entries_per_row = 1);
+ const unsigned int n_entries_per_row = 0);
/**
* Initialize a sparsity pattern that
int * col_index_ptr = (int*)(col_indices);
compressed = false;
- int ierr;
-
- // If the calling sparsity pattern owns
- // the row to which we want to add
- // values, we can directly call the
- // Epetra_CrsGraph input function, which
- // is much faster than the
- // Epetra_FECrsGraph function.
- //if (row_map.MyGID(row) == true)
- //ierr = graph->Epetra_CrsGraph::InsertGlobalIndices(row,
- // n_cols,
- // col_index_ptr);
- //else
- {
- // When we're at off-processor data, we
- // have to stick with the standard
- // SumIntoGlobalValues method.
-
- ierr = graph->InsertGlobalIndices (1, (int*)&row, n_cols, col_index_ptr);
- }
+ const int ierr = graph->InsertGlobalIndices (1, (int*)&row,
+ n_cols, col_index_ptr);
- //Assert (ierr <= 0, ExcAccessToNonPresentElement(row, col_index_ptr[0]));
AssertThrow (ierr >= 0, ExcTrilinosError(ierr));
}
const Epetra_CrsGraph &
SparsityPattern::trilinos_sparsity_pattern () const
{
- return static_cast<Epetra_CrsGraph&>(*graph);
+ return static_cast<const Epetra_CrsGraph&>(*graph);
}
const Epetra_Map &
SparsityPattern::domain_partitioner () const
{
- return (Epetra_Map &) graph->DomainMap();
+ return static_cast<const Epetra_Map&>(graph->DomainMap());
}
const Epetra_Map &
SparsityPattern::range_partitioner () const
{
- return (Epetra_Map &) graph->RangeMap();
+ return static_cast<const Epetra_Map&>(graph->RangeMap());
}
const Epetra_Map &
SparsityPattern::row_partitioner () const
{
- return (Epetra_Map &) graph->RowMap();
+ return static_cast<const Epetra_Map&>(graph->RowMap());
}
const Epetra_Map &
SparsityPattern::col_partitioner () const
{
- return (Epetra_Map &) graph->ColMap();
+ return static_cast<const Epetra_Map&>(graph->ColMap());
}