16 #include <deal.II/base/array_view.h> 17 #include <deal.II/base/memory_consumption.h> 18 #include <deal.II/base/polynomial.h> 19 #include <deal.II/base/quadrature.h> 20 #include <deal.II/base/quadrature_lib.h> 21 #include <deal.II/base/std_cxx14/memory.h> 22 #include <deal.II/base/tensor_product_polynomials.h> 23 #include <deal.II/base/utilities.h> 25 #include <deal.II/dofs/dof_accessor.h> 27 #include <deal.II/fe/fe_q.h> 28 #include <deal.II/fe/fe_values.h> 29 #include <deal.II/fe/mapping_q.h> 31 #include <deal.II/grid/tria_iterator.h> 33 #include <deal.II/lac/full_matrix.h> 38 DEAL_II_NAMESPACE_OPEN
41 template <
int dim,
int spacedim>
43 : use_mapping_q1_on_current_cell(false)
48 template <
int dim,
int spacedim>
61 template <
int dim,
int spacedim>
89 template <
int dim,
int spacedim>
91 : polynomial_degree(mapping.polynomial_degree)
92 , use_mapping_q_on_all_cells(mapping.use_mapping_q_on_all_cells)
96 std::shared_ptr<const Mapping<dim, spacedim>> other_q1_map =
110 std::shared_ptr<const Mapping<dim, spacedim>> other_qp_map =
121 template <
int dim,
int spacedim>
125 return polynomial_degree;
130 template <
int dim,
int spacedim>
139 template <
int dim,
int spacedim>
143 return (q1_mapping->requires_update_flags(in) |
144 qp_mapping->requires_update_flags(in));
149 template <
int dim,
int spacedim>
150 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
154 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> data_ptr =
155 std_cxx14::make_unique<InternalData>();
160 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>>
166 if (!use_mapping_q_on_all_cells)
169 std::move(q1_mapping->get_data(update_flags, quadrature)));
174 std::move(do_get_data.return_value()));
180 template <
int dim,
int spacedim>
181 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
186 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> data_ptr =
187 std_cxx14::make_unique<InternalData>();
192 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>>
199 if (!use_mapping_q_on_all_cells)
202 std::move(q1_mapping->get_face_data(update_flags, quadrature)));
207 std::move(do_get_data.return_value()));
213 template <
int dim,
int spacedim>
214 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
219 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> data_ptr =
220 std_cxx14::make_unique<InternalData>();
225 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>>
232 if (!use_mapping_q_on_all_cells)
235 std::move(q1_mapping->get_subface_data(update_flags, quadrature)));
240 std::move(do_get_data.return_value()));
247 template <
int dim,
int spacedim>
259 Assert(dynamic_cast<const InternalData *>(&internal_data) !=
nullptr,
261 const InternalData &data =
static_cast<const InternalData &
>(internal_data);
265 data.use_mapping_q1_on_current_cell =
266 !(use_mapping_q_on_all_cells || cell->has_boundary_lines());
276 ((data.use_mapping_q1_on_current_cell ==
false) &&
277 (this->polynomial_degree > 1) ?
283 if (data.use_mapping_q1_on_current_cell)
284 q1_mapping->fill_fe_values(cell,
285 updated_cell_similarity,
287 *data.mapping_q1_data,
290 qp_mapping->fill_fe_values(cell,
291 updated_cell_similarity,
293 *data.mapping_qp_data,
296 return updated_cell_similarity;
301 template <
int dim,
int spacedim>
305 const unsigned int face_no,
313 Assert(dynamic_cast<const InternalData *>(&internal_data) !=
nullptr,
315 const InternalData &data =
static_cast<const InternalData &
>(internal_data);
323 data.use_mapping_q1_on_current_cell =
324 !(use_mapping_q_on_all_cells || cell->has_boundary_lines());
328 if (data.use_mapping_q1_on_current_cell)
329 q1_mapping->fill_fe_face_values(
330 cell, face_no, quadrature, *data.mapping_q1_data, output_data);
332 qp_mapping->fill_fe_face_values(
333 cell, face_no, quadrature, *data.mapping_qp_data, output_data);
337 template <
int dim,
int spacedim>
341 const unsigned int face_no,
342 const unsigned int subface_no,
350 Assert(dynamic_cast<const InternalData *>(&internal_data) !=
nullptr,
352 const InternalData &data =
static_cast<const InternalData &
>(internal_data);
360 data.use_mapping_q1_on_current_cell =
361 !(use_mapping_q_on_all_cells || cell->has_boundary_lines());
365 if (data.use_mapping_q1_on_current_cell)
366 q1_mapping->fill_fe_subface_values(cell,
370 *data.mapping_q1_data,
373 qp_mapping->fill_fe_subface_values(cell,
377 *data.mapping_qp_data,
383 template <
int dim,
int spacedim>
397 if (data->use_mapping_q1_on_current_cell)
398 q1_mapping->transform(input, mapping_type, *data->mapping_q1_data, output);
401 qp_mapping->transform(input, mapping_type, *data->mapping_qp_data, output);
406 template <
int dim,
int spacedim>
416 &mapping_data) !=
nullptr),
422 q1_mapping->transform(input, mapping_type, *data->
mapping_q1_data, output);
425 qp_mapping->transform(input, mapping_type, *data->
mapping_qp_data, output);
430 template <
int dim,
int spacedim>
440 &mapping_data) !=
nullptr),
446 q1_mapping->transform(input, mapping_type, *data->
mapping_q1_data, output);
449 qp_mapping->transform(input, mapping_type, *data->
mapping_qp_data, output);
454 template <
int dim,
int spacedim>
464 &mapping_data) !=
nullptr),
470 q1_mapping->transform(input, mapping_type, *data->
mapping_q1_data, output);
473 qp_mapping->transform(input, mapping_type, *data->
mapping_qp_data, output);
478 template <
int dim,
int spacedim>
488 &mapping_data) !=
nullptr),
494 q1_mapping->transform(input, mapping_type, *data->
mapping_q1_data, output);
497 qp_mapping->transform(input, mapping_type, *data->
mapping_qp_data, output);
502 template <
int dim,
int spacedim>
511 if (use_mapping_q_on_all_cells || cell->has_boundary_lines())
512 return qp_mapping->transform_unit_to_real_cell(cell, p);
514 return q1_mapping->transform_unit_to_real_cell(cell, p);
519 template <
int dim,
int spacedim>
525 if (cell->has_boundary_lines() || use_mapping_q_on_all_cells ||
527 return qp_mapping->transform_real_to_unit_cell(cell, p);
529 return q1_mapping->transform_real_to_unit_cell(cell, p);
534 template <
int dim,
int spacedim>
535 std::unique_ptr<Mapping<dim, spacedim>>
538 return std_cxx14::make_unique<MappingQ<dim, spacedim>>(
539 this->polynomial_degree, this->use_mapping_q_on_all_cells);
545 #include "mapping_q.inst" 548 DEAL_II_NAMESPACE_CLOSE
unsigned int get_degree() const
virtual std::size_t memory_consumption() const override
#define AssertDimension(dim1, dim2)
std::shared_ptr< const MappingQGeneric< dim, spacedim > > qp_mapping
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > get_data(const UpdateFlags, const Quadrature< dim > &quadrature) const override
Task< RT > new_task(const std::function< RT()> &function)
bool use_mapping_q1_on_current_cell
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > get_face_data(const UpdateFlags flags, const Quadrature< dim - 1 > &quadrature) const override
const bool use_mapping_q_on_all_cells
std::unique_ptr< To > dynamic_unique_cast(std::unique_ptr< From > &&p)
#define Assert(cond, exc)
Abstract base class for mapping classes.
const unsigned int polynomial_degree
std::unique_ptr< typename MappingQGeneric< dim, spacedim >::InternalData > mapping_qp_data
virtual std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > get_subface_data(const UpdateFlags flags, const Quadrature< dim - 1 > &quadrature) const override
virtual Point< spacedim > transform_unit_to_real_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< dim > &p) const override
virtual bool preserves_vertex_locations() const override
virtual void transform(const ArrayView< const Tensor< 1, dim >> &input, const MappingType type, const typename Mapping< dim, spacedim >::InternalDataBase &internal, const ArrayView< Tensor< 1, spacedim >> &output) const override
virtual std::unique_ptr< Mapping< dim, spacedim > > clone() const override
std::unique_ptr< typename MappingQGeneric< dim, spacedim >::InternalData > mapping_q1_data
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) const override
MappingQ(const unsigned int polynomial_degree, const bool use_mapping_q_on_all_cells=false)
virtual Point< dim > transform_real_to_unit_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< spacedim > &p) const override
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
static ::ExceptionBase & ExcInternalError()
std::shared_ptr< const MappingQGeneric< dim, spacedim > > q1_mapping