Reference documentation for deal.II version 9.2.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
dof_info.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2011 - 2020 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 
17 #ifndef dealii_matrix_free_dof_info_h
18 #define dealii_matrix_free_dof_info_h
19 
20 
21 #include <deal.II/base/config.h>
22 
26 
28 
31 
35 
36 #include <array>
37 #include <memory>
38 
39 
41 
42 namespace internal
43 {
44  namespace MatrixFreeFunctions
45  {
50  template <typename Number>
52  {
54 
62  template <typename number2>
63  unsigned short
65  const std::vector<std::pair<types::global_dof_index, number2>>
66  &entries);
67 
68  std::vector<std::pair<types::global_dof_index, double>>
70  std::vector<types::global_dof_index> constraint_indices;
71 
72  std::pair<std::vector<Number>, types::global_dof_index> next_constraint;
73  std::map<std::vector<Number>,
77  };
78 
99  struct DoFInfo
100  {
113  static const unsigned int chunk_size_zero_vector = 64;
114 
118  DoFInfo();
119 
123  DoFInfo(const DoFInfo &) = default;
124 
128  void
129  clear();
130 
136  unsigned int
137  fe_index_from_degree(const unsigned int first_selected_component,
138  const unsigned int fe_degree) const;
139 
159  void
160  get_dof_indices_on_cell_batch(std::vector<unsigned int> &locall_indices,
161  const unsigned int cell,
162  const bool with_constraints = true) const;
163 
172  template <typename number>
173  void
174  read_dof_indices(
175  const std::vector<types::global_dof_index> &local_indices,
176  const std::vector<unsigned int> & lexicographic_inv,
178  const unsigned int cell_number,
179  ConstraintValues<double> & constraint_values,
180  bool & cell_at_boundary);
181 
189  void
190  assign_ghosts(const std::vector<unsigned int> &boundary_cells);
191 
198  void
199  reorder_cells(const TaskInfo & task_info,
200  const std::vector<unsigned int> & renumbering,
201  const std::vector<unsigned int> & constraint_pool_row_index,
202  const std::vector<unsigned char> &irregular_cells);
203 
208  void
209  compute_cell_index_compression(
210  const std::vector<unsigned char> &irregular_cells);
211 
216  template <int length>
217  void
218  compute_face_index_compression(
219  const std::vector<FaceToCellTopology<length>> &faces);
220 
226  void
227  make_connectivity_graph(const TaskInfo & task_info,
228  const std::vector<unsigned int> &renumbering,
229  DynamicSparsityPattern &connectivity) const;
230 
241  void
242  compute_dof_renumbering(
243  std::vector<types::global_dof_index> &renumbering);
244 
254  template <int length>
255  void
256  compute_vector_zero_access_pattern(
257  const TaskInfo & task_info,
258  const std::vector<FaceToCellTopology<length>> &faces);
259 
263  std::size_t
264  memory_consumption() const;
265 
270  template <typename StreamType>
271  void
272  print_memory_consumption(StreamType & out,
273  const TaskInfo &size_info) const;
274 
279  template <typename Number>
280  void
281  print(const std::vector<Number> & constraint_pool_data,
282  const std::vector<unsigned int> &constraint_pool_row_index,
283  std::ostream & out) const;
284 
296  enum class IndexStorageVariants : unsigned char
297  {
306  full,
318  interleaved,
327  contiguous,
351  interleaved_contiguous,
363  interleaved_contiguous_strided,
376  interleaved_contiguous_mixed_strides
377  };
378 
383  enum DoFAccessIndex : unsigned char
384  {
388  dof_access_face_interior = 0,
392  dof_access_face_exterior = 1,
396  dof_access_cell = 2
397  };
398 
404  unsigned int dimension;
405 
414  unsigned int vectorization_length;
415 
423  std::vector<IndexStorageVariants> index_storage_variants[3];
424 
431  std::vector<std::pair<unsigned int, unsigned int>> row_starts;
432 
448  std::vector<unsigned int> dof_indices;
449 
459  std::vector<std::pair<unsigned short, unsigned short>>
461 
465  std::vector<unsigned int> dof_indices_interleaved;
466 
475  std::vector<unsigned int> dof_indices_contiguous[3];
476 
485  std::vector<unsigned int> dof_indices_interleave_strides[3];
486 
496  std::vector<unsigned char> n_vectorization_lanes_filled[3];
497 
504  std::shared_ptr<const Utilities::MPI::Partitioner> vector_partitioner;
505 
524  std::array<std::shared_ptr<const Utilities::MPI::Partitioner>, 5>
526 
531  std::vector<unsigned int> constrained_dofs;
532 
537  std::vector<unsigned int> row_starts_plain_indices;
538 
547  std::vector<unsigned int> plain_dof_indices;
548 
554 
559  unsigned int n_base_elements;
560 
565  std::vector<unsigned int> n_components;
566 
571  std::vector<unsigned int> start_components;
572 
577  std::vector<unsigned int> component_to_base_index;
578 
590  std::vector<std::vector<unsigned int>> component_dof_indices_offset;
591 
595  std::vector<unsigned int> dofs_per_cell;
596 
600  std::vector<unsigned int> dofs_per_face;
601 
606 
610  std::vector<unsigned int> cell_active_fe_index;
611 
616  unsigned int max_fe_index;
617 
623  std::vector<std::vector<unsigned int>> fe_index_conversion;
624 
630  std::vector<types::global_dof_index> ghost_dofs;
631 
637  std::vector<unsigned int> vector_zero_range_list_index;
638 
642  std::vector<std::pair<unsigned int, unsigned int>> vector_zero_range_list;
643 
649  std::vector<unsigned int> cell_loop_pre_list_index;
650 
655  std::vector<std::pair<unsigned int, unsigned int>> cell_loop_pre_list;
656 
662  std::vector<unsigned int> cell_loop_post_list_index;
663 
668  std::vector<std::pair<unsigned int, unsigned int>> cell_loop_post_list;
669  };
670 
671 
672  /*-------------------------- Inline functions ---------------------------*/
673 
674 #ifndef DOXYGEN
675 
676 
677  inline unsigned int
678  DoFInfo::fe_index_from_degree(const unsigned int first_selected_component,
679  const unsigned int fe_degree) const
680  {
681  const unsigned int n_indices = fe_index_conversion.size();
682  if (n_indices <= 1)
683  return 0;
684  for (unsigned int i = 0; i < n_indices; ++i)
685  if (fe_index_conversion[i][first_selected_component] == fe_degree)
686  return i;
688  }
689 
690 #endif // ifndef DOXYGEN
691 
692  } // end of namespace MatrixFreeFunctions
693 } // end of namespace internal
694 
696 
697 #endif
std::vector< unsigned int > plain_dof_indices
Definition: dof_info.h:547
static const unsigned int invalid_unsigned_int
Definition: types.h:191
unsigned int fe_index_from_degree(const unsigned int first_selected_component, const unsigned int fe_degree) const
std::vector< std::pair< unsigned int, unsigned int > > vector_zero_range_list
Definition: dof_info.h:642
std::vector< unsigned int > component_to_base_index
Definition: dof_info.h:577
std::vector< unsigned int > cell_loop_pre_list_index
Definition: dof_info.h:649
unsigned short insert_entries(const std::vector< std::pair< types::global_dof_index, number2 >> &entries)
std::shared_ptr< const Utilities::MPI::Partitioner > vector_partitioner
Definition: dof_info.h:504
std::vector< unsigned int > vector_zero_range_list_index
Definition: dof_info.h:637
std::vector< unsigned int > dof_indices
Definition: dof_info.h:448
std::vector< unsigned int > cell_loop_post_list_index
Definition: dof_info.h:662
std::vector< unsigned int > dofs_per_face
Definition: dof_info.h:600
std::vector< std::pair< types::global_dof_index, double > > constraint_entries
Definition: dof_info.h:69
std::vector< std::pair< unsigned int, unsigned int > > cell_loop_pre_list
Definition: dof_info.h:655
std::vector< unsigned int > dof_indices_interleaved
Definition: dof_info.h:465
std::vector< unsigned int > row_starts_plain_indices
Definition: dof_info.h:537
std::vector< types::global_dof_index > constraint_indices
Definition: dof_info.h:70
std::vector< std::vector< unsigned int > > fe_index_conversion
Definition: dof_info.h:623
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
std::vector< std::pair< unsigned int, unsigned int > > row_starts
Definition: dof_info.h:431
std::vector< std::pair< unsigned short, unsigned short > > constraint_indicator
Definition: dof_info.h:460
std::pair< std::vector< Number >, types::global_dof_index > next_constraint
Definition: dof_info.h:72
unsigned int global_dof_index
Definition: types.h:76
std::vector< types::global_dof_index > ghost_dofs
Definition: dof_info.h:630
std::vector< unsigned int > cell_active_fe_index
Definition: dof_info.h:610
std::vector< std::vector< unsigned int > > component_dof_indices_offset
Definition: dof_info.h:590
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
std::map< std::vector< Number >, types::global_dof_index, FPArrayComparator< Number > > constraints
Definition: dof_info.h:76
std::vector< unsigned int > dofs_per_cell
Definition: dof_info.h:595
std::vector< unsigned int > constrained_dofs
Definition: dof_info.h:531
std::vector< unsigned int > start_components
Definition: dof_info.h:571
std::vector< std::pair< unsigned int, unsigned int > > cell_loop_post_list
Definition: dof_info.h:668
std::vector< unsigned int > n_components
Definition: dof_info.h:565
std::array< std::shared_ptr< const Utilities::MPI::Partitioner >, 5 > vector_partitioner_face_variants
Definition: dof_info.h:525
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)