16 #include <deal.II/lac/dynamic_sparsity_pattern.h> 17 #include <deal.II/lac/sparsity_pattern.h> 18 #include <deal.II/base/memory_consumption.h> 25 DEAL_II_NAMESPACE_OPEN
29 template <
typename ForwardIterator>
33 const bool indices_are_sorted)
41 if (indices_are_sorted ==
true && n_elements > 3)
49 for ( ; test1 !=
end; ++test, ++test1)
64 ForwardIterator my_it =
begin;
66 std::vector<size_type>::iterator it =
102 std::vector<size_type>::iterator it2 = it + (
end-my_it);
111 else if (*my_it == *it2)
138 ForwardIterator my_it =
begin;
142 if (stop_size >
entries.capacity())
146 std::vector<size_type>::iterator it, it2;
179 for ( ; my_it !=
end; ++my_it)
232 have_entries (false),
239 ExcMessage(
"This constructor can only be called if the provided argument " 240 "is the sparsity pattern for an empty matrix. This constructor can " 241 "not be used to copy-construct a non-empty sparsity pattern."));
251 have_entries (false),
262 have_entries (false),
273 have_entries (false),
288 ExcMessage(
"This operator can only be called if the provided argument " 289 "is the sparsity pattern for an empty matrix. This operator can " 290 "not be used to copy a non-empty sparsity pattern."));
293 ExcMessage(
"This operator can only be called if the current object is" 312 ExcMessage(
"The IndexSet argument to this function needs to either " 313 "be empty (indicating the complete set of rows), or have size " 314 "equal to the desired number of rows as specified by the " 315 "first argument to this function. (Of course, the number " 316 "of indices in this IndexSet may be less than the number " 317 "of rows, but the *size* of the IndexSet must be equal.)"));
320 lines.swap (new_lines);
348 m = std::max (m, static_cast<size_type>(
lines[i].entries.size()));
370 return std::binary_search (
lines[rowindex].entries.begin(),
371 lines[rowindex].entries.end(),
398 for (std::vector<size_type>::const_iterator
399 j=
lines[row].entries.begin();
400 j !=
lines[row].entries.end();
411 template <
typename SparsityPatternTypeLeft,
typename SparsityPatternTypeRight>
414 const SparsityPatternTypeLeft &left,
415 const SparsityPatternTypeRight &right)
417 Assert (left.n_cols() == right.n_rows(),
420 this->
reinit(left.n_rows(),right.n_cols());
422 typename SparsityPatternTypeLeft::iterator
423 it_left = left.begin(),
424 end_left = left.end();
425 for (; it_left!=end_left; ++it_left)
427 const unsigned int j = it_left->column();
432 typename SparsityPatternTypeRight::iterator
433 it_right = right.begin(j),
434 end_right = right.end(j);
435 for (; it_right!=end_right; ++it_right)
436 this->
add(it_left->row(),it_right->column());
449 for (std::vector<size_type >::const_iterator
450 j=
lines[row].entries.begin();
451 j !=
lines[row].entries.end(); ++j)
454 out <<
']' << std::endl;
470 for (std::vector<size_type >::const_iterator
471 j=
lines[row].entries.begin();
472 j !=
lines[row].entries.end(); ++j)
479 << -static_cast<signed int>(rowindex)
498 for (std::vector<size_type>::const_iterator
499 j=
lines[row].entries.begin();
500 j !=
lines[row].entries.end(); ++j)
501 if (static_cast<size_type>(std::abs(static_cast<int>(rowindex-*j))) > b)
502 b = std::abs(static_cast<signed int>(rowindex-*j));
519 n +=
lines[i].entries.size();
547 #ifndef DEAL_II_VECTOR_ITERATOR_IS_POINTER 550 std::vector<size_type>::iterator,
567 DEAL_II_NAMESPACE_CLOSE
Iterator lower_bound(Iterator first, Iterator last, const T &val)
std::vector< Line > lines
std::vector< size_type > entries
size_type nth_index_in_set(const unsigned int local_index) const
static ::ExceptionBase & ExcIO()
void add(const size_type i, const size_type j)
size_type max_entries_per_row() const
#define AssertThrow(cond, exc)
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
types::global_dof_index size_type
size_type memory_consumption() const
static ::ExceptionBase & ExcMessage(std::string arg1)
#define Assert(cond, exc)
void add_entries(ForwardIterator begin, ForwardIterator end, const bool indices_are_sorted)
void reinit(const size_type m, const size_type n, const IndexSet &rowset=IndexSet())
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
size_type index_within_set(const size_type global_index) const
void print_gnuplot(std::ostream &out) const
void compute_mmult_pattern(const SparsityPatternTypeLeft &left, const SparsityPatternTypeRight &right)
size_type memory_consumption() const
size_type n_nonzero_elements() const
static ::ExceptionBase & ExcNotQuadratic()
DynamicSparsityPattern & operator=(const DynamicSparsityPattern &)
void print(std::ostream &out) const
bool is_element(const size_type index) const
size_type bandwidth() const
bool exists(const size_type i, const size_type j) const
size_type n_elements() const
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
static ::ExceptionBase & ExcInternalError()