16 #ifndef dealii_block_sparsity_pattern_h
17 #define dealii_block_sparsity_pattern_h
36 template <
typename number>
78 template <
typename SparsityPatternType>
161 SparsityPatternType &
169 const SparsityPatternType &
244 template <
typename ForwardIterator>
247 ForwardIterator
begin,
249 const bool indices_are_sorted =
false);
299 print(std::ostream &out)
const;
324 <<
"The blocks [" << arg1 <<
',' << arg2 <<
"] and [" << arg3
325 <<
',' << arg4 <<
"] have differing row numbers.");
334 <<
"The blocks [" << arg1 <<
',' << arg2 <<
"] and [" << arg3
335 <<
',' << arg4 <<
"] have differing column numbers.");
384 template <
typename number>
439 const std::vector<std::vector<unsigned int>> &row_lengths);
547 const std::vector<size_type> &col_block_sizes);
576 reinit(
const std::vector<size_type> &row_block_sizes,
577 const std::vector<size_type> &col_block_sizes);
584 reinit(
const std::vector<IndexSet> &partitioning);
610 #ifdef DEAL_II_WITH_TRILINOS
663 const std::vector<size_type> &col_block_sizes);
673 const MPI_Comm &communicator = MPI_COMM_WORLD);
687 const std::vector<IndexSet> &row_parallel_partitioning,
688 const std::vector<IndexSet> &column_parallel_partitioning,
689 const std::vector<IndexSet> &writeable_rows,
690 const MPI_Comm & communicator = MPI_COMM_WORLD);
702 reinit(
const std::vector<size_type> &row_block_sizes,
703 const std::vector<size_type> &col_block_sizes);
710 reinit(
const std::vector<IndexSet> ¶llel_partitioning,
711 const MPI_Comm & communicator = MPI_COMM_WORLD);
719 reinit(
const std::vector<IndexSet> &row_parallel_partitioning,
720 const std::vector<IndexSet> &column_parallel_partitioning,
721 const MPI_Comm & communicator = MPI_COMM_WORLD);
732 reinit(
const std::vector<IndexSet> &row_parallel_partitioning,
733 const std::vector<IndexSet> &column_parallel_partitioning,
734 const std::vector<IndexSet> &writeable_rows,
735 const MPI_Comm & communicator = MPI_COMM_WORLD);
753 template <
typename SparsityPatternType>
754 inline SparsityPatternType &
760 return *sub_objects[row][column];
765 template <
typename SparsityPatternType>
766 inline const SparsityPatternType &
773 return *sub_objects[row][column];
778 template <
typename SparsityPatternType>
787 template <
typename SparsityPatternType>
791 return column_indices;
796 template <
typename SparsityPatternType>
804 const std::pair<size_type, size_type> row_index =
805 row_indices.global_to_local(i),
807 column_indices.global_to_local(j);
808 sub_objects[row_index.first][col_index.first]->add(row_index.second,
814 template <
typename SparsityPatternType>
815 template <
typename ForwardIterator>
819 ForwardIterator
begin,
821 const bool indices_are_sorted)
824 if (block_column_indices.size() < this->n_block_cols())
826 block_column_indices.resize(this->n_block_cols());
827 counter_within_block.resize(this->n_block_cols());
842 if (block_column_indices[0].size() < n_cols)
843 for (
size_type i = 0; i < this->n_block_cols(); ++i)
844 block_column_indices[i].resize(n_cols);
848 for (
size_type i = 0; i < this->n_block_cols(); ++i)
849 counter_within_block[i] = 0;
860 for (ForwardIterator it =
begin; it !=
end; ++it)
864 const std::pair<size_type, size_type> col_index =
865 this->column_indices.global_to_local(col);
867 const size_type local_index = counter_within_block[col_index.first]++;
869 block_column_indices[col_index.first][local_index] = col_index.second;
876 for (
size_type i = 0; i < this->n_block_cols(); ++i)
877 length += counter_within_block[i];
886 const std::pair<size_type, size_type> row_index =
887 this->row_indices.global_to_local(row);
888 for (
size_type block_col = 0; block_col < n_block_cols(); ++block_col)
890 if (counter_within_block[block_col] == 0)
892 sub_objects[row_index.first][block_col]->add_entries(
894 block_column_indices[block_col].begin(),
895 block_column_indices[block_col].begin() +
896 counter_within_block[block_col],
903 template <
typename SparsityPatternType>
911 const std::pair<size_type, size_type> row_index =
912 row_indices.global_to_local(i),
914 column_indices.global_to_local(j);
915 return sub_objects[row_index.first][col_index.first]->exists(
916 row_index.second, col_index.second);
921 template <
typename SparsityPatternType>
926 const std::pair<size_type, size_type> row_index =
927 row_indices.global_to_local(row);
932 c += sub_objects[row_index.first][
b]->row_length(row_index.second);
939 template <
typename SparsityPatternType>
948 template <
typename SparsityPatternType>
958 const unsigned int index)
const
961 const std::pair<size_type, size_type> row_index =
970 unsigned int rowlen =
971 sub_objects[row_index.first][
b]->row_length(row_index.second);
972 if (index < c + rowlen)
973 return block_columns +
974 sub_objects[row_index.first][
b]->column_number(row_index.second,
977 block_columns +=
sub_objects[row_index.first][
b]->n_cols();