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