Reference documentation for deal.II version GIT b6bf1e606d 2022-08-11 15:25:02+00:00
\(\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 
37 
38 #include <memory>
39 
40 
42 
43 
44 namespace internal
45 {
46  namespace MatrixFreeFunctions
47  {
54  template <int dim, typename Number, typename VectorizedArrayType>
55  struct MappingInfo
56  {
65  void
67  const ::Triangulation<dim> & tria,
68  const std::vector<std::pair<unsigned int, unsigned int>> &cells,
69  const FaceInfo<VectorizedArrayType::size()> & face_info,
70  const std::vector<unsigned int> &active_fe_index,
71  const std::shared_ptr<::hp::MappingCollection<dim>> &mapping,
72  const std::vector<::hp::QCollection<dim>> & quad,
77  const bool piola_transform);
78 
85  void
87  const ::Triangulation<dim> & tria,
88  const std::vector<std::pair<unsigned int, unsigned int>> &cells,
89  const FaceInfo<VectorizedArrayType::size()> & face_info,
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
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 
167  std::vector<std::array<GeometryType, GeometryInfo<dim>::faces_per_cell>>
169 
173  std::vector<MappingInfoStorage<dim, dim, VectorizedArrayType>> cell_data;
174 
178  std::vector<MappingInfoStorage<dim - 1, dim, VectorizedArrayType>>
180 
185  std::vector<MappingInfoStorage<dim - 1, dim, VectorizedArrayType>>
187 
191  std::shared_ptr<::hp::MappingCollection<dim>> mapping_collection;
192 
197 
202  std::vector<std::vector<::ReferenceCell>> reference_cell_types;
203 
225  void
227  const ::Triangulation<dim> & tria,
228  const std::vector<std::pair<unsigned int, unsigned int>> &cells,
229  const FaceInfo<VectorizedArrayType::size()> & face_info);
230 
235  void
237  const ::Triangulation<dim> & tria,
238  const std::vector<std::pair<unsigned int, unsigned int>> &cells,
239  const std::vector<unsigned int> & active_fe_index,
240  const ::hp::MappingCollection<dim> &mapping);
241 
246  void
248  const ::Triangulation<dim> & tria,
249  const std::vector<std::pair<unsigned int, unsigned int>> &cells,
250  const std::vector<FaceToCellTopology<VectorizedArrayType::size()>>
251  & faces,
252  const std::vector<unsigned int> & active_fe_index,
253  const ::hp::MappingCollection<dim> &mapping);
254 
259  void
261  const ::Triangulation<dim> & tria,
262  const std::vector<std::pair<unsigned int, unsigned int>> &cells,
263  const FaceInfo<VectorizedArrayType::size()> & face_info,
264  const ::hp::MappingCollection<dim> & mapping);
265  };
266 
267 
268 
273  template <int, typename, bool, typename>
275 
276  template <int dim, typename Number, typename VectorizedArrayType>
277  struct MappingInfoCellsOrFaces<dim, Number, false, VectorizedArrayType>
278  {
281  const unsigned int quad_no)
282  {
283  AssertIndexRange(quad_no, mapping_info.cell_data.size());
284  return mapping_info.cell_data[quad_no];
285  }
286  };
287 
288  template <int dim, typename Number, typename VectorizedArrayType>
289  struct MappingInfoCellsOrFaces<dim, Number, true, VectorizedArrayType>
290  {
291  static const MappingInfoStorage<dim - 1, dim, VectorizedArrayType> &
293  const unsigned int quad_no)
294  {
295  AssertIndexRange(quad_no, mapping_info.face_data.size());
296  return mapping_info.face_data[quad_no];
297  }
298  };
299 
300 
301 
313  template <typename Number,
314  typename VectorizedArrayType = VectorizedArray<Number>>
316  {
317  FPArrayComparator(const Number scaling);
318 
322  bool
323  operator()(const std::vector<Number> &v1,
324  const std::vector<Number> &v2) const;
325 
330  bool
332  const Tensor<1, VectorizedArrayType::size(), Number> &t1,
333  const Tensor<1, VectorizedArrayType::size(), Number> &t2) const;
334 
339  template <int dim>
340  bool
342  const Tensor<1, dim, Tensor<1, VectorizedArrayType::size(), Number>>
343  &t1,
344  const Tensor<1, dim, Tensor<1, VectorizedArrayType::size(), Number>>
345  &t2) const;
346 
351  template <int dim>
352  bool
354  const Tensor<2, dim, Tensor<1, VectorizedArrayType::size(), Number>>
355  &t1,
356  const Tensor<2, dim, Tensor<1, VectorizedArrayType::size(), Number>>
357  &t2) const;
358 
362  template <int dim>
363  bool
364  operator()(const std::array<Tensor<2, dim, Number>, dim + 1> &t1,
365  const std::array<Tensor<2, dim, Number>, dim + 1> &t2) const;
366 
367  Number tolerance;
368  };
369 
370 
371 
372  /* ------------------- inline functions ----------------------------- */
373 
374  template <int dim, typename Number, typename VectorizedArrayType>
375  inline GeometryType
377  const unsigned int cell_no) const
378  {
379  AssertIndexRange(cell_no, cell_type.size());
380  return cell_type[cell_no];
381  }
382 
383  } // end of namespace MatrixFreeFunctions
384 } // end of namespace internal
385 
387 
388 #endif
Definition: tensor.h:503
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:442
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:443
const unsigned int v1
Definition: grid_tools.cc:1003
#define AssertIndexRange(index, range)
Definition: exceptions.h:1732
UpdateFlags
bool operator()(const std::vector< Number > &v1, const std::vector< Number > &v2) const
bool operator()(const std::array< Tensor< 2, dim, Number >, dim+1 > &t1, const std::array< Tensor< 2, dim, Number >, dim+1 > &t2) const
bool operator()(const Tensor< 2, dim, Tensor< 1, VectorizedArrayType::size(), Number >> &t1, const Tensor< 2, dim, Tensor< 1, VectorizedArrayType::size(), Number >> &t2) const
bool operator()(const Tensor< 1, dim, Tensor< 1, VectorizedArrayType::size(), Number >> &t1, const Tensor< 1, dim, Tensor< 1, VectorizedArrayType::size(), Number >> &t2) const
bool operator()(const Tensor< 1, VectorizedArrayType::size(), Number > &t1, const Tensor< 1, VectorizedArrayType::size(), Number > &t2) const
static const MappingInfoStorage< dim, dim, VectorizedArrayType > & get(const MappingInfo< dim, Number, VectorizedArrayType > &mapping_info, const unsigned int quad_no)
Definition: mapping_info.h:280
static const MappingInfoStorage< dim - 1, dim, VectorizedArrayType > & get(const MappingInfo< dim, Number, VectorizedArrayType > &mapping_info, const unsigned int quad_no)
Definition: mapping_info.h:292
void compute_mapping_q(const ::Triangulation< dim > &tria, const std::vector< std::pair< unsigned int, unsigned int >> &cells, const FaceInfo< VectorizedArrayType::size()> &face_info)
std::shared_ptr<::hp::MappingCollection< dim > > mapping_collection
Definition: mapping_info.h:191
GeometryType get_cell_type(const unsigned int cell_chunk_no) const
Definition: mapping_info.h:376
std::vector< GeometryType > cell_type
Definition: mapping_info.h:149
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)
std::vector< GeometryType > face_type
Definition: mapping_info.h:158
std::vector< std::array< GeometryType, GeometryInfo< dim >::faces_per_cell > > faces_by_cells_type
Definition: mapping_info.h:168
std::vector< std::vector<::ReferenceCell > > reference_cell_types
Definition: mapping_info.h:202
std::vector< MappingInfoStorage< dim, dim, VectorizedArrayType > > cell_data
Definition: mapping_info.h:173
void initialize(const ::Triangulation< dim > &tria, const std::vector< std::pair< unsigned int, unsigned int >> &cells, const FaceInfo< VectorizedArrayType::size()> &face_info, 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, const bool piola_transform)
SmartPointer< const Mapping< dim > > mapping
Definition: mapping_info.h:196
void print_memory_consumption(StreamType &out, const TaskInfo &task_info) const
void update_mapping(const ::Triangulation< dim > &tria, const std::vector< std::pair< unsigned int, unsigned int >> &cells, const FaceInfo< VectorizedArrayType::size()> &face_info, const std::vector< unsigned int > &active_fe_index, const std::shared_ptr<::hp::MappingCollection< dim >> &mapping)
std::vector< MappingInfoStorage< dim - 1, dim, VectorizedArrayType > > face_data_by_cells
Definition: mapping_info.h:186
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< MappingInfoStorage< dim - 1, dim, VectorizedArrayType > > face_data
Definition: mapping_info.h:179
void initialize_faces_by_cells(const ::Triangulation< dim > &tria, const std::vector< std::pair< unsigned int, unsigned int >> &cells, const FaceInfo< VectorizedArrayType::size()> &face_info, const ::hp::MappingCollection< dim > &mapping)
const ::Triangulation< dim, spacedim > & tria