Reference documentation for deal.II version 9.6.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\}}\)
Loading...
Searching...
No Matches
mapping_q1_eulerian.cc
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2001 - 2023 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15
18
19#include <deal.II/fe/fe.h>
21
23
31#include <deal.II/lac/vector.h>
32
33#include <array>
34#include <memory>
35
37
38
39template <int dim, typename VectorType, int spacedim>
41 const DoFHandler<dim, spacedim> &shiftmap_dof_handler,
42 const VectorType &euler_transform_vectors)
43 : MappingQ<dim, spacedim>(1)
44 , euler_transform_vectors(&euler_transform_vectors)
45 , shiftmap_dof_handler(&shiftmap_dof_handler)
46{}
47
48
49
50template <int dim, typename VectorType, int spacedim>
51boost::container::small_vector<Point<spacedim>,
54 const typename Triangulation<dim, spacedim>::cell_iterator &cell) const
55{
56 boost::container::small_vector<Point<spacedim>,
59 // The assertions can not be in the constructor, since this would
60 // require to call dof_handler.distribute_dofs(fe) *before* the mapping
61 // object is constructed, which is not necessarily what we want.
62
63 // TODO: Only one of these two assertions should be relevant
64 AssertDimension(spacedim, shiftmap_dof_handler->get_fe().n_dofs_per_vertex());
65 AssertDimension(shiftmap_dof_handler->get_fe(0).n_components(), spacedim);
66
67 AssertDimension(shiftmap_dof_handler->n_dofs(),
68 euler_transform_vectors->size());
69
70 // cast the Triangulation<dim>::cell_iterator into a
71 // DoFHandler<dim>::cell_iterator which is necessary for access to
72 // DoFCellAccessor::get_dof_values()
74 *cell, shiftmap_dof_handler);
75
76 // We require the cell to be active since we can only then get nodal
77 // values for the shifts
78 Assert(dof_cell->is_active() == true, ExcInactiveCell());
79
80 // now get the values of the shift vectors at the vertices
82 shiftmap_dof_handler->get_fe().n_dofs_per_cell());
83 dof_cell->get_dof_values(*euler_transform_vectors, mapping_values);
84
85 for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
86 {
87 Point<spacedim> shift_vector;
88
89 // pick out the value of the shift vector at the present
90 // vertex. since vertex dofs are always numbered first, we can
91 // access them easily
92 for (unsigned int j = 0; j < spacedim; ++j)
93 shift_vector[j] = mapping_values(i * spacedim + j);
94
95 // compute new support point by old (reference) value and added
96 // shift
97 vertices[i] = cell->vertex(i) + shift_vector;
98 }
99 return vertices;
100}
101
102
103
104template <int dim, typename VectorType, int spacedim>
105std::vector<Point<spacedim>>
107 const typename Triangulation<dim, spacedim>::cell_iterator &cell) const
108{
109 const auto vertices = this->get_vertices(cell);
110
111 std::vector<Point<spacedim>> a(GeometryInfo<dim>::vertices_per_cell);
112 for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
113 a[i] = vertices[i];
114
115 return a;
116}
117
118
119
120template <int dim, typename VectorType, int spacedim>
121std::unique_ptr<Mapping<dim, spacedim>>
123{
124 return std::make_unique<MappingQ1Eulerian<dim, VectorType, spacedim>>(*this);
125}
126
127
128
129template <int dim, typename VectorType, int spacedim>
134 const Quadrature<dim> &quadrature,
135 const typename Mapping<dim, spacedim>::InternalDataBase &internal_data,
137 &output_data) const
138{
139 // call the function of the base class, but ignoring
140 // any potentially detected cell similarity between
141 // the current and the previous cell
144 quadrature,
145 internal_data,
146 output_data);
147 // also return the updated flag since any detected
148 // similarity wasn't based on the mapped field, but
149 // the original vertices which are meaningless
151}
152
153
154
155// explicit instantiations
156#include "mapping_q1_eulerian.inst"
157
158
virtual boost::container::small_vector< Point< spacedim >, GeometryInfo< dim >::vertices_per_cell > get_vertices(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const override
virtual std::vector< Point< spacedim > > compute_mapping_support_points(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const override
virtual std::unique_ptr< Mapping< dim, spacedim > > clone() const override
virtual CellSimilarity::Similarity fill_fe_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const CellSimilarity::Similarity cell_similarity, const Quadrature< dim > &quadrature, const typename Mapping< dim, spacedim >::InternalDataBase &internal_data, internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data) const override
MappingQ1Eulerian(const DoFHandler< dim, spacedim > &euler_dof_handler, const VectorType &euler_vector)
virtual CellSimilarity::Similarity fill_fe_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const CellSimilarity::Similarity cell_similarity, const Quadrature< dim > &quadrature, const typename Mapping< dim, spacedim >::InternalDataBase &internal_data, internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data) const override
Definition mapping_q.cc:834
Definition point.h:111
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:503
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:504
Point< 3 > vertices[4]
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
typename ActiveSelector::cell_iterator cell_iterator
static std_cxx20::ranges::iota_view< unsigned int, unsigned int > vertex_indices()