Reference documentation for deal.II version GIT defb42778c 2022-12-05 01:15: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_non_matching_mapping_info_h
18 #define dealii_non_matching_mapping_info_h
19 
20 
21 #include <deal.II/base/config.h>
22 
26 
27 #include <deal.II/fe/fe_dgq.h>
30 #include <deal.II/fe/mapping_q.h>
31 
32 #include <memory>
33 
34 
36 
37 namespace NonMatching
38 {
43  template <int dim, int spacedim = dim>
44  class MappingInfo : public Subscriptor
45  {
46  public:
57 
62  void
64  const ArrayView<const Point<dim>> &unit_points);
65 
69  const std::vector<Point<dim>> &
70  get_unit_points() const;
71 
76  const ::internal::FEValuesImplementation::MappingRelatedData<dim,
77  spacedim>
78  &
79  get_mapping_data() const;
80 
85  get_mapping() const;
86 
91  get_update_flags() const;
92 
93  private:
99  void
101  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
102  const ArrayView<const Point<dim>> & unit_points);
103 
107  std::vector<Point<dim>> unit_points;
108 
113 
118 
123 
130  };
131 
132  // ----------------------- template functions ----------------------
133 
134 
135  template <int dim, int spacedim>
137  const UpdateFlags update_flags)
138  : mapping(&mapping)
139  , update_flags(update_flags)
140  {
142  // translate update flags
148 
149  // always save quadrature points for now
151  }
152 
153 
154 
155  template <int dim, int spacedim>
156  void
158  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
159  const ArrayView<const Point<dim>> & unit_points)
160  {
161  this->unit_points =
162  std::vector<Point<dim>>(unit_points.begin(), unit_points.end());
163  compute_mapping_data_for_generic_points(cell, unit_points);
164  }
165 
166 
167 
168  template <int dim, int spacedim>
169  const std::vector<Point<dim>> &
171  {
172  return unit_points;
173  }
174 
175 
176 
177  template <int dim, int spacedim>
178  const ::internal::FEValuesImplementation::MappingRelatedData<dim,
179  spacedim> &
181  {
182  return mapping_data;
183  }
184 
185 
186 
187  template <int dim, int spacedim>
188  const Mapping<dim, spacedim> &
190  {
191  return *mapping;
192  }
193 
194 
195 
196  template <int dim, int spacedim>
199  {
200  return update_flags;
201  }
202 
203 
204 
205  template <int dim, int spacedim>
206  void
208  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
209  const ArrayView<const Point<dim>> & unit_points)
210  {
211  if (const MappingQ<dim, spacedim> *mapping_q =
212  dynamic_cast<const MappingQ<dim, spacedim> *>(&(*mapping)))
213  {
214  mapping_q->fill_mapping_data_for_generic_points(cell,
215  unit_points,
216  update_flags_mapping,
217  mapping_data);
218  }
219  else if (const MappingCartesian<dim, spacedim> *mapping_cartesian =
220  dynamic_cast<const MappingCartesian<dim, spacedim> *>(
221  &(*mapping)))
222  {
223  mapping_cartesian->fill_mapping_data_for_generic_points(
224  cell, unit_points, update_flags_mapping, mapping_data);
225  }
226  else
227  {
228  FE_DGQ<dim, spacedim> dummy_fe(1);
229  ::FEValues<dim, spacedim> fe_values(
230  *mapping,
231  dummy_fe,
233  std::vector<Point<dim>>(unit_points.begin(), unit_points.end())),
234  update_flags_mapping);
235  fe_values.reinit(cell);
236  mapping_data.initialize(unit_points.size(), update_flags_mapping);
237  if (update_flags_mapping & update_jacobians)
238  for (unsigned int q = 0; q < unit_points.size(); ++q)
239  mapping_data.jacobians[q] = fe_values.jacobian(q);
240  if (update_flags_mapping & update_inverse_jacobians)
241  for (unsigned int q = 0; q < unit_points.size(); ++q)
242  mapping_data.inverse_jacobians[q] = fe_values.inverse_jacobian(q);
243  if (update_flags_mapping & update_quadrature_points)
244  for (unsigned int q = 0; q < unit_points.size(); ++q)
245  mapping_data.quadrature_points[q] = fe_values.quadrature_point(q);
246  }
247  }
248 } // namespace NonMatching
249 
251 
252 #endif
Definition: fe_dgq.h:113
Abstract base class for mapping classes.
Definition: mapping.h:311
void reinit(const TriaIterator< DoFCellAccessor< dim, dim, level_dof_access >> &cell)
Definition: fe_values.cc:154
UpdateFlags get_update_flags() const
Definition: mapping_info.h:198
::internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > mapping_data
Definition: mapping_info.h:129
std::vector< Point< dim > > unit_points
Definition: mapping_info.h:107
const std::vector< Point< dim > > & get_unit_points() const
Definition: mapping_info.h:170
const UpdateFlags update_flags
Definition: mapping_info.h:117
void reinit(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const ArrayView< const Point< dim >> &unit_points)
Definition: mapping_info.h:157
const Mapping< dim, spacedim > & get_mapping() const
Definition: mapping_info.h:189
const SmartPointer< const Mapping< dim, spacedim > > mapping
Definition: mapping_info.h:112
void compute_mapping_data_for_generic_points(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const ArrayView< const Point< dim >> &unit_points)
Definition: mapping_info.h:207
MappingInfo(const Mapping< dim > &mapping, const UpdateFlags update_flags)
Definition: mapping_info.h:136
UpdateFlags update_flags_mapping
Definition: mapping_info.h:122
const ::internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > & get_mapping_data() const
Definition: mapping_info.h:180
Definition: point.h:111
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:458
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:459
UpdateFlags
@ update_jacobians
Volume element.
@ update_inverse_jacobians
Volume element.
@ update_gradients
Shape function gradients.
@ update_quadrature_points
Transformed quadrature points.
@ update_default
No update.