Debian Codegraph @

include/deal.II/matrix_free/dof_info.templates.h

raw
1 // ------------------------------------------------------------------------
2 //
3 // SPDX-License-Identifier: LGPL-2.1-or-later
4 // Copyright (C) 2012 - 2024 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // Part of the source code is dual licensed under Apache-2.0 WITH
9 // LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10 // governing the source code and code contributions can be found in
11 // LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12 //
13 // ------------------------------------------------------------------------
14
15 #ifndef dealii_matrix_free_dof_info_templates_h
16 #define dealii_matrix_free_dof_info_templates_h
17
18
19 #include <deal.II/base/config.h>
20
21 #include <deal.II/base/floating_point_comparator.h>
22 #include <deal.II/base/memory_consumption.h>
23 #include <deal.II/base/parallel.h>
24
25 #include <deal.II/lac/affine_constraints.h>
26
27 #include <deal.II/matrix_free/constraint_info.h>
28 #include <deal.II/matrix_free/dof_info.h>
29 #include <deal.II/matrix_free/hanging_nodes_internal.h>
30 #include <deal.II/matrix_free/task_info.h>
31
32 #include <limits>
33
34 DEAL_II_NAMESPACE_OPEN
35
36 namespace internal
37 {
38 namespace MatrixFreeFunctions
39 {
40 template <typename number>
41 void
42 DoFInfo::read_dof_indices(
43 const std::vector<types::global_dof_index> &local_indices_resolved,
44 const std::vector<types::global_dof_index> &local_indices,
45 const bool cell_has_hanging_nodes,
46 const dealii::AffineConstraints<number> &constraints,
47 const unsigned int cell_number,
48 ConstraintValues<double> &constraint_values,
49 bool &cell_at_subdomain_boundary)
50 {
51 Assert(vector_partitioner.get() != nullptr, ExcInternalError());
52 const types::global_dof_index first_owned =
53 vector_partitioner->local_range().first;
54 const types::global_dof_index last_owned =
55 vector_partitioner->local_range().second;
56 Assert(last_owned - first_owned <
57 std::numeric_limits<unsigned int>::max(),
58 ExcMessage("The size local range of owned indices must not "
59 "exceed the size of unsigned int"));
60 const unsigned int n_owned = last_owned - first_owned;
61
62 Assert(dofs_per_cell.size() == 1 ||
63 cell_number < cell_active_fe_index.size(),
64 ExcInternalError());
65 const unsigned int fe_index =
66 dofs_per_cell.size() == 1 ? 0 : cell_active_fe_index[cell_number];
67 const unsigned int dofs_this_cell = dofs_per_cell[fe_index];
68 const unsigned int n_components = start_components.back();
69 unsigned int i = 0;
70 for (unsigned int comp = 0; comp < n_components; ++comp)
71 {
72 std::pair<unsigned short, unsigned short> constraint_iterator(0, 0);
73 const auto next = component_dof_indices_offset[fe_index][comp + 1];
74 for (; i < next; ++i)
75 {
76 types::global_dof_index current_dof = local_indices_resolved[i];
77 const auto *entries_ptr =
78 constraints.get_constraint_entries(current_dof);
79
80 // dof is constrained
81 if (entries_ptr != nullptr)
82 {
83 // in case we want to access plain indices, we need to know
84 // about the location of constrained indices as well (all the
85 // other indices are collected by the cases below)
86 if (current_dof < first_owned || current_dof >= last_owned)
87 {
88 ghost_dofs.push_back(current_dof);
89 cell_at_subdomain_boundary = true;
90 }
91
92 // check whether this dof is identity constrained to another
93 // dof. then we can simply insert that dof and there is no
94 // need to actually resolve the constraint entries
95 const auto &entries = *entries_ptr;
96 const types::global_dof_index n_entries = entries.size();
97 if (n_entries == 1 &&
98 std::abs(entries[0].second - 1.) <
99 100 * std::numeric_limits<double>::epsilon())
100 {
101 current_dof = entries[0].first;
102 goto no_constraint;
103 }
104
105 // append a new index to the indicators
106 constraint_indicator.push_back(constraint_iterator);
107 constraint_indicator.back().second =
108 constraint_values.insert_entries(entries);
109
110 // reset constraint iterator for next round
111 constraint_iterator.first = 0;
112
113 // add the local_to_global indices computed in the
114 // insert_entries function. transform the index to local index
115 // space or mark it as ghost if necessary
116 if (n_entries > 0)
117 {
118 const std::vector<types::global_dof_index>
119 &constraint_indices =
120 constraint_values.constraint_indices;
121 for (unsigned int j = 0; j < n_entries; ++j)
122 {
123 if (constraint_indices[j] < first_owned ||
124 constraint_indices[j] >= last_owned)
125 {
126 dof_indices.push_back(n_owned +
127 ghost_dofs.size());
128
129 // collect ghosts so that we can later construct
130 // an IndexSet for them. also store whether the
131 // current cell is on the boundary
132 ghost_dofs.push_back(constraint_indices[j]);
133 cell_at_subdomain_boundary = true;
134 }
135 else
136 // not ghost, so transform to the local index space
137 // directly
138 dof_indices.push_back(static_cast<unsigned int>(
139 constraint_indices[j] - first_owned));
140 }
141 }
142 }
143 else
144 {
145 no_constraint:
146 // Not constrained, we simply have to add the local index to
147 // the indices_local_to_global list and increment constraint
148 // iterator. transform to local index space/mark as ghost
149 if (current_dof < first_owned || current_dof >= last_owned)
150 {
151 ghost_dofs.push_back(current_dof);
152 current_dof = n_owned + ghost_dofs.size() - 1;
153 cell_at_subdomain_boundary = true;
154 }
155 else
156 current_dof -= first_owned;
157
158 dof_indices.push_back(static_cast<unsigned int>(current_dof));
159
160 // make sure constraint_iterator.first is always within the
161 // bounds of unsigned short
162 Assert(constraint_iterator.first <
163 (1 << (8 * sizeof(unsigned short))) - 1,
164 ExcInternalError());
165 constraint_iterator.first++;
166 }
167 }
168 row_starts[cell_number * n_components + comp + 1].first =
169 dof_indices.size();
170 row_starts[cell_number * n_components + comp + 1].second =
171 constraint_indicator.size();
172 }
173
174 // now to the plain indices: in case we have constraints on this cell,
175 // store the indices without the constraints resolve once again
176 if (store_plain_indices == true)
177 {
178 if (cell_number == 0)
179 row_starts_plain_indices.resize(
180 (row_starts.size() - 1) / n_components + 1);
181 row_starts_plain_indices[cell_number] = plain_dof_indices.size();
182 const bool cell_has_constraints =
183 cell_has_hanging_nodes ||
184 (row_starts[(cell_number + 1) * n_components].second >
185 row_starts[cell_number * n_components].second);
186 if (cell_has_constraints == true)
187 {
188 for (unsigned int i = 0; i < dofs_this_cell; ++i)
189 {
190 types::global_dof_index current_dof = local_indices[i];
191 if (current_dof < first_owned || current_dof >= last_owned)
192 {
193 ghost_dofs.push_back(current_dof);
194 current_dof = n_owned + ghost_dofs.size() - 1;
195 cell_at_subdomain_boundary = true;
196 }
197 else
198 current_dof -= first_owned;
199 plain_dof_indices.push_back(
200 static_cast<unsigned int>(current_dof));
201 }
202 }
203 }
204 }
205
206
207
208 template <int dim>
209 bool
210 DoFInfo::process_hanging_node_constraints(
211 const HangingNodes<dim> &hanging_nodes,
212 const std::vector<std::vector<unsigned int>> &lexicographic_mapping,
213 const unsigned int cell_number,
214 const TriaIterator<DoFCellAccessor<dim, dim, false>> &cell,
215 std::vector<types::global_dof_index> &dof_indices)
216 {
217 if (this->hanging_node_constraint_masks_comp.empty())
218 return false;
219
220 // 2) determine the refinement configuration of the cell
221 const auto refinement_configuration =
222 hanging_nodes.compute_refinement_configuration(cell);
223
224 if (refinement_configuration == ConstraintKinds::unconstrained)
225 return false;
226
227 // 3) update DoF indices of cell for specified components
228 hanging_nodes.update_dof_indices(cell,
229 {},
230 lexicographic_mapping,
231 hanging_node_constraint_masks_comp,
232 refinement_configuration,
233 dof_indices);
234
235 hanging_node_constraint_masks[cell_number] =
236 compress(refinement_configuration, dim);
237
238 return true;
239 }
240
241
242
243 template <int length>
244 void
245 DoFInfo::compute_face_index_compression(
246 const std::vector<FaceToCellTopology<length>> &faces,
247 const bool hold_all_faces_to_owned_cells)
248 {
249 AssertDimension(length, vectorization_length);
250
251 index_storage_variants[dof_access_face_interior].resize(
252 faces.size(), IndexStorageVariants::full);
253 dof_indices_contiguous[dof_access_face_interior].resize(
254 faces.size() * length, numbers::invalid_unsigned_int);
255 dof_indices_interleave_strides[dof_access_face_interior].resize(
256 faces.size() * length, numbers::invalid_unsigned_int);
257 n_vectorization_lanes_filled[dof_access_face_interior].resize(
258 faces.size());
259
260 // all inner faces come before the boundary faces
261 unsigned int n_inner_faces = 0;
262 for (; n_inner_faces < faces.size(); ++n_inner_faces)
263 if (faces[n_inner_faces].cells_exterior[0] ==
264 numbers::invalid_unsigned_int)
265 break;
266
267 // all boundary faces come after the inner faces and before the ghosted
268 // inner faces
269 unsigned int n_boundary_faces = 0;
270 for (; n_inner_faces + n_boundary_faces < faces.size();
271 ++n_boundary_faces)
272 if (faces[n_inner_faces + n_boundary_faces].cells_exterior[0] !=
273 numbers::invalid_unsigned_int)
274 break;
275
276 const unsigned int size_exterior_faces =
277 hold_all_faces_to_owned_cells ? faces.size() : n_inner_faces;
278
279 index_storage_variants[dof_access_face_exterior].resize(
280 size_exterior_faces, IndexStorageVariants::full);
281 dof_indices_contiguous[dof_access_face_exterior].resize(
282 size_exterior_faces * length, numbers::invalid_unsigned_int);
283 dof_indices_interleave_strides[dof_access_face_exterior].resize(
284 faces.size() * length, numbers::invalid_unsigned_int);
285 n_vectorization_lanes_filled[dof_access_face_exterior].resize(
286 size_exterior_faces);
287
288 for (unsigned int face = 0; face < faces.size(); ++face)
289 {
290 auto face_computation = [&](const DoFAccessIndex face_index,
291 const std::array<unsigned int, length>
292 &cell_indices_face) {
293 bool is_contiguous = false;
294 bool is_interleaved = false;
295 bool needs_full_storage = false;
296 for (unsigned int v = 0;
297 v < length &&
298 cell_indices_face[v] != numbers::invalid_unsigned_int;
299 ++v)
300 {
301 n_vectorization_lanes_filled[face_index][face]++;
302 if (index_storage_variants[dof_access_cell]
303 [cell_indices_face[v] / length] >=
304 IndexStorageVariants::interleaved_contiguous)
305 is_interleaved = true;
306 if (index_storage_variants[dof_access_cell]
307 [cell_indices_face[v] / length] ==
308 IndexStorageVariants::contiguous)
309 is_contiguous = true;
310 if (index_storage_variants[dof_access_cell]
311 [cell_indices_face[v] / length] >=
312 IndexStorageVariants::contiguous)
313 dof_indices_interleave_strides[face_index][face * length +
314 v] =
315 dof_indices_interleave_strides[dof_access_cell]
316 [cell_indices_face[v]];
317 if (index_storage_variants[dof_access_cell]
318 [cell_indices_face[v] / length] <
319 IndexStorageVariants::contiguous)
320 needs_full_storage = true;
321 }
322 Assert(!(is_interleaved && is_contiguous),
323 ExcMessage("Unsupported index compression found"));
324
325 if (is_interleaved || is_contiguous)
326 for (unsigned int v = 0;
327 v < n_vectorization_lanes_filled[face_index][face];
328 ++v)
329 dof_indices_contiguous[face_index][face * length + v] =
330 dof_indices_contiguous[dof_access_cell][cell_indices_face[v]];
331 if (is_interleaved)
332 {
333 bool is_also_contiguous =
334 n_vectorization_lanes_filled[face_index][face] == length;
335 for (unsigned int v = 0;
336 v < n_vectorization_lanes_filled[face_index][face];
337 ++v)
338 if (dof_indices_contiguous[face_index][face * length + v] !=
339 dof_indices_contiguous[face_index][face * length] + v ||
340 dof_indices_interleave_strides[dof_access_cell]
341 [cell_indices_face[v]] !=
342 length)
343 is_also_contiguous = false;
344
345 if (is_also_contiguous)
346 {
347 index_storage_variants[face_index][face] =
348 IndexStorageVariants::interleaved_contiguous;
349 }
350 else
351 {
352 bool all_indices_same_offset =
353 n_vectorization_lanes_filled[face_index][face] == length;
354 for (unsigned int v = 0;
355 v < n_vectorization_lanes_filled[face_index][face];
356 ++v)
357 if (dof_indices_interleave_strides
358 [dof_access_cell][cell_indices_face[v]] != length)
359 all_indices_same_offset = false;
360 if (all_indices_same_offset)
361 index_storage_variants[face_index][face] =
362 IndexStorageVariants::interleaved_contiguous_strided;
363 else
364 index_storage_variants[face_index][face] =
365 IndexStorageVariants::
366 interleaved_contiguous_mixed_strides;
367 }
368 }
369 else if (is_contiguous && !needs_full_storage)
370 index_storage_variants[face_index][face] =
371 IndexStorageVariants::contiguous;
372 else
373 index_storage_variants[face_index][face] =
374 IndexStorageVariants::full;
375 };
376
377 face_computation(dof_access_face_interior,
378 faces[face].cells_interior);
379 if (face < n_inner_faces ||
380 (hold_all_faces_to_owned_cells &&
381 face >= (n_inner_faces + n_boundary_faces)))
382 face_computation(dof_access_face_exterior,
383 faces[face].cells_exterior);
384 }
385 }
386
387
388
389 template <int length>
390 void
391 DoFInfo::compute_vector_zero_access_pattern(
392 const TaskInfo &task_info,
393 const std::vector<FaceToCellTopology<length>> &faces)
394 {
395 // compute a list that tells us the first time a degree of freedom is
396 // touched by a cell
397 AssertDimension(length, vectorization_length);
398 const unsigned int n_components = start_components.back();
399 const unsigned int n_dofs = vector_partitioner->locally_owned_size() +
400 vector_partitioner->n_ghost_indices();
401 std::vector<unsigned int> touched_first_by(
402 (n_dofs + chunk_size_zero_vector - 1) / chunk_size_zero_vector,
403 numbers::invalid_unsigned_int);
404 std::vector<unsigned int> touched_last_by(
405 (n_dofs + chunk_size_zero_vector - 1) / chunk_size_zero_vector,
406 numbers::invalid_unsigned_int);
407 std::vector<unsigned int> cells_in_interval;
408 for (unsigned int part = 0;
409 part < task_info.partition_row_index.size() - 2;
410 ++part)
411 for (unsigned int chunk = task_info.partition_row_index[part];
412 chunk < task_info.partition_row_index[part + 1];
413 ++chunk)
414 {
415 cells_in_interval.clear();
416 for (unsigned int cell = task_info.cell_partition_data[chunk];
417 cell < task_info.cell_partition_data[chunk + 1];
418 ++cell)
419 for (unsigned int v = 0; v < vectorization_length; ++v)
420 cells_in_interval.push_back(cell * vectorization_length + v);
421 if (faces.size() > 0)
422 {
423 for (unsigned int face = task_info.face_partition_data[chunk];
424 face < task_info.face_partition_data[chunk + 1];
425 ++face)
426 for (unsigned int v = 0; v < vectorization_length; ++v)
427 {
428 if (faces[face].cells_interior[v] !=
429 numbers::invalid_unsigned_int)
430 cells_in_interval.push_back(
431 faces[face].cells_interior[v]);
432 if (faces[face].cells_exterior[v] !=
433 numbers::invalid_unsigned_int)
434 cells_in_interval.push_back(
435 faces[face].cells_exterior[v]);
436 }
437 for (unsigned int face =
438 task_info.boundary_partition_data[chunk];
439 face < task_info.boundary_partition_data[chunk + 1];
440 ++face)
441 for (unsigned int v = 0; v < vectorization_length; ++v)
442 if (faces[face].cells_interior[v] !=
443 numbers::invalid_unsigned_int)
444 cells_in_interval.push_back(
445 faces[face].cells_interior[v]);
446 }
447 std::sort(cells_in_interval.begin(), cells_in_interval.end());
448 cells_in_interval.erase(std::unique(cells_in_interval.begin(),
449 cells_in_interval.end()),
450 cells_in_interval.end());
451
452 for (const unsigned int cell : cells_in_interval)
453 {
454 for (unsigned int it = row_starts[cell * n_components].first;
455 it != row_starts[(cell + 1) * n_components].first;
456 ++it)
457 {
458 const unsigned int myindex =
459 dof_indices[it] / chunk_size_zero_vector;
460 if (touched_first_by[myindex] ==
461 numbers::invalid_unsigned_int)
462 touched_first_by[myindex] = chunk;
463 touched_last_by[myindex] = chunk;
464 }
465 }
466 }
467
468 // ensure that all indices are touched at least during the last round
469 for (auto &index : touched_first_by)
470 if (index == numbers::invalid_unsigned_int)
471 index =
472 task_info
473 .partition_row_index[task_info.partition_row_index.size() - 2] -
474 1;
475
476 // lambda to convert from a map, with keys associated to the buckets by
477 // which we sliced the index space, length chunk_size_zero_vector, and
478 // values equal to the slice index which are touched by the respective
479 // partition, to a "vectors-of-vectors" like data structure. Rather than
480 // using the vectors, we set up a sparsity-pattern like structure where
481 // one index specifies the start index (range_list_index), and the other
482 // the actual ranges (range_list).
483 auto convert_map_to_range_list =
484 [=](const unsigned int n_partitions,
485 const std::map<unsigned int, std::vector<unsigned int>> &ranges_in,
486 std::vector<unsigned int> &range_list_index,
487 std::vector<std::pair<unsigned int, unsigned int>> &range_list,
488 const unsigned int max_size) {
489 range_list_index.resize(n_partitions + 1);
490 range_list_index[0] = 0;
491 range_list.clear();
492 for (unsigned int partition = 0; partition < n_partitions;
493 ++partition)
494 {
495 auto it = ranges_in.find(partition);
496 if (it != ranges_in.end())
497 {
498 for (unsigned int i = 0; i < it->second.size(); ++i)
499 {
500 const unsigned int first_i = i;
501 while (i + 1 < it->second.size() &&
502 it->second[i + 1] == it->second[i] + 1)
503 ++i;
504 range_list.emplace_back(
505 std::min(it->second[first_i] * chunk_size_zero_vector,
506 max_size),
507 std::min((it->second[i] + 1) * chunk_size_zero_vector,
508 max_size));
509 }
510 range_list_index[partition + 1] = range_list.size();
511 }
512 else
513 range_list_index[partition + 1] = range_list_index[partition];
514 }
515 };
516
517 // first we determine the ranges to zero the vector
518 std::map<unsigned int, std::vector<unsigned int>> chunk_must_zero_vector;
519 for (unsigned int i = 0; i < touched_first_by.size(); ++i)
520 chunk_must_zero_vector[touched_first_by[i]].push_back(i);
521 const unsigned int n_partitions =
522 task_info.partition_row_index[task_info.partition_row_index.size() - 2];
523 convert_map_to_range_list(n_partitions,
524 chunk_must_zero_vector,
525 vector_zero_range_list_index,
526 vector_zero_range_list,
527 vector_partitioner->locally_owned_size());
528
529 // the other two operations only work on the local range (without
530 // ghosts), so we skip the latter parts of the vector now
531 touched_first_by.resize((vector_partitioner->locally_owned_size() +
532 chunk_size_zero_vector - 1) /
533 chunk_size_zero_vector);
534
535 // set the import indices in the vector partitioner to one index higher
536 // to indicate that we want to process it first. This additional index
537 // is reflected in the argument 'n_partitions+1' in the
538 // convert_map_to_range_list function below.
539 for (auto it : vector_partitioner->import_indices())
540 for (unsigned int i = it.first; i < it.second; ++i)
541 touched_first_by[i / chunk_size_zero_vector] = n_partitions;
542 std::map<unsigned int, std::vector<unsigned int>> chunk_must_do_pre;
543 for (unsigned int i = 0; i < touched_first_by.size(); ++i)
544 chunk_must_do_pre[touched_first_by[i]].push_back(i);
545 convert_map_to_range_list(n_partitions + 1,
546 chunk_must_do_pre,
547 cell_loop_pre_list_index,
548 cell_loop_pre_list,
549 vector_partitioner->locally_owned_size());
550
551 touched_last_by.resize((vector_partitioner->locally_owned_size() +
552 chunk_size_zero_vector - 1) /
553 chunk_size_zero_vector);
554
555 // set the indices which were not touched by the cell loop (i.e.,
556 // constrained indices) to the last valid partition index. Since
557 // partition_row_index contains one extra slot for ghosted faces (which
558 // are not part of the cell/face loops), we use the second to last entry
559 // in the partition list.
560 for (auto &index : touched_last_by)
561 if (index == numbers::invalid_unsigned_int)
562 index =
563 task_info
564 .partition_row_index[task_info.partition_row_index.size() - 2] -
565 1;
566 for (auto it : vector_partitioner->import_indices())
567 for (unsigned int i = it.first; i < it.second; ++i)
568 touched_last_by[i / chunk_size_zero_vector] = n_partitions;
569 std::map<unsigned int, std::vector<unsigned int>> chunk_must_do_post;
570 for (unsigned int i = 0; i < touched_last_by.size(); ++i)
571 chunk_must_do_post[touched_last_by[i]].push_back(i);
572 convert_map_to_range_list(n_partitions + 1,
573 chunk_must_do_post,
574 cell_loop_post_list_index,
575 cell_loop_post_list,
576 vector_partitioner->locally_owned_size());
577 }
578
579
580
581 namespace internal
582 {
583 // rudimentary version of a vector that keeps entries always ordered
584 class ordered_vector : public std::vector<types::global_dof_index>
585 {
586 public:
587 ordered_vector()
588 {
589 reserve(2000);
590 }
591
592 void
593 reserve(const std::size_t size)
594 {
595 if (size > 0)
596 this->std::vector<types::global_dof_index>::reserve(size);
597 }
598
599
600 // insert a given entry. dat is a pointer within this vector (the user
601 // needs to make sure that it really stays there)
602 void
603 insert(const unsigned int entry,
604 std::vector<types::global_dof_index>::iterator &dat)
605 {
606 AssertIndexRange(static_cast<std::size_t>(dat - begin()), size() + 1);
607 AssertIndexRange(static_cast<std::size_t>(end() - dat), size() + 1);
608 AssertIndexRange(size(), capacity());
609 while (dat != end() && *dat < entry)
610 ++dat;
611
612 if (dat == end())
613 {
614 push_back(entry);
615 dat = end();
616 }
617 else if (*dat > entry)
618 {
619 dat =
620 this->std::vector<types::global_dof_index>::insert(dat, entry);
621 ++dat;
622 }
623 else
624 ++dat;
625 }
626 };
627 } // namespace internal
628
629
630
631 template <typename StreamType>
632 void
633 DoFInfo::print_memory_consumption(StreamType &out,
634 const TaskInfo &task_info) const
635 {
636 out << " Memory row starts indices: ";
637 task_info.print_memory_statistics(out,
638 (row_starts.capacity() *
639 sizeof(*row_starts.begin())));
640 out << " Memory dof indices: ";
641 task_info.print_memory_statistics(
642 out, MemoryConsumption::memory_consumption(dof_indices));
643 out << " Memory constraint indicators: ";
644 task_info.print_memory_statistics(
645 out, MemoryConsumption::memory_consumption(constraint_indicator));
646 out << " Memory plain indices: ";
647 task_info.print_memory_statistics(
648 out,
649 MemoryConsumption::memory_consumption(row_starts_plain_indices) +
650 MemoryConsumption::memory_consumption(plain_dof_indices));
651 out << " Memory vector partitioner: ";
652 task_info.print_memory_statistics(
653 out, MemoryConsumption::memory_consumption(*vector_partitioner));
654 }
655
656
657
658 template <typename Number>
659 void
660 DoFInfo::print(const std::vector<Number> &constraint_pool_data,
661 const std::vector<unsigned int> &constraint_pool_row_index,
662 std::ostream &out) const
663 {
664 const unsigned int n_rows = row_starts.size() - 1;
665 for (unsigned int row = 0; row < n_rows; ++row)
666 {
667 if (row_starts[row].first == row_starts[row + 1].first)
668 continue;
669 out << "Entries row " << row << ": ";
670 const unsigned int *glob_indices =
671 &dof_indices[row_starts[row].first],
672 *end_row = &dof_indices[row_starts[row + 1].first];
673 unsigned int index = 0;
674 const std::pair<unsigned short, unsigned short>
675 *con_it = &constraint_indicator[row_starts[row].second],
676 *end_con = &constraint_indicator[row_starts[row + 1].second];
677 for (; con_it != end_con; ++con_it)
678 {
679 for (unsigned int j = 0; j < con_it->first; ++j, ++index)
680 {
681 Assert(glob_indices + index != end_row, ExcInternalError());
682 out << glob_indices[index] << ' ';
683 }
684
685 out << "[ ";
686 for (unsigned int k = constraint_pool_row_index[con_it->second];
687 k < constraint_pool_row_index[con_it->second + 1];
688 k++, index++)
689 {
690 Assert(glob_indices + index != end_row, ExcInternalError());
691 out << glob_indices[index] << '/' << constraint_pool_data[k]
692 << ' ';
693 }
694 out << "] ";
695 }
696 glob_indices += index;
697 for (; glob_indices != end_row; ++glob_indices)
698 out << *glob_indices << ' ';
699 out << std::endl;
700 }
701 }
702
703
704 } // namespace MatrixFreeFunctions
705 } // end of namespace internal
706
707 DEAL_II_NAMESPACE_CLOSE
708
709 #endif