*/
unsigned int n_cols () const;
+ /**
+ * Check if a value at a certain
+ * position may be non-zero.
+ */
+ bool exists (const unsigned int i, const unsigned int j) const;
+
/**
* Return the number of nonzero
* elements of this
+template <class SparsityPatternBase>
+inline
+bool
+BlockSparsityPatternBase<SparsityPatternBase>::exists (const unsigned int i,
+ const unsigned int j) const
+{
+ // if you get an error here, are
+ // you sure you called
+ // @p{collect_sizes()} before?
+ const std::pair<unsigned int,unsigned int>
+ row_index = row_indices.global_to_local (i),
+ col_index = column_indices.global_to_local (j);
+ return sub_objects[row_index.first][col_index.first]->exists (row_index.second,
+ col_index.second);
+};
+
+
+
template <class SparsityPatternBase>
inline
unsigned int
const unsigned int j);
/**
+ * Check if a value at a certain
+ * position may be non-zero.
+ */
+ bool exists (const unsigned int i, const unsigned int j) const;
+
+ /**
* Make the sparsity pattern
* symmetric by adding the
* sparsity pattern of the
Threads::encapsulate (&SparseMatrix<number>::
template threaded_residual<somenumber>)
.collect_args (this, dst, u, b,
- std::make_pair<unsigned int,unsigned int>
+ std::pair<unsigned int,unsigned int>
(n_rows * i / n_threads,
n_rows * (i+1) / n_threads),
&partial_norms[i]));
*/
unsigned int n_cols () const;
+ /**
+ * Check if a value at a certain
+ * position may be non-zero.
+ */
+ bool exists (const unsigned int i, const unsigned int j) const;
+
+
/**
* Number of entries in a specific row.
*/
};
+bool
+CompressedSparsityPattern::exists (const unsigned int i,
+ const unsigned int j) const
+{
+ Assert (i<rows, ExcInvalidIndex(i,rows));
+ Assert (j<cols, ExcInvalidIndex(j,cols));
+//TODO: Ask Wolfgang on how to use column_indices
+ Assert(false, ExcNotImplemented());
+ return true;
+}
+
+
void
CompressedSparsityPattern::symmetrize ()
};
+bool
+SparsityPattern::exists (const unsigned int i,
+ const unsigned int j) const
+{
+ Assert ((rowstart!=0) && (colnums!=0), ExcEmptyObject());
+ Assert (i<rows, ExcIndexRange(i,0,rows));
+ Assert (j<cols, ExcIndexRange(j,0,cols));
+
+ for (unsigned int k=rowstart[i]; k<rowstart[i+1]; k++)
+ {
+ // entry already exists
+ if (colnums[k] == j) return true;
+ }
+ return false;
+}
+
void
SparsityPattern::symmetrize ()