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
fe_immersed_values.cc
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2021 - 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
16
18
20
21
23namespace NonMatching
24{
25 template <int dim>
27 const Mapping<dim> &mapping,
28 const FiniteElement<dim> &element,
29 const ImmersedSurfaceQuadrature<dim> &quadrature,
30 const UpdateFlags update_flags)
31 : FEValuesBase<dim, dim>(quadrature.size(),
32 element.dofs_per_cell,
34 mapping,
35 element)
36 , quadrature(quadrature)
37 {
39 }
40
41
42
43 template <int dim>
44 void
46 const typename Triangulation<dim>::cell_iterator &cell)
47 {
48 // Check that mapping and reference cell type are compatible:
49 Assert(this->get_mapping().is_compatible_with(cell->reference_cell()),
51 "You are trying to call FEImmersedSurfaceValues::reinit() with "
52 " a cell of type " +
53 cell->reference_cell().to_string() +
54 " with a Mapping that is not compatible with it."));
55
56 // No FE in this cell, so no assertion necessary here.
57 Assert(
58 this->present_cell.is_initialized() == false,
60 "FEImmersedSurfaceValues::reinit() can only be used for one cell!"));
61
62 this->present_cell = {cell};
63
64 // This was the part of the work that is dependent on the actual data type
65 // of the iterator. Now pass on to the function doing the real work.
66 do_reinit();
67 }
68
69
70
71 template <int dim>
72 template <bool level_dof_access>
73 void
76 {
77 // Check that mapping and reference cell type are compatible:
78 Assert(this->get_mapping().is_compatible_with(cell->reference_cell()),
80 "You are trying to call FEImmersedSurfaceValues::reinit() with "
81 "a cell of type " +
82 cell->reference_cell().to_string() +
83 " with a Mapping that is not compatible with it."));
84
85 // Assert that the finite elements passed to the constructor and used by the
86 // DoFHandler used by this cell, are the same
87 Assert(static_cast<const FiniteElementData<dim> &>(*this->fe) ==
88 static_cast<const FiniteElementData<dim> &>(cell->get_fe()),
90
91 Assert(
92 this->present_cell.is_initialized() == false,
94 "FEImmersedSurfaceValues::reinit() can only be used for one cell!"));
95
96 this->present_cell = {cell};
97
98 // This was the part of the work that is dependent on the actual data type
99 // of the iterator. Now pass on to the function doing the real work.
100 do_reinit();
101 }
102
103
104
105 template <int dim>
106 void
108 {
109 // First call the mapping and let it generate the data specific to the
110 // mapping.
111 if (this->update_flags & update_mapping)
112 {
113 this->get_mapping().fill_fe_immersed_surface_values(
114 this->present_cell,
115 quadrature,
116 *this->mapping_data,
117 this->mapping_output);
118 }
119
120 // Call the finite element and, with the data already filled by the mapping,
121 // let it compute the data for the mapped shape function values, gradients
122 // etc.
123 this->get_fe().fill_fe_values(this->present_cell,
125 this->quadrature,
126 this->get_mapping(),
127 *this->mapping_data,
128 this->mapping_output,
129 *this->fe_data,
130 this->finite_element_output);
131 }
132
133
134
135 template <int dim>
138 const unsigned int function_no,
139 const unsigned int quadrature_point) const
140 {
141 const unsigned int component = 0;
142 return shape_surface_grad_component(function_no,
143 quadrature_point,
144 component);
145 }
146
147
148
149 template <int dim>
152 const unsigned int function_no,
153 const unsigned int quadrature_point,
154 const unsigned int component) const
155 {
156 const Tensor<1, dim> gradient =
157 this->shape_grad_component(function_no, quadrature_point, component);
158 const Tensor<1, dim> &normal = this->normal_vector(quadrature_point);
159
160 return gradient - (normal * gradient) * normal;
161 }
162
163
164
165 template <int dim>
168 {
169 return quadrature;
170 }
171
172
173
174 template <int dim>
175 inline void
177 {
178 UpdateFlags flags = this->compute_update_flags(update_flags);
179
180 if ((flags & (update_JxW_values | update_normal_vectors)) != 0u)
182
183 // Initialize the base classes.
184 if ((flags & update_mapping) != 0u)
185 this->mapping_output.initialize(this->n_quadrature_points, flags);
186 this->finite_element_output.initialize(this->n_quadrature_points,
187 *this->fe,
188 flags);
189
190 // Then get objects into which the FE and the Mapping can store
191 // intermediate data used across calls to reinit. We can do this in
192 // parallel.
194 std::unique_ptr<typename FiniteElement<dim, dim>::InternalDataBase>>
196 *this->fe,
197 flags,
198 *this->mapping,
199 this->quadrature,
200 this->finite_element_output);
201
203 mapping_get_data;
204 if ((flags & update_mapping) != 0u)
205 mapping_get_data = Threads::new_task(&Mapping<dim>::get_data,
206 *this->mapping,
207 flags,
208 this->quadrature);
209
210 this->update_flags = flags;
211
212 // Then collect answers from the two task above.
213 this->fe_data = std::move(fe_get_data.return_value());
214 if ((flags & update_mapping) != 0u)
215 this->mapping_data = std::move(mapping_get_data.return_value());
216 else
217 this->mapping_data =
218 std::make_unique<typename Mapping<dim>::InternalDataBase>();
219 }
220
221
222#ifndef DOXYGEN
223# include "fe_immersed_values.inst"
224#endif
225
226} // namespace NonMatching
Abstract base class for mapping classes.
Definition mapping.h:318
void reinit(const typename Triangulation< dim >::cell_iterator &cell)
void initialize(const UpdateFlags update_flags)
Tensor< 1, dim > shape_surface_grad_component(const unsigned int function_no, const unsigned int quadrature_point, const unsigned int component) const
Tensor< 1, dim > shape_surface_grad(const unsigned int function_no, const unsigned int quadrature_point) const
const NonMatching::ImmersedSurfaceQuadrature< dim > & get_quadrature() const
FEImmersedSurfaceValues(const Mapping< dim > &mapping, const FiniteElement< dim > &element, const ImmersedSurfaceQuadrature< dim > &quadrature, const UpdateFlags update_flags)
internal::return_value< RT >::reference_type return_value()
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:503
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:504
#define Assert(cond, exc)
static ::ExceptionBase & ExcMessage(std::string arg1)
UpdateFlags
@ update_normal_vectors
Normal vectors.
@ update_JxW_values
Transformed quadrature weights.
@ update_covariant_transformation
Covariant transformation.
@ update_mapping
@ update_default
No update.
Task< RT > new_task(const std::function< RT()> &function)