-----------------------------------------------------------------------------
| 140 | } |
| 141 | //----------------------------------------------------------------------------- |
| 142 | void SparsityPattern::insert(std::int32_t row, std::int32_t col) |
| 143 | { |
| 144 | if (!_offsets.empty()) |
| 145 | { |
| 146 | throw std::runtime_error( |
| 147 | "Cannot insert into sparsity pattern. It has already been finalized"); |
| 148 | } |
| 149 | |
| 150 | assert(_index_maps[0]); |
| 151 | const std::int32_t max_row |
| 152 | = _index_maps[0]->size_local() + _index_maps[0]->num_ghosts() - 1; |
| 153 | |
| 154 | if (row > max_row or row < 0) |
| 155 | { |
| 156 | throw std::runtime_error( |
| 157 | "Cannot insert rows that do not exist in the IndexMap."); |
| 158 | } |
| 159 | |
| 160 | _row_cache[row].push_back(col); |
| 161 | } |
| 162 | //----------------------------------------------------------------------------- |
| 163 | void SparsityPattern::insert(std::span<const std::int32_t> rows, |
| 164 | std::span<const std::int32_t> cols) |