Reference documentation for deal.II version Git aba33d3846 2022-01-19 21:43:57 -0500
\(\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\}}\)
mapping_info.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2011 - 2021 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_mapping_info_h
18 #define dealii_matrix_free_mapping_info_h
19 
20 
21 #include <deal.II/base/config.h>
22 
26 
27 #include <deal.II/fe/fe.h>
28 #include <deal.II/fe/mapping.h>
29 
31 
34 
38 
39 #include <memory>
40 
41 
43 
44 
45 namespace internal
46 {
47  namespace MatrixFreeFunctions
48  {
55  template <int dim, typename Number, typename VectorizedArrayType>
56  struct MappingInfo
57  {
66  void
67  initialize(
68  const ::Triangulation<dim> & tria,
69  const std::vector<std::pair<unsigned int, unsigned int>> &cells,
70  const FaceInfo<VectorizedArrayType::size()> & faces,
71  const std::vector<unsigned int> &active_fe_index,
72  const std::shared_ptr<::hp::MappingCollection<dim>> &mapping,
73  const std::vector<::hp::QCollection<dim>> & quad,
78 
85  void
87  const ::Triangulation<dim> & tria,
88  const std::vector<std::pair<unsigned int, unsigned int>> &cells,
89  const FaceInfo<VectorizedArrayType::size()> & faces,
90  const std::vector<unsigned int> &active_fe_index,
91  const std::shared_ptr<::hp::MappingCollection<dim>> &mapping);
92 
97  get_cell_type(const unsigned int cell_chunk_no) const;
98 
102  void
103  clear();
104 
108  std::size_t
109  memory_consumption() const;
110 
115  template <typename StreamType>
116  void
117  print_memory_consumption(StreamType & out,
118  const TaskInfo &task_info) const;
119 
124 
130 
136 
142 
149  std::vector<GeometryType> cell_type;
150 
158  std::vector<GeometryType> face_type;
159 
163  std::vector<MappingInfoStorage<dim, dim, VectorizedArrayType>> cell_data;
164 
168  std::vector<MappingInfoStorage<dim - 1, dim, VectorizedArrayType>>
170 
175  std::vector<MappingInfoStorage<dim - 1, dim, VectorizedArrayType>>
177 
181  std::shared_ptr<::hp::MappingCollection<dim>> mapping_collection;
182 
187 
192  std::vector<std::vector<::ReferenceCell>> reference_cell_types;
193 
215  void
217  const ::Triangulation<dim> & tria,
218  const std::vector<std::pair<unsigned int, unsigned int>> &cells,
219  const std::vector<FaceToCellTopology<VectorizedArrayType::size()>>
220  &faces);
221 
226  void
228  const ::Triangulation<dim> & tria,
229  const std::vector<std::pair<unsigned int, unsigned int>> &cells,
230  const std::vector<unsigned int> & active_fe_index,
231  const ::hp::MappingCollection<dim> &mapping);
232 
237  void
239  const ::Triangulation<dim> & tria,
240  const std::vector<std::pair<unsigned int, unsigned int>> &cells,
241  const std::vector<FaceToCellTopology<VectorizedArrayType::size()>>
242  & faces,
243  const std::vector<unsigned int> & active_fe_index,
244  const ::hp::MappingCollection<dim> &mapping);
245 
250  void
252  const ::Triangulation<dim> & tria,
253  const std::vector<std::pair<unsigned int, unsigned int>> &cells,
254  const ::hp::MappingCollection<dim> & mapping);
255  };
256 
257 
258 
263  template <int, typename, bool, typename>
265 
266  template <int dim, typename Number, typename VectorizedArrayType>
267  struct MappingInfoCellsOrFaces<dim, Number, false, VectorizedArrayType>
268  {
271  const unsigned int quad_no)
272  {
273  AssertIndexRange(quad_no, mapping_info.cell_data.size());
274  return mapping_info.cell_data[quad_no];
275  }
276  };
277 
278  template <int dim, typename Number, typename VectorizedArrayType>
279  struct MappingInfoCellsOrFaces<dim, Number, true, VectorizedArrayType>
280  {
281  static const MappingInfoStorage<dim - 1, dim, VectorizedArrayType> &
283  const unsigned int quad_no)
284  {
285  AssertIndexRange(quad_no, mapping_info.face_data.size());
286  return mapping_info.face_data[quad_no];
287  }
288  };
289 
290 
291 
303  template <typename Number,
306  {
307  FPArrayComparator(const Number scaling);
308 
312  bool
313  operator()(const std::vector<Number> &v1,
314  const std::vector<Number> &v2) const;
315 
320  bool
321  operator()(
322  const Tensor<1, VectorizedArrayType::size(), Number> &t1,
323  const Tensor<1, VectorizedArrayType::size(), Number> &t2) const;
324 
329  template <int dim>
330  bool
331  operator()(
332  const Tensor<1, dim, Tensor<1, VectorizedArrayType::size(), Number>>
333  &t1,
334  const Tensor<1, dim, Tensor<1, VectorizedArrayType::size(), Number>>
335  &t2) const;
336 
341  template <int dim>
342  bool
343  operator()(
344  const Tensor<2, dim, Tensor<1, VectorizedArrayType::size(), Number>>
345  &t1,
346  const Tensor<2, dim, Tensor<1, VectorizedArrayType::size(), Number>>
347  &t2) const;
348 
352  template <int dim>
353  bool
354  operator()(const std::array<Tensor<2, dim, Number>, dim + 1> &t1,
355  const std::array<Tensor<2, dim, Number>, dim + 1> &t2) const;
356 
357  Number tolerance;
358  };
359 
360 
361 
362  /* ------------------- inline functions ----------------------------- */
363 
364  template <int dim, typename Number, typename VectorizedArrayType>
365  inline GeometryType
367  const unsigned int cell_no) const
368  {
369  AssertIndexRange(cell_no, cell_type.size());
370  return cell_type[cell_no];
371  }
372 
373  } // end of namespace MatrixFreeFunctions
374 } // end of namespace internal
375 
377 
378 #endif
std::vector< MappingInfoStorage< dim, dim, VectorizedArrayType > > cell_data
Definition: mapping_info.h:163
void print_memory_consumption(StreamType &out, const TaskInfo &task_info) const
void initialize_cells(const ::Triangulation< dim > &tria, const std::vector< std::pair< unsigned int, unsigned int >> &cells, const std::vector< unsigned int > &active_fe_index, const ::hp::MappingCollection< dim > &mapping)
const ::Triangulation< dim, spacedim > & tria
#define AssertIndexRange(index, range)
Definition: exceptions.h:1720
void compute_mapping_q(const ::Triangulation< dim > &tria, const std::vector< std::pair< unsigned int, unsigned int >> &cells, const std::vector< FaceToCellTopology< VectorizedArrayType::size()>> &faces)
const unsigned int v1
Definition: grid_tools.cc:963
std::vector< MappingInfoStorage< dim - 1, dim, VectorizedArrayType > > face_data_by_cells
Definition: mapping_info.h:176
void initialize_faces_by_cells(const ::Triangulation< dim > &tria, const std::vector< std::pair< unsigned int, unsigned int >> &cells, const ::hp::MappingCollection< dim > &mapping)
UpdateFlags
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:407
GeometryType get_cell_type(const unsigned int cell_chunk_no) const
Definition: mapping_info.h:366
void initialize(const ::Triangulation< dim > &tria, const std::vector< std::pair< unsigned int, unsigned int >> &cells, const FaceInfo< VectorizedArrayType::size()> &faces, const std::vector< unsigned int > &active_fe_index, const std::shared_ptr<::hp::MappingCollection< dim >> &mapping, const std::vector<::hp::QCollection< dim >> &quad, const UpdateFlags update_flags_cells, const UpdateFlags update_flags_boundary_faces, const UpdateFlags update_flags_inner_faces, const UpdateFlags update_flags_faces_by_cells)
void initialize_faces(const ::Triangulation< dim > &tria, const std::vector< std::pair< unsigned int, unsigned int >> &cells, const std::vector< FaceToCellTopology< VectorizedArrayType::size()>> &faces, const std::vector< unsigned int > &active_fe_index, const ::hp::MappingCollection< dim > &mapping)
std::vector< GeometryType > face_type
Definition: mapping_info.h:158
Definition: tensor.h:506
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:406
std::vector< GeometryType > cell_type
Definition: mapping_info.h:149
void update_mapping(const ::Triangulation< dim > &tria, const std::vector< std::pair< unsigned int, unsigned int >> &cells, const FaceInfo< VectorizedArrayType::size()> &faces, const std::vector< unsigned int > &active_fe_index, const std::shared_ptr<::hp::MappingCollection< dim >> &mapping)
std::shared_ptr<::hp::MappingCollection< dim > > mapping_collection
Definition: mapping_info.h:181
SmartPointer< const Mapping< dim > > mapping
Definition: mapping_info.h:186
std::vector< MappingInfoStorage< dim - 1, dim, VectorizedArrayType > > face_data
Definition: mapping_info.h:169
std::vector< std::vector<::ReferenceCell > > reference_cell_types
Definition: mapping_info.h:192