Debian Codegraph @

include/deal.II/matrix_free/dof_info.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
16 #ifndef dealii_matrix_free_dof_info_h
17 #define dealii_matrix_free_dof_info_h
18
19
20 #include <deal.II/base/config.h>
21
22 #include <deal.II/base/exceptions.h>
23 #include <deal.II/base/vectorization.h>
24
25 #include <deal.II/matrix_free/face_info.h>
26 #include <deal.II/matrix_free/shape_info.h>
27
28 #include <array>
29 #include <memory>
30
31
32 DEAL_II_NAMESPACE_OPEN
33
34 #ifndef DOXYGEN
35
36 // forward declarations
37
38 namespace internal
39 {
40 namespace MatrixFreeFunctions
41 {
42 template <int dim>
43 class HangingNodes;
44
45 struct TaskInfo;
46
47 template <typename Number>
48 struct ConstraintValues;
49
50 namespace VectorDataExchange
51 {
52 class Base;
53 }
54 } // namespace MatrixFreeFunctions
55 } // namespace internal
56
57 template <typename>
58 class AffineConstraints;
59
60 class DynamicSparsityPattern;
61
62 template <typename>
63 class TriaIterator;
64
65 template <int, int, bool>
66 class DoFCellAccessor;
67
68 namespace Utilities
69 {
70 namespace MPI
71 {
72 class Partitioner;
73 }
74 } // namespace Utilities
75
76 #endif
77
78 namespace internal
79 {
80 namespace MatrixFreeFunctions
81 {
82 /**
83 * Type of the 8-bit representation of the refinement configuration that
84 * is in hanging_nodes_internal.h.
85 */
86 using compressed_constraint_kind = std::uint8_t;
87
88 /**
89 * The class that stores the indices of the degrees of freedom for all the
90 * cells. Essentially, this is a smart number cache in the style of a
91 * DoFHandler that also embeds the description of constraints directly on
92 * the cell level without the need to refer to the external
93 * AffineConstraints object.
94 *
95 * This class only stores index relations. The weights for hanging node
96 * constraints are stored in a different field. This is because a
97 * different field allows for the same compressed weight data on different
98 * DoFHandlers for vector-valued problems. There, the indices might be
99 * constrained differently on different components (e.g. Dirichlet
100 * conditions only on selected components), whereas the weights from
101 * hanging nodes are the same and need to be stored only once. The
102 * combination will be handled in the MatrixFree class.
103 *
104 * @ingroup matrixfree
105 */
106 struct DoFInfo
107 {
108 /**
109 * This value is used to define subranges in the vectors which we can
110 * zero inside the MatrixFree::loop() call. The goal is to only clear a
111 * part of the vector at a time to keep the values that are zeroed in
112 * caches, saving one global vector access for the case where this is
113 * applied rather than `vector = 0.;`.
114 *
115 * We set the granularity to 64 - that is a number sufficiently large
116 * to minimize loop peel overhead within the work (and compatible with
117 * vectorization lengths of up to 16) and small enough to not waste on
118 * the size of the individual chunks.
119 */
120 static const unsigned int chunk_size_zero_vector = 64;
121
122 /**
123 * Default empty constructor.
124 */
125 DoFInfo();
126
127 /**
128 * Copy constructor.
129 */
130 DoFInfo(const DoFInfo &) = default;
131
132 /**
133 * Move constructor.
134 */
135 DoFInfo(DoFInfo &&) noexcept = default;
136
137 /**
138 * Destructor.
139 */
140 ~DoFInfo() = default;
141
142 /**
143 * Copy assignment operator.
144 */
145 DoFInfo &
146 operator=(const DoFInfo &) = default;
147
148 /**
149 * Move assignment operator.
150 */
151 DoFInfo &
152 operator=(DoFInfo &&) noexcept = default;
153
154 /**
155 * Clear all data fields in this class.
156 */
157 void
158 clear();
159
160 /**
161 * Return the FE index for a given finite element degree. If not in
162 * hp-mode, this function always returns index 0. If an index is not found
163 * in hp-mode, it returns numbers::invalid_unsigned_int.
164 */
165 unsigned int
166 fe_index_from_degree(const unsigned int first_selected_component,
167 const unsigned int fe_degree) const;
168
169 /**
170 * Populate the vector @p local_indices with locally owned degrees of freedom
171 * stored on the cell batch @p cell_batch.
172 * If @p with_constraints is `true`, then the returned vector will contain indices
173 * required to resolve constraints.
174 *
175 * The image below illustrates the output of this function for cell blocks
176 * zero and one with zero Dirichlet boundary conditions at the bottom of
177 * the domain. Note that due to the presence of constraints, the DoFs
178 * returned by this function for the case `with_constraints = true` are
179 * not a simple union
180 * of per cell DoFs on the cell block @p cell.
181 *
182 * @image html dofinfo_get_dof_indices.png
183 *
184 * @note The returned indices may contain duplicates. The unique set can be
185 * obtain using `std::sort()` followed by `std::unique()` and
186 * `std::vector::erase()`.
187 */
188 void
189 get_dof_indices_on_cell_batch(std::vector<unsigned int> &local_indices,
190 const unsigned int cell_batch,
191 const bool with_constraints = true) const;
192
193 /**
194 * This internal method takes the local indices on a cell (two versions:
195 * hanging-node constraints resolved if possible and plain, i.e., not
196 * resolved) and fills them into this class. It resolves the constraints
197 * and distributes the results. Ghost indices, i.e., indices that are
198 * located on another processor, get a temporary number by this function,
199 * and will later be assigned the correct index after all the ghost
200 * indices have been collected by the call to @p assign_ghosts.
201 */
202 template <typename number>
203 void
204 read_dof_indices(
205 const std::vector<types::global_dof_index> &local_indices_resolved,
206 const std::vector<types::global_dof_index> &local_indices,
207 const bool cell_has_hanging_nodes,
208 const dealii::AffineConstraints<number> &constraints,
209 const unsigned int cell_number,
210 ConstraintValues<double> &constraint_values,
211 bool &cell_at_boundary);
212
213 /**
214 * For a given cell, determine if it has hanging node constraints. If yes,
215 * adjust the dof indices, store the mask, and return true as indication.
216 */
217 template <int dim>
218 bool
219 process_hanging_node_constraints(
220 const HangingNodes<dim> &hanging_nodes,
221 const std::vector<std::vector<unsigned int>> &lexicographic_mapping,
222 const unsigned int cell_number,
223 const TriaIterator<DoFCellAccessor<dim, dim, false>> &cell,
224 std::vector<types::global_dof_index> &dof_indices);
225
226 /**
227 * This method assigns the correct indices to ghost indices from the
228 * temporary numbering employed by the @p read_dof_indices function. The
229 * numbers are localized with respect to the MPI process, and ghosts
230 * start at the end of the locally owned range. This way, we get direct
231 * access to all vector entries.
232 */
233 void
234 assign_ghosts(const std::vector<unsigned int> &boundary_cells,
235 const MPI_Comm communicator_sm,
236 const bool use_vector_data_exchanger_full);
237
238 /**
239 * This method reorders the way cells are gone through based on a given
240 * renumbering of the cells. It also takes @p vectorization_length cells
241 * together and interprets them as one cell only, as is needed for
242 * vectorization.
243 */
244 void
245 reorder_cells(const TaskInfo &task_info,
246 const std::vector<unsigned int> &renumbering,
247 const std::vector<unsigned int> &constraint_pool_row_index,
248 const std::vector<unsigned char> &irregular_cells);
249
250 /**
251 * Finds possible compression for the cell indices that we can apply for
252 * increased efficiency. Run at the end of reorder_cells.
253 */
254 void
255 compute_cell_index_compression(
256 const std::vector<unsigned char> &irregular_cells);
257
258 /**
259 * Finds possible compression for the face indices that we can apply for
260 * increased efficiency. Run at the end of reorder_cells.
261 */
262 template <int length>
263 void
264 compute_face_index_compression(
265 const std::vector<FaceToCellTopology<length>> &faces,
266 bool hold_all_faces_to_owned_cells);
267
268 /**
269 * This function computes the connectivity of the currently stored
270 * indices in terms of connections between the individual cells and
271 * fills the structure into a sparsity pattern.
272 */
273 void
274 make_connectivity_graph(const TaskInfo &task_info,
275 const std::vector<unsigned int> &renumbering,
276 DynamicSparsityPattern &connectivity) const;
277
278 /**
279 * In case face integrals are enabled, find out whether certain loops
280 * over the unknowns only access a subset of all the ghost dofs we keep
281 * in the main partitioner.
282 */
283 void
284 compute_tight_partitioners(
285 const Table<2, ShapeInfo<double>> &shape_info,
286 const unsigned int n_owned_cells,
287 const unsigned int n_lanes,
288 const std::vector<FaceToCellTopology<1>> &inner_faces,
289 const std::vector<FaceToCellTopology<1>> &ghosted_faces,
290 const bool fill_cell_centric,
291 const MPI_Comm communicator_sm,
292 const bool use_vector_data_exchanger_full);
293
294 /**
295 * Given @p cell_indices_contiguous_sm containing the local index of
296 * cells of face batches (inner/outer) and cell batches compute
297 * dof_indices_contiguous_sm.
298 */
299 void
300 compute_shared_memory_contiguous_indices(
301 std::array<std::vector<std::pair<unsigned int, unsigned int>>, 3>
302 &cell_indices_contiguous_sm);
303
304 /**
305 * Compute a renumbering of the degrees of freedom to improve the data
306 * access patterns for this class that can be utilized by the categories
307 * in the IndexStorageVariants enum. For example, the index ordering can
308 * be improved for typical DG elements by interleaving the degrees of
309 * freedom from batches of cells, which avoids the explicit data
310 * transposition in IndexStorageVariants::contiguous. Currently, these
311 * more advanced features are not implemented, so there is only limited
312 * value of this function.
313 */
314 void
315 compute_dof_renumbering(
316 std::vector<types::global_dof_index> &renumbering);
317
318 /**
319 * Fills the array that defines how to zero selected ranges in the result
320 * vector within the cell loop, filling the two member variables @p
321 * vector_zero_range_list_index and @p vector_zero_range_list.
322 *
323 * The intent of this pattern is to zero the vector entries in close
324 * temporal proximity to the first access and thus keeping the vector
325 * entries in cache.
326 */
327 template <int length>
328 void
329 compute_vector_zero_access_pattern(
330 const TaskInfo &task_info,
331 const std::vector<FaceToCellTopology<length>> &faces);
332
333 /**
334 * Return the memory consumption in bytes of this class.
335 */
336 std::size_t
337 memory_consumption() const;
338
339 /**
340 * Prints a detailed summary of memory consumption in the different
341 * structures of this class to the given output stream.
342 */
343 template <typename StreamType>
344 void
345 print_memory_consumption(StreamType &out,
346 const TaskInfo &size_info) const;
347
348 /**
349 * Prints a representation of the indices in the class to the given
350 * output stream.
351 */
352 template <typename Number>
353 void
354 print(const std::vector<Number> &constraint_pool_data,
355 const std::vector<unsigned int> &constraint_pool_row_index,
356 std::ostream &out) const;
357
358 /**
359 * Enum for various storage variants of the indices. This storage format
360 * is used to implement more efficient indexing schemes in case the
361 * underlying data structures allow for them, and to inform the access
362 * functions in FEEvaluationBase::read_write_operation() on which array
363 * to get the data from. One example of more efficient storage is the
364 * enum value IndexStorageVariants::contiguous, which means that one can
365 * get the indices to all degrees of freedom of a cell by reading only
366 * the first index for each cell, whereas all subsequent indices are
367 * merely an offset from the first index.
368 */
369 enum class IndexStorageVariants : unsigned char
370 {
371 /**
372 * This value indicates that no index compression was found and the
373 * only valid storage is to access all indices present on the cell,
374 * possibly including constraints. For a cell/face of this index type,
375 * the data access in FEEvaluationBase is directed to the array @p
376 * dof_indices with the index
377 * `row_starts[cell_index*n_vectorization*n_components].first`.
378 */
379 full,
380 /**
381 * This value indicates that the indices are interleaved for access
382 * with vectorized gather and scatter operation. This storage variant
383 * is possible in case there are no constraints on the cell and the
384 * indices in the batch of cells are not pointing to the same global
385 * index in different slots of a vectorized array (in order to support
386 * scatter operations). For a cell/face of this index type, the data
387 * access in FEEvaluationBase is directed to the array
388 * `dof_indices_interleaved` with the index
389 * `row_starts[cell_index*n_vectorization*n_components].first`.
390 */
391 interleaved,
392 /**
393 * This value indicates that the indices within a cell are all
394 * contiguous, and one can get the index to the cell by reading that
395 * single value for each of the cells in the cell batch. For a
396 * cell/face of this index type, the data access in FEEvaluationBase
397 * is directed to the array `dof_indices_contiguous` with the index
398 * `cell_index*n_vectorization*n_components`.
399 */
400 contiguous,
401 /**
402 * This value indicates that the indices with a cell are contiguous and
403 * interleaved for vectorization, i.e., the first DoF index on a cell
404 * to the four or eight cells in the vectorization batch come first,
405 * than the second DoF index, and so on. Furthermore, the interleaving
406 * between cells implies that only the batches for vectorization can be
407 * accessed efficiently, whereas there is a strided access for getting
408 * only some of the entries.
409 *
410 * The two additional categories `interleaved_contiguous_strided` and
411 * `interleaved_contiguous_mixed_strides` are a consequence of this
412 * storage type. The former is for faces where at least one of the two
413 * adjacent sides will break with the interleaved storage. We then have
414 * to make a strided access as described in the next category. The last
415 * category `interleaved_contiguous_mixed_strides` appears in the ghost
416 * layer, see the more detailed description of that category below.
417 * Again, this is something that cannot be avoided in general once we
418 * interleave the indices between cells.
419 *
420 * For a cell/face of this index type, the data access in
421 * FEEvaluationBase is directed to the array `dof_indices_contiguous`
422 * with the index `cell_index*n_vectorization*n_components`.
423 */
424 interleaved_contiguous,
425 /**
426 * Similar to interleaved_contiguous storage, but for the case when the
427 * interleaved indices are only contiguous within the degrees of
428 * freedom, but not also over the components of a vectorized array.
429 * This happens typically on faces with DG where the cells have
430 * `interleaved_contiguous` storage but the faces' numbering is not the
431 * same as the cell's numbering. For a
432 * cell/face of this index type, the data access in FEEvaluationBase
433 * is directed to the array `dof_indices_contiguous` with the index
434 * `cell_index*n_vectorization*n_components`.
435 */
436 interleaved_contiguous_strided,
437 /**
438 * Similar to interleaved_contiguous_separate storage, but for the case
439 * when the interleaved indices are not `n_vectorization apart`. This
440 * happens typically within the ghost layer of DG where the remote
441 * owner has applied an interleaved storage and the current processor
442 * only sees some of the cells. For a
443 * cell/face of this index type, the data access in FEEvaluationBase
444 * is directed to the array `dof_indices_contiguous` with the index
445 * `cell_index*n_vectorization*n_components`, including the array
446 * `dof_indices_interleave_strides` for the information about the
447 * actual stride.
448 */
449 interleaved_contiguous_mixed_strides
450 };
451
452 /**
453 * Enum used to distinguish the data arrays for the vectorization type
454 * in cells and faces.
455 */
456 enum DoFAccessIndex : unsigned char
457 {
458 /**
459 * The data index for the faces designated as interior
460 */
461 dof_access_face_interior = 0,
462 /**
463 * The data index for the faces designated as exterior
464 */
465 dof_access_face_exterior = 1,
466 /**
467 * The data index for the cells
468 */
469 dof_access_cell = 2
470 };
471
472 /**
473 * For efficiency reasons, always keep a fixed number of cells with
474 * similar properties together. This variable controls the number of
475 * cells batched together. As opposed to the other classes which are
476 * templated on the number type, this class as a pure index container is
477 * not templated, so we need to keep the information otherwise contained
478 * in VectorizedArrayType::size().
479 */
480 unsigned int vectorization_length;
481
482 /**
483 * Stores the index storage variant of all cell and face batches.
484 *
485 * The three arrays given here address the types for the faces decorated
486 * as interior (0), the faces decorated with as exterior (1), and the
487 * cells (2) according to CellOrFaceAccess.
488 */
489 std::array<std::vector<IndexStorageVariants>, 3> index_storage_variants;
490
491 /**
492 * Stores the rowstart indices of the compressed row storage in the @p
493 * dof_indices and @p constraint_indicator fields. These two fields are
494 * always accessed together, so it is simpler to keep just one variable
495 * for them. This also obviates keeping two rowstart vectors in sync.
496 */
497 std::vector<std::pair<unsigned int, unsigned int>> row_starts;
498
499 /**
500 * Stores the indices of the degrees of freedom for each cell. These
501 * indices are computed in MPI-local index space, i.e., each processor
502 * stores the locally owned indices as numbers between <tt>0</tt> and
503 * <tt>n_locally_owned_dofs-1</tt> and ghost indices in the range
504 * <tt>n_locally_owned_dofs</tt> to
505 * <tt>n_locally_owned_dofs+n_ghost_dofs</tt>. The translation between
506 * this MPI-local index space and the global numbering of degrees of
507 * freedom is stored in the @p vector_partitioner data structure. This
508 * array also includes the indirect contributions from constraints,
509 * which are described by the @p constraint_indicator field. Because of
510 * variable lengths of rows, this would be a vector of a vector.
511 * However, we use one contiguous memory region and store the rowstart
512 * in the variable @p row_starts.
513 */
514 std::vector<unsigned int> dof_indices;
515
516 /**
517 * Supported components of all entries of the hp::FECollection object of
518 * the given DoFHandler.
519 */
520 std::vector<std::vector<bool>> hanging_node_constraint_masks_comp;
521
522 /**
523 * Masks indicating for each cell and component if the optimized
524 * hanging-node constraint is applicable and if yes which type.
525 */
526 std::vector<compressed_constraint_kind> hanging_node_constraint_masks;
527
528 /**
529 * This variable describes the position of constraints in terms of the
530 * local numbering of degrees of freedom on a cell. The first number
531 * stores the distance from one constrained degree of freedom to the
532 * next. This allows to identify the position of constrained DoFs as we
533 * loop through the local degrees of freedom of the cell when reading
534 * from or writing to a vector. The second number stores the index of
535 * the constraint weights, stored in the variable constraint_pool_data.
536 */
537 std::vector<std::pair<unsigned short, unsigned short>>
538 constraint_indicator;
539
540 /**
541 * Reordered index storage for `IndexStorageVariants::interleaved`.
542 */
543 std::vector<unsigned int> dof_indices_interleaved;
544
545 /**
546 * Compressed index storage for faster access than through @p
547 * dof_indices used according to the description in IndexStorageVariants.
548 *
549 * The three arrays given here address the types for the faces decorated
550 * as interior (0), the faces decorated with as exterior (1), and the
551 * cells (2) according to CellOrFaceAccess.
552 */
553 std::array<std::vector<unsigned int>, 3> dof_indices_contiguous;
554
555 /**
556 * The same as above but for shared-memory usage. The first value of the
557 * pair is identifying the owning process and the second the index
558 * within that locally-owned data of that process.
559 *
560 * @note This data structure is only set up if all entries in
561 * index_storage_variants[2] are IndexStorageVariants::contiguous.
562 */
563 std::array<std::vector<std::pair<unsigned int, unsigned int>>, 3>
564 dof_indices_contiguous_sm;
565
566 /**
567 * Compressed index storage for faster access than through @p
568 * dof_indices used according to the description in IndexStorageVariants.
569 *
570 * The three arrays given here address the types for the faces decorated
571 * as minus (0), the faces decorated with as plus (1), and the cells
572 * (2).
573 */
574 std::array<std::vector<unsigned int>, 3> dof_indices_interleave_strides;
575
576 /**
577 * Caches the number of indices filled when vectorizing. This
578 * information can implicitly deduced from the row_starts data fields,
579 * but this field allows for faster access.
580 *
581 * The three arrays given here address the types for the faces decorated
582 * as interior (0), the faces decorated with as exterior (1), and the
583 * cells (2) according to CellOrFaceAccess.
584 */
585 std::array<std::vector<unsigned char>, 3> n_vectorization_lanes_filled;
586
587 /**
588 * This stores the parallel partitioning that can be used to set up
589 * vectors. The partitioner includes the description of the local range
590 * in the vector, and also includes how the ghosts look like. This
591 * enables initialization of vectors based on the DoFInfo field.
592 */
593 std::shared_ptr<const Utilities::MPI::Partitioner> vector_partitioner;
594
595 /**
596 * Vector exchanger compatible with vector_partitioner.
597 */
598 std::shared_ptr<
599 const internal::MatrixFreeFunctions::VectorDataExchange::Base>
600 vector_exchanger;
601
602 /**
603 * Vector exchanger compatible with partitioners that select a subset of
604 * ghost indices to the full
605 * vector partitioner stored in @p vector_partitioner. These
606 * partitioners are used in specialized loops that only import parts of
607 * the ghosted region for reducing the amount of communication. There
608 * are five variants of the partitioner initialized:
609 * - one that queries only the cell values,
610 * - one that additionally describes the indices for
611 * evaluating the function values on relevant faces,
612 * - one that describes the indices for evaluation both the function
613 * values and the gradients on relevant faces adjacent to the locally
614 * owned cells,
615 * - one that additionally describes the indices for
616 * evaluating the function values on all faces, and
617 * - one that describes the indices for evaluation both the function
618 * values and the gradients on all faces adjacent to the locally owned
619 * cells.
620 */
621 std::array<
622 std::shared_ptr<
623 const internal::MatrixFreeFunctions::VectorDataExchange::Base>,
624 5>
625 vector_exchanger_face_variants;
626
627 /**
628 * This stores a (sorted) list of all locally owned degrees of freedom
629 * that are constrained.
630 */
631 std::vector<unsigned int> constrained_dofs;
632
633 /**
634 * Stores the rowstart indices of the compressed row storage in the @p
635 * plain_dof_indices fields.
636 */
637 std::vector<unsigned int> row_starts_plain_indices;
638
639 /**
640 * Stores the indices of the degrees of freedom for each cell. This
641 * array does not include the indirect contributions from constraints,
642 * which are included in @p dof_indices. Because of variable lengths of
643 * rows, this would be a vector of a vector. However, we use one
644 * contiguous memory region and store the rowstart in the variable @p
645 * row_starts_plain_indices.
646 */
647 std::vector<unsigned int> plain_dof_indices;
648
649 /**
650 * Stores the offset in terms of the number of base elements over all
651 * DoFInfo objects.
652 */
653 unsigned int global_base_element_offset;
654
655 /**
656 * Stores the number of base elements in the DoFHandler where the
657 * indices have been read from.
658 */
659 unsigned int n_base_elements;
660
661 /**
662 * Stores the number of components of each base element in the finite
663 * element where the indices have been read from.
664 */
665 std::vector<unsigned int> n_components;
666
667 /**
668 * The ith entry of this vector stores the component number of the given
669 * base element.
670 */
671 std::vector<unsigned int> start_components;
672
673 /**
674 * For a given component in an FESystem, this variable tells which base
675 * element the index belongs to.
676 */
677 std::vector<unsigned int> component_to_base_index;
678
679 /**
680 * For a vector-valued element, this gives the constant offset in the
681 * number of degrees of freedom starting at the given component, as the
682 * degrees are numbered by degrees of freedom. This data structure does
683 * not take possible constraints and thus, shorter or longer lists, into
684 * account. This information is encoded in the row_starts variables
685 * directly.
686 *
687 * The outer vector goes through the various FE indices in the hp-case,
688 * similarly to the @p dofs_per_cell variable.
689 */
690 std::vector<std::vector<unsigned int>> component_dof_indices_offset;
691
692 /**
693 * Stores the number of degrees of freedom per cell.
694 */
695 std::vector<unsigned int> dofs_per_cell;
696
697 /**
698 * Stores the number of degrees of freedom per face.
699 */
700 std::vector<unsigned int> dofs_per_face;
701
702 /**
703 * Informs on whether plain indices are cached.
704 */
705 bool store_plain_indices;
706
707 /**
708 * Stores the index of the active finite element in the hp-case.
709 */
710 std::vector<unsigned int> cell_active_fe_index;
711
712 /**
713 * Stores the maximum degree of different finite elements for the
714 * hp-case.
715 */
716 unsigned int max_fe_index;
717
718 /**
719 * To each of the slots in an hp-adaptive case, the inner vector stores
720 * the corresponding element degree. This is used by the constructor of
721 * FEEvaluationBase to identify the correct data slot in the hp-case.
722 */
723 std::vector<std::vector<unsigned int>> fe_index_conversion;
724
725 /**
726 * Temporarily stores the numbers of ghosts during setup. Cleared when
727 * calling @p assign_ghosts. Then, all information is collected by the
728 * partitioner.
729 */
730 std::vector<types::global_dof_index> ghost_dofs;
731
732 /**
733 * Stores an integer to each partition in TaskInfo that indicates
734 * whether to clear certain parts in the result vector if the user
735 * requested it with the respective argument in the MatrixFree::loop.
736 */
737 std::vector<unsigned int> vector_zero_range_list_index;
738
739 /**
740 * Stores the actual ranges in the vector to be cleared.
741 */
742 std::vector<std::pair<unsigned int, unsigned int>> vector_zero_range_list;
743
744 /**
745 * Stores an integer to each partition in TaskInfo that indicates when
746 * to schedule operations that will be done before any access to vector
747 * entries.
748 */
749 std::vector<unsigned int> cell_loop_pre_list_index;
750
751 /**
752 * Stores the actual ranges of the operation before any access to vector
753 * entries.
754 */
755 std::vector<std::pair<unsigned int, unsigned int>> cell_loop_pre_list;
756
757 /**
758 * Stores an integer to each partition in TaskInfo that indicates when
759 * to schedule operations that will be done after all access to vector
760 * entries.
761 */
762 std::vector<unsigned int> cell_loop_post_list_index;
763
764 /**
765 * Stores the actual ranges of the operation after all access to vector
766 * entries.
767 */
768 std::vector<std::pair<unsigned int, unsigned int>> cell_loop_post_list;
769 };
770
771
772 /*-------------------------- Inline functions ---------------------------*/
773
774 #ifndef DOXYGEN
775
776
777 inline unsigned int
778 DoFInfo::fe_index_from_degree(const unsigned int first_selected_component,
779 const unsigned int fe_degree) const
780 {
781 const unsigned int n_indices = fe_index_conversion.size();
782 if (n_indices <= 1)
783 return 0;
784 for (unsigned int i = 0; i < n_indices; ++i)
785 if (fe_index_conversion[i][first_selected_component] == fe_degree)
786 return i;
787 return numbers::invalid_unsigned_int;
788 }
789
790 #endif // ifndef DOXYGEN
791
792 } // end of namespace MatrixFreeFunctions
793 } // end of namespace internal
794
795 DEAL_II_NAMESPACE_CLOSE
796
797 #endif