ASPECT
compat.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2015 - 2024 by the authors of the ASPECT code.
3 
4  This file is part of ASPECT.
5 
6  ASPECT is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2, or (at your option)
9  any later version.
10 
11  ASPECT is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with ASPECT; see the file LICENSE. If not see
18  <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef _aspect_compat_h
22 #define _aspect_compat_h
23 
24 #include <aspect/global.h>
25 // C++11 related includes.
26 #include <array>
27 #include <functional>
28 #include <memory>
29 
30 namespace big_mpi
31 {
32 
33  using ::Utilities::MPI::broadcast;
34 
35 }
36 
37 // deal.II 9.6 introduces the new MGTransferMF class as a replacement
38 // for MGTransferMatrixFree. Instead of putting an ifdef in every place,
39 // do this in one central location:
40 #if !DEAL_II_VERSION_GTE(9,6,0)
41 #include <deal.II/multigrid/mg_transfer_matrix_free.h>
42 namespace dealii
43 {
44  template <int dim, class NumberType>
45  using MGTransferMF = MGTransferMatrixFree<dim,NumberType>;
46 }
47 #endif
48 
49 
50 
51 // deal.II versions up to 9.5 had a poorly designed interface of the
52 // SphericalManifold class that made it impossible for us to use.
53 // This file thus contains a copy of it.
54 #if !DEAL_II_VERSION_GTE(9,6,0)
55 
56 #include <deal.II/grid/manifold.h>
57 #include <deal.II/grid/manifold_lib.h>
58 
59 namespace aspect
60 {
61  using namespace dealii;
62 
71  template <int dim, int spacedim = dim>
72  class SphericalManifold : public Manifold<dim, spacedim>
73  {
74  public:
81  SphericalManifold(const Point<spacedim> center = Point<spacedim>());
82 
86  virtual std::unique_ptr<Manifold<dim, spacedim>>
87  clone() const override;
88 
96  virtual Point<spacedim>
97  get_intermediate_point(const Point<spacedim> &p1,
98  const Point<spacedim> &p2,
99  const double w) const override;
100 
105  virtual Tensor<1, spacedim>
106  get_tangent_vector(const Point<spacedim> &x1,
107  const Point<spacedim> &x2) const override;
108 
112  virtual Tensor<1, spacedim>
113  normal_vector(
114  const typename Triangulation<dim, spacedim>::face_iterator &face,
115  const Point<spacedim> &p) const override;
116 
120  virtual void
121  get_normals_at_vertices(
122  const typename Triangulation<dim, spacedim>::face_iterator &face,
123  typename Manifold<dim, spacedim>::FaceVertexNormals &face_vertex_normals)
124  const override;
125 
140  virtual void
141  get_new_points(const ArrayView<const Point<spacedim>> &surrounding_points,
142  const Table<2, double> &weights,
143  ArrayView<Point<spacedim>> new_points) const override;
144 
149  virtual Point<spacedim>
150  get_new_point(const ArrayView<const Point<spacedim>> &vertices,
151  const ArrayView<const double> &weights) const override;
152 
156  const Point<spacedim> center;
157 
158  private:
165  std::pair<double, Tensor<1, spacedim>>
166  guess_new_point(const ArrayView<const Tensor<1, spacedim>> &directions,
167  const ArrayView<const double> &distances,
168  const ArrayView<const double> &weights) const;
169 
187  void
188  do_get_new_points(const ArrayView<const Point<spacedim>> &surrounding_points,
189  const ArrayView<const double> &weights,
190  ArrayView<Point<spacedim>> new_points) const;
191 
195  const PolarManifold<spacedim> polar_manifold;
196  };
197 }
198 
199 #else
200 
201 // For sufficiently new deal.II versions, we can use the deal.II class, but to
202 // avoid name clashes, we have to import the class into namespace aspect. Once
203 // we rely on these sufficiently new versions of deal.II, we can not only remove
204 // the code above, but also the following lines, and in all places where we
205 // reference 'aspect::SphericalManifold' simply use 'SphericalManifold' instead
206 // (which then refers to the deal.II class).
207 
208 #include <deal.II/grid/manifold_lib.h>
209 namespace aspect
210 {
211  using ::SphericalManifold;
212 }
213 
214 #endif
215 
216 #endif
MGTransferMatrixFree< dim, NumberType > MGTransferMF
Definition: compat.h:45
const PolarManifold< spacedim > polar_manifold
Definition: compat.h:195
Definition: compat.h:59
const Point< spacedim > center
Definition: compat.h:156
Definition: compat.h:30
Definition: compat.h:42