16 #include <deal.II/base/memory_consumption.h> 18 #include <deal.II/lac/dynamic_sparsity_pattern.h> 19 #include <deal.II/lac/sparsity_pattern.h> 26 DEAL_II_NAMESPACE_OPEN
30 template <
typename ForwardIterator>
34 const bool indices_are_sorted)
36 const int n_elements = end -
begin;
42 if (indices_are_sorted ==
true && n_elements > 3)
50 for (; test1 !=
end; ++test, ++test1)
65 ForwardIterator my_it =
begin;
67 std::vector<size_type>::iterator it =
104 std::vector<size_type>::iterator it2 = it + (end - my_it);
109 while (my_it != end && it2 !=
entries.end())
113 else if (*my_it == *it2)
140 ForwardIterator my_it =
begin;
144 if (stop_size >
entries.capacity())
148 std::vector<size_type>::iterator it, it2;
181 for (; my_it !=
end; ++my_it)
239 "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."));
285 "This operator can only be called if the provided argument " 286 "is the sparsity pattern for an empty matrix. This operator can " 287 "not be used to copy a non-empty sparsity pattern."));
290 ExcMessage(
"This operator can only be called if the current object is" 310 "The IndexSet argument to this function needs to either " 311 "be empty (indicating the complete set of rows), or have size " 312 "equal to the desired number of rows as specified by the " 313 "first argument to this function. (Of course, the number " 314 "of indices in this IndexSet may be less than the number " 315 "of rows, but the *size* of the IndexSet must be equal.)"));
318 lines.swap(new_lines);
332 return ((
rows == 0) && (
cols == 0));
346 m = std::max(m, static_cast<size_type>(
lines[i].entries.size()));
367 return std::binary_search(
lines[rowindex].entries.begin(),
368 lines[rowindex].entries.end(),
395 for (std::vector<size_type>::const_iterator j =
396 lines[row].entries.begin();
397 j !=
lines[row].entries.end();
408 template <
typename SparsityPatternTypeLeft,
typename SparsityPatternTypeRight>
411 const SparsityPatternTypeLeft & left,
412 const SparsityPatternTypeRight &right)
414 Assert(left.n_cols() == right.n_rows(),
417 this->
reinit(left.n_rows(), right.n_cols());
419 typename SparsityPatternTypeLeft::iterator it_left = left.begin(),
420 end_left = left.end();
421 for (; it_left != end_left; ++it_left)
423 const unsigned int j = it_left->column();
429 typename SparsityPatternTypeRight::iterator it_right = right.begin(j),
430 end_right = right.end(j);
431 for (; it_right != end_right; ++it_right)
432 this->
add(it_left->row(), it_right->column());
445 for (std::vector<size_type>::const_iterator j =
446 lines[row].entries.begin();
447 j !=
lines[row].entries.end();
451 out <<
']' << std::endl;
467 for (std::vector<size_type>::const_iterator j =
468 lines[row].entries.begin();
469 j !=
lines[row].entries.end();
476 out << *j <<
" " << -static_cast<signed int>(rowindex) << std::endl;
494 for (std::vector<size_type>::const_iterator j =
495 lines[row].entries.begin();
496 j !=
lines[row].entries.end();
498 if (static_cast<size_type>(std::abs(static_cast<int>(rowindex - *j))) >
500 b = std::abs(static_cast<signed int>(rowindex - *j));
517 n +=
lines[i].entries.size();
545 #ifndef DEAL_II_VECTOR_ITERATOR_IS_POINTER 548 std::vector<size_type>::iterator,
565 DEAL_II_NAMESPACE_CLOSE
Iterator lower_bound(Iterator first, Iterator last, const T &val)
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
static::ExceptionBase & ExcIO()
void add(const size_type i, const size_type j)
void print(std::ostream &out) const
size_type n_elements() const
#define AssertThrow(cond, exc)
static::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
static::ExceptionBase & ExcMessage(std::string arg1)
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())
static::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
size_type max_entries_per_row() const
size_type bandwidth() const
void compute_mmult_pattern(const SparsityPatternTypeLeft &left, const SparsityPatternTypeRight &right)
static::ExceptionBase & ExcNotQuadratic()
types::global_dof_index size_type
DynamicSparsityPattern & operator=(const DynamicSparsityPattern &)
size_type index_within_set(const size_type global_index) const
bool is_element(const size_type index) const
size_type n_nonzero_elements() const
size_type nth_index_in_set(const unsigned int local_index) const
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
static::ExceptionBase & ExcInternalError()