Reference documentation for deal.II version 9.0.0
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 at
12 // the top level of the deal.II distribution.
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 #include <deal.II/base/subscriptor.h>
24 #include <deal.II/base/quadrature_lib.h>
25 #include <deal.II/base/thread_management.h>
26 #include <deal.II/base/point.h>
27 #include <deal.II/base/derivative_form.h>
28 #include <deal.II/base/std_cxx14/memory.h>
29 #include <deal.II/grid/tria.h>
30 #include <deal.II/grid/tria_iterator.h>
31 #include <deal.II/grid/tria_accessor.h>
32 #include <deal.II/grid/manifold.h>
33 
34 DEAL_II_NAMESPACE_OPEN
35 
67 template <int dim, int spacedim=dim, int chartdim=dim,
68  int intermediate_dim=dim, int dim1=dim, int dim2=dim>
69 class CompositionManifold : public ChartManifold<dim, spacedim, chartdim>
70 {
71 public:
72 
78 
82  virtual std::unique_ptr<Manifold<dim, spacedim> > clone() const override;
83 
89  virtual
91  pull_back(const Point<spacedim> &space_point) const;
92 
93 
99  virtual
101  push_forward(const Point<chartdim> &chart_point) const;
102 
106  virtual
108  push_forward_gradient(const Point<chartdim> &chart_point) const;
109 
110 private:
116 
117 
123 };
124 
125 
126 /*------------------Template Implementations------------------------*/
127 
128 template <int dim, int spacedim, int chartdim, int intermediate_dim,
129  int dim1, int dim2>
133  ChartManifold<dim,spacedim,chartdim>(F.get_periodicity()),
134  F(&F),
135  G(&G)
136 {
137  // We don't know what to do with a periodicity in the second manifold, so
138  // throw an assertion if the second manifold is periodic
139  Assert(G.get_periodicity().norm() == 0.0,
140  ExcMessage("The second manifold cannot be periodic."));
141 }
142 
143 
144 template <int dim, int spacedim, int chartdim, int intermediate_dim,
145  int dim1, int dim2>
146 std::unique_ptr<Manifold<dim,spacedim> >
148 {
149  return std_cxx14::make_unique<CompositionManifold<dim,spacedim,chartdim,intermediate_dim,dim1,dim2> >(*F, *G);
150 }
151 
152 
153 template <int dim, int spacedim, int chartdim, int intermediate_dim,
154  int dim1, int dim2>
157 {
158  return F->pull_back(G->pull_back(space_point));
159 }
160 
161 
162 
163 template <int dim, int spacedim, int chartdim, int intermediate_dim,
164  int dim1, int dim2>
167 {
168  return G->push_forward(F->push_forward(chart_point));
169 }
170 
171 
172 
173 template <int dim, int spacedim, int chartdim, int intermediate_dim,
174  int dim1, int dim2>
177 {
179  F->push_forward_gradient(chart_point);
180 
182  G->push_forward_gradient(F->push_forward(chart_point));
183 
185 
186  for (unsigned int d=0; d<spacedim; ++d)
187  for (unsigned int c=0; c<chartdim; ++c)
188  for (unsigned int s=0; s<intermediate_dim; ++s)
189  DF_DG[d][c] += DG[d][s]*DF[s][c];
190 
191  return DF_DG;
192 }
193 
194 
195 DEAL_II_NAMESPACE_CLOSE
196 
197 #endif
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
SmartPointer< const ChartManifold< dim2, spacedim, intermediate_dim >, CompositionManifold< dim, spacedim, chartdim, dim1, dim2, intermediate_dim > > G
virtual Point< chartdim > pull_back(const Point< spacedim > &space_point) const
CompositionManifold(const ChartManifold< dim1, intermediate_dim, chartdim > &F, const ChartManifold< dim2, spacedim, intermediate_dim > &G)
Definition: point.h:104
virtual DerivativeForm< 1, chartdim, spacedim > push_forward_gradient(const Point< chartdim > &chart_point) const
static ::ExceptionBase & ExcMessage(std::string arg1)
virtual DerivativeForm< 1, chartdim, spacedim > push_forward_gradient(const Point< chartdim > &chart_point) const
Definition: manifold.cc:1009
#define Assert(cond, exc)
Definition: exceptions.h:1142
const Tensor< 1, chartdim > & get_periodicity() const
Definition: manifold.cc:1050
virtual Point< spacedim > push_forward(const Point< chartdim > &chart_point) const
virtual Point< spacedim > push_forward(const Point< chartdim > &chart_point) const =0
virtual Point< chartdim > pull_back(const Point< spacedim > &space_point) const =0
SmartPointer< const ChartManifold< dim1, intermediate_dim, chartdim >, CompositionManifold< dim, spacedim, chartdim, dim1, dim2, intermediate_dim > > F