16 #ifndef dealii_dynamic_sparsity_pattern_h
17 #define dealii_dynamic_sparsity_pattern_h
20 #include <deal.II/base/config.h>
22 #include <deal.II/base/index_set.h>
23 #include <deal.II/base/subscriptor.h>
24 #include <deal.II/base/utilities.h>
26 #include <deal.II/lac/exceptions.h>
32 DEAL_II_NAMESPACE_OPEN
73 const unsigned int index_within_row);
123 "The instance of this class was initialized"
124 " without DynamicSparsityPattern object, which"
125 " means that it is a dummy accessor that can"
126 " not do any operations.");
200 const unsigned int index_within_row);
436 template <
typename ForwardIterator>
439 ForwardIterator
begin,
441 const bool indices_are_unique_and_sorted =
false);
472 template <
typename SparsityPatternTypeLeft,
typename SparsityPatternTypeRight>
475 const SparsityPatternTypeRight &right);
481 template <
typename SparsityPatternTypeLeft,
typename SparsityPatternTypeRight>
484 const SparsityPatternTypeRight &right);
492 print(std::ostream &out)
const;
718 template <
typename ForwardIterator>
722 const bool indices_are_sorted);
749 const unsigned int index_within_row)
750 : sparsity_pattern(sparsity_pattern)
753 ((sparsity_pattern->rowset.size() == 0) ?
754 sparsity_pattern->lines[current_row].entries.begin() :
756 ->lines[sparsity_pattern->rowset.index_within_set(current_row)]
760 (sparsity_pattern->rowset.size() == 0) ?
761 sparsity_pattern->lines[current_row].entries.end() :
763 ->lines[sparsity_pattern->rowset.index_within_set(current_row)]
769 ExcMessage(
"You can't create an iterator into a "
770 "DynamicSparsityPattern's row that is not "
771 "actually stored by that sparsity pattern "
772 "based on the IndexSet argument to it."));
784 : sparsity_pattern(sparsity_pattern)
785 , current_row(
numbers::invalid_size_type)
793 : sparsity_pattern(nullptr)
794 , current_row(
numbers::invalid_size_type)
910 const unsigned int index_within_row)
911 : accessor(sparsity_pattern, row, index_within_row)
917 : accessor(sparsity_pattern)
965 return !(*
this == other);
1000 std::vector<size_type>::iterator it =
1043 lines[rowindex].add(j);
1048 template <
typename ForwardIterator>
1051 ForwardIterator
begin,
1052 ForwardIterator
end,
1053 const bool indices_are_sorted)
1065 lines[rowindex].add_entries(
begin,
end, indices_are_sorted);
1083 return lines[rowindex].entries.size();
1098 ExcIndexRangeType<size_type>(index,
1100 lines[local_row].entries.size()));
1101 return lines[local_row].entries[index];
1152 while (it !=
rowset.
end() &&
lines[rowindex].entries.size() == 0)
1161 return {
this, *it, 0};
1169 while (row <
n_rows() &&
lines[row].entries.size() == 0)
1177 return {
this, row, 0};
1187 unsigned int row = r + 1;
1211 DEAL_II_NAMESPACE_CLOSE