16 #ifndef dealii__dynamic_sparsity_pattern_h
17 #define dealii__dynamic_sparsity_pattern_h
20 #include <deal.II/base/config.h>
21 #include <deal.II/base/subscriptor.h>
22 #include <deal.II/base/utilities.h>
23 #include <deal.II/lac/exceptions.h>
24 #include <deal.II/base/index_set.h>
30 DEAL_II_NAMESPACE_OPEN
43 namespace DynamicSparsityPatternIterators
72 const unsigned int index_within_row);
180 const unsigned int index_within_row);
402 template <
typename ForwardIterator>
404 ForwardIterator
begin,
406 const bool indices_are_unique_and_sorted =
false);
428 void print (std::ostream &out)
const;
614 template <
typename ForwardIterator>
617 const bool indices_are_sorted);
639 namespace DynamicSparsityPatternIterators
645 const unsigned int index_within_row)
647 sparsity_pattern(sparsity_pattern),
649 current_entry(((sparsity_pattern->rowset.size()==0)
651 sparsity_pattern->lines[current_row].entries.begin()
653 sparsity_pattern->lines[sparsity_pattern->rowset.index_within_set(current_row)].entries.begin())
656 end_of_row((sparsity_pattern->rowset.size()==0)
658 sparsity_pattern->lines[current_row].entries.end()
660 sparsity_pattern->lines[sparsity_pattern->rowset.index_within_set(current_row)].entries.end())
666 ExcMessage (
"You can't create an iterator into a "
667 "DynamicSparsityPattern's row that is not "
668 "actually stored by that sparsity pattern "
669 "based on the IndexSet argument to it."));
683 sparsity_pattern(sparsity_pattern),
684 current_row(numbers::invalid_size_type),
695 Assert (current_row < sparsity_pattern->n_rows(),
706 Assert (current_row < sparsity_pattern->n_rows(),
717 Assert (current_row < sparsity_pattern->n_rows(),
758 Assert (current_row < sparsity_pattern->n_rows(),
779 Assert (current_row < sparsity_pattern->n_rows(),
808 const unsigned int index_within_row)
810 accessor(sparsity_pattern, row, index_within_row)
818 accessor(sparsity_pattern)
874 return ! (*
this == other);
912 std::vector<size_type>::iterator
961 lines[rowindex].add (j);
966 template <
typename ForwardIterator>
970 ForwardIterator
begin,
972 const bool indices_are_sorted)
984 lines[rowindex].add_entries (begin, end, indices_are_sorted);
1009 return lines[rowindex].entries.size();
1024 ExcIndexRangeType<size_type> (index, 0,
lines[local_row].entries.size()));
1025 return lines[local_row].entries[index];
1077 &&
lines[rowindex].entries.size()==0)
1094 while (row<
n_rows() &&
lines[row].entries.size()==0)
1113 unsigned int row = r+1;
1139 DEAL_II_NAMESPACE_CLOSE
size_type row_length(const size_type row) const
bool operator==(const Iterator &) const
Iterator lower_bound(Iterator first, Iterator last, const T &val)
types::global_dof_index size_type
const types::global_dof_index invalid_size_type
void add_entries(const size_type row, ForwardIterator begin, ForwardIterator end, const bool indices_are_unique_and_sorted=false)
std::vector< size_type >::const_iterator end_of_row
DynamicSparsityPatternIterators::Iterator const_iterator
bool operator==(const Accessor &) const
const DynamicSparsityPattern * sparsity_pattern
bool exists(const size_type i, const size_type j) const
size_type memory_consumption() const
std::vector< Line > lines
std::vector< size_type > entries
DynamicSparsityPatternIterators::Iterator iterator
const Accessor * operator->() const
Iterator(const DynamicSparsityPattern *sp, const size_type row, const unsigned int index_within_row)
Accessor(const DynamicSparsityPattern *sparsity_pattern, const size_type row, const unsigned int index_within_row)
void add(const size_type i, const size_type j)
#define AssertIndexRange(index, range)
void print(std::ostream &out) const
bool operator!=(const Iterator &) const
const Accessor & operator*() const
types::global_dof_index size_type
int operator-(const Iterator &p) const
bool operator<(const Iterator &) const
bool operator<(const Accessor &) const
static::ExceptionBase & ExcMessage(std::string arg1)
const IndexSet & row_index_set() const
unsigned int global_dof_index
size_type memory_consumption() const
#define Assert(cond, exc)
void add_entries(ForwardIterator begin, ForwardIterator end, const bool indices_are_sorted)
void print_gnuplot(std::ostream &out) const
void reinit(const size_type m, const size_type n, const IndexSet &rowset=IndexSet())
ElementIterator at(const size_type global_index) const
static bool stores_only_added_elements()
size_type max_entries_per_row() const
size_type bandwidth() const
size_type column_number(const size_type row, const size_type index) const
std::vector< size_type >::const_iterator current_entry
DynamicSparsityPattern & operator=(const DynamicSparsityPattern &)
size_type index_within_set(const size_type global_index) const
static::ExceptionBase & ExcNotImplemented()
bool is_element(const size_type index) const
ElementIterator end() const
void add(const size_type col_num)
size_type n_nonzero_elements() const
static::ExceptionBase & ExcInternalError()