Reference documentation for deal.II version 9.3.3
\(\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\}}\)
tensor_product_manifold.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (C) 2016 - 2020 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#ifndef dealii_tensor_product_manifold_h
17#define dealii_tensor_product_manifold_h
18
19#include <deal.II/base/config.h>
20
21#include <deal.II/base/point.h>
24
26
27#include <memory>
28
30
31
32
63template <int dim,
64 int dim_A,
65 int spacedim_A,
66 int chartdim_A,
67 int dim_B,
68 int spacedim_B,
69 int chartdim_B>
71 : public ChartManifold<dim, spacedim_A + spacedim_B, chartdim_A + chartdim_B>
72{
73public:
78 static const unsigned int chartdim = chartdim_A + chartdim_B;
83 static const unsigned int spacedim = spacedim_A + spacedim_B;
84
91
95 virtual std::unique_ptr<Manifold<dim, spacedim_A + spacedim_B>>
96 clone() const override;
97
101 virtual Point<chartdim>
102 pull_back(const Point<spacedim> &space_point) const override;
103
107 virtual Point<spacedim>
108 push_forward(const Point<chartdim> &chart_point) const override;
109
114 push_forward_gradient(const Point<chartdim> &chart_point) const override;
115
116private:
117 std::unique_ptr<const ChartManifold<dim_A, spacedim_A, chartdim_A>>
119
120 std::unique_ptr<const ChartManifold<dim_B, spacedim_B, chartdim_B>>
122};
123
124
125
126/*------------------Template Implementations------------------------*/
127
128
129
130namespace internal
131{
132 namespace TensorProductManifoldImplementation
133 {
134 template <int dim1, int dim2>
137 {
139 for (unsigned int d = 0; d < dim1; ++d)
140 r[d] = p1[d];
141 for (unsigned int d = 0; d < dim2; ++d)
142 r[dim1 + d] = p2[d];
143 return r;
144 }
145
146 template <int dim1, int dim2>
148 concat(const Point<dim1> &p1, const Point<dim2> &p2)
149 {
151 for (unsigned int d = 0; d < dim1; ++d)
152 r[d] = p1[d];
153 for (unsigned int d = 0; d < dim2; ++d)
154 r[dim1 + d] = p2[d];
155 return r;
156 }
157
158 template <int dim1, int dim2>
159 void
161 Point<dim1> & p1,
162 Point<dim2> & p2)
163 {
164 for (unsigned int d = 0; d < dim1; ++d)
165 p1[d] = source[d];
166 for (unsigned int d = 0; d < dim2; ++d)
167 p2[d] = source[dim1 + d];
168 }
169
170 } // namespace TensorProductManifoldImplementation
171} // namespace internal
172
173template <int dim,
174 int dim_A,
175 int spacedim_A,
176 int chartdim_A,
177 int dim_B,
178 int spacedim_B,
179 int chartdim_B>
181 dim_A,
182 spacedim_A,
183 chartdim_A,
184 dim_B,
185 spacedim_B,
186 chartdim_B>::
187 TensorProductManifold(
190 : ChartManifold<dim, spacedim_A + spacedim_B, chartdim_A + chartdim_B>(
191 internal::TensorProductManifoldImplementation::concat(
192 manifold_A.get_periodicity(),
193 manifold_B.get_periodicity()))
194 , manifold_A(Utilities::dynamic_unique_cast<
195 ChartManifold<dim_A, spacedim_A, chartdim_A>,
196 Manifold<dim_A, spacedim_A>>(manifold_A.clone()))
197 , manifold_B(Utilities::dynamic_unique_cast<
198 ChartManifold<dim_B, spacedim_B, chartdim_B>,
199 Manifold<dim_B, spacedim_B>>(manifold_B.clone()))
200{}
201
202template <int dim,
203 int dim_A,
204 int spacedim_A,
205 int chartdim_A,
206 int dim_B,
207 int spacedim_B,
208 int chartdim_B>
209std::unique_ptr<Manifold<dim, spacedim_A + spacedim_B>>
211 dim_A,
212 spacedim_A,
213 chartdim_A,
214 dim_B,
215 spacedim_B,
216 chartdim_B>::clone() const
217{
218 return std::make_unique<TensorProductManifold<dim,
219 dim_A,
220 spacedim_A,
221 chartdim_A,
222 dim_B,
223 spacedim_B,
224 chartdim_B>>(*manifold_A,
225 *manifold_B);
226}
227
228template <int dim,
229 int dim_A,
230 int spacedim_A,
231 int chartdim_A,
232 int dim_B,
233 int spacedim_B,
234 int chartdim_B>
236 dim_A,
237 spacedim_A,
238 chartdim_A,
239 dim_B,
240 spacedim_B,
241 chartdim_B>::chartdim>
243 dim_A,
244 spacedim_A,
245 chartdim_A,
246 dim_B,
247 spacedim_B,
248 chartdim_B>::
251 dim_A,
252 spacedim_A,
253 chartdim_A,
254 dim_B,
255 spacedim_B,
256 chartdim_B>::spacedim> &space_point) const
257{
258 Point<spacedim_A> space_point_A;
259 Point<spacedim_B> space_point_B;
261 space_point_A,
262 space_point_B);
263
264 Point<chartdim_A> result_A = manifold_A->pull_back(space_point_A);
265 Point<chartdim_B> result_B = manifold_B->pull_back(space_point_B);
266
268 result_B);
269}
270
271template <int dim,
272 int dim_A,
273 int spacedim_A,
274 int chartdim_A,
275 int dim_B,
276 int spacedim_B,
277 int chartdim_B>
279 dim_A,
280 spacedim_A,
281 chartdim_A,
282 dim_B,
283 spacedim_B,
284 chartdim_B>::spacedim>
286 dim_A,
287 spacedim_A,
288 chartdim_A,
289 dim_B,
290 spacedim_B,
291 chartdim_B>::
294 dim_A,
295 spacedim_A,
296 chartdim_A,
297 dim_B,
298 spacedim_B,
299 chartdim_B>::chartdim> &chart_point) const
300{
301 Point<chartdim_A> chart_point_A;
302 Point<chartdim_B> chart_point_B;
304 chart_point_A,
305 chart_point_B);
306
307 Point<spacedim_A> result_A = manifold_A->push_forward(chart_point_A);
308 Point<spacedim_B> result_B = manifold_B->push_forward(chart_point_B);
309
311 result_B);
312}
313
314template <int dim,
315 int dim_A,
316 int spacedim_A,
317 int chartdim_A,
318 int dim_B,
319 int spacedim_B,
320 int chartdim_B>
323 dim_A,
324 spacedim_A,
325 chartdim_A,
326 dim_B,
327 spacedim_B,
328 chartdim_B>::chartdim,
330 dim_A,
331 spacedim_A,
332 chartdim_A,
333 dim_B,
334 spacedim_B,
335 chartdim_B>::spacedim>
336
338 dim_A,
339 spacedim_A,
340 chartdim_A,
341 dim_B,
342 spacedim_B,
343 chartdim_B>::
344 push_forward_gradient(
346 dim_A,
347 spacedim_A,
348 chartdim_A,
349 dim_B,
350 spacedim_B,
351 chartdim_B>::chartdim> &chart_point) const
352{
353 Point<chartdim_A> chart_point_A;
354 Point<chartdim_B> chart_point_B;
356 chart_point_A,
357 chart_point_B);
358
360 manifold_A->push_forward_gradient(chart_point_A);
362 manifold_B->push_forward_gradient(chart_point_B);
363
364
366 for (unsigned int i = 0; i < chartdim_A; ++i)
367 for (unsigned int j = 0; j < spacedim_A; ++j)
368 result[j][i] = result_A[j][i];
369 for (unsigned int i = 0; i < chartdim_B; ++i)
370 for (unsigned int j = 0; j < spacedim_B; ++j)
371 result[j + spacedim_A][i + chartdim_A] = result_B[j][i];
372
373 return result;
374}
375
376
377
379
380#endif
Definition: point.h:111
Tensor product manifold of two ChartManifolds.
static const unsigned int chartdim
virtual Point< spacedim > push_forward(const Point< chartdim > &chart_point) const override
virtual DerivativeForm< 1, chartdim, spacedim > push_forward_gradient(const Point< chartdim > &chart_point) const override
static const unsigned int spacedim
virtual Point< chartdim > pull_back(const Point< spacedim > &space_point) const override
TensorProductManifold(const ChartManifold< dim_A, spacedim_A, chartdim_A > &manifold_A, const ChartManifold< dim_B, spacedim_B, chartdim_B > &manifold_B)
virtual std::unique_ptr< Manifold< dim, spacedim_A+spacedim_B > > clone() const override
std::unique_ptr< const ChartManifold< dim_B, spacedim_B, chartdim_B > > manifold_B
std::unique_ptr< const ChartManifold< dim_A, spacedim_A, chartdim_A > > manifold_A
Definition: tensor.h:472
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:402
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:403
Point< dim > push_forward(const TopoDS_Shape &in_shape, const double u, const double v)
Definition: utilities.cc:827
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
Tensor< 1, dim, Number > pull_back(const Tensor< 1, dim, Number > &v, const Tensor< 2, dim, Number > &F)
std::unique_ptr< To > dynamic_unique_cast(std::unique_ptr< From > &&p)
Definition: utilities.h:1403
Point< dim1+dim2 > concat(const Point< dim1 > &p1, const Point< dim2 > &p2)
Tensor< 1, dim1+dim2 > concat(const Tensor< 1, dim1 > &p1, const Tensor< 1, dim2 > &p2)
void split_point(const Point< dim1+dim2 > &source, Point< dim1 > &p1, Point< dim2 > &p2)