Reference documentation for deal.II version 9.1.0-pre
composition_manifold.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2016 - 2018 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_composition_manifold_h
17 #define dealii_composition_manifold_h
18 
19 
20 /*---------------------------- composition_manifold.h ------------*/
21 
22 #include <deal.II/base/config.h>
23 
24 #include <deal.II/base/derivative_form.h>
25 #include <deal.II/base/point.h>
26 #include <deal.II/base/quadrature_lib.h>
27 #include <deal.II/base/std_cxx14/memory.h>
28 #include <deal.II/base/subscriptor.h>
29 #include <deal.II/base/thread_management.h>
30 
31 #include <deal.II/grid/manifold.h>
32 #include <deal.II/grid/tria.h>
33 #include <deal.II/grid/tria_accessor.h>
34 #include <deal.II/grid/tria_iterator.h>
35 
36 DEAL_II_NAMESPACE_OPEN
37 
69 template <int dim,
70  int spacedim = dim,
71  int chartdim = dim,
72  int intermediate_dim = dim,
73  int dim1 = dim,
74  int dim2 = dim>
75 class CompositionManifold : public ChartManifold<dim, spacedim, chartdim>
76 {
77 public:
83 
87  virtual std::unique_ptr<Manifold<dim, spacedim>>
88  clone() const override;
89 
95  virtual Point<chartdim>
96  pull_back(const Point<spacedim> &space_point) const;
97 
98 
104  virtual Point<spacedim>
105  push_forward(const Point<chartdim> &chart_point) const;
106 
111  push_forward_gradient(const Point<chartdim> &chart_point) const;
112 
113 private:
117  SmartPointer<
120  F;
121 
122 
126  SmartPointer<
129  G;
130 };
131 
132 
133 /*------------------Template Implementations------------------------*/
134 
135 template <int dim,
136  int spacedim,
137  int chartdim,
138  int intermediate_dim,
139  int dim1,
140  int dim2>
144  : ChartManifold<dim, spacedim, chartdim>(F.get_periodicity())
145  , F(&F)
146  , G(&G)
147 {
148  // We don't know what to do with a periodicity in the second manifold, so
149  // throw an assertion if the second manifold is periodic
150  Assert(G.get_periodicity().norm() == 0.0,
151  ExcMessage("The second manifold cannot be periodic."));
152 }
153 
154 
155 template <int dim,
156  int spacedim,
157  int chartdim,
158  int intermediate_dim,
159  int dim1,
160  int dim2>
161 std::unique_ptr<Manifold<dim, spacedim>>
163  clone() const
164 {
165  return std_cxx14::make_unique<
167  *F, *G);
168 }
169 
170 
171 template <int dim,
172  int spacedim,
173  int chartdim,
174  int intermediate_dim,
175  int dim1,
176  int dim2>
179  pull_back(const Point<spacedim> &space_point) const
180 {
181  return F->pull_back(G->pull_back(space_point));
182 }
183 
184 
185 
186 template <int dim,
187  int spacedim,
188  int chartdim,
189  int intermediate_dim,
190  int dim1,
191  int dim2>
194  push_forward(const Point<chartdim> &chart_point) const
195 {
196  return G->push_forward(F->push_forward(chart_point));
197 }
198 
199 
200 
201 template <int dim,
202  int spacedim,
203  int chartdim,
204  int intermediate_dim,
205  int dim1,
206  int dim2>
209  push_forward_gradient(const Point<chartdim> &chart_point) const
210 {
212  F->push_forward_gradient(chart_point);
213 
215  G->push_forward_gradient(F->push_forward(chart_point));
216 
218 
219  for (unsigned int d = 0; d < spacedim; ++d)
220  for (unsigned int c = 0; c < chartdim; ++c)
221  for (unsigned int s = 0; s < intermediate_dim; ++s)
222  DF_DG[d][c] += DG[d][s] * DF[s][c];
223 
224  return DF_DG;
225 }
226 
227 
228 DEAL_II_NAMESPACE_CLOSE
229 
230 #endif
virtual Point< chartdim > pull_back(const Point< spacedim > &space_point) const
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
CompositionManifold(const ChartManifold< dim1, intermediate_dim, chartdim > &F, const ChartManifold< dim2, spacedim, intermediate_dim > &G)
SmartPointer< const ChartManifold< dim1, intermediate_dim, chartdim >, CompositionManifold< dim, spacedim, chartdim, dim1, dim2, intermediate_dim > > F
virtual Point< spacedim > push_forward(const Point< chartdim > &chart_point) const
virtual DerivativeForm< 1, chartdim, spacedim > push_forward_gradient(const Point< chartdim > &chart_point) const
Definition: point.h:106
static::ExceptionBase & ExcMessage(std::string arg1)
virtual DerivativeForm< 1, chartdim, spacedim > push_forward_gradient(const Point< chartdim > &chart_point) const
Definition: manifold.cc:1024
#define Assert(cond, exc)
Definition: exceptions.h:1227
SmartPointer< const ChartManifold< dim2, spacedim, intermediate_dim >, CompositionManifold< dim, spacedim, chartdim, dim1, dim2, intermediate_dim > > G
const Tensor< 1, chartdim > & get_periodicity() const
Definition: manifold.cc:1069
virtual Point< spacedim > push_forward(const Point< chartdim > &chart_point) const =0
virtual Point< chartdim > pull_back(const Point< spacedim > &space_point) const =0