/usr/include/deal.II/grid/manifold_lib.h is in libdeal.ii-dev 8.4.2-2+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | // ---------------------------------------------------------------------
//
// Copyright (C) 1999 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
// The deal.II library is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE at
// the top level of the deal.II distribution.
//
// ---------------------------------------------------------------------
#ifndef dealii__manifold_lib_h
#define dealii__manifold_lib_h
#include <deal.II/base/config.h>
#include <deal.II/grid/manifold.h>
#include <deal.II/base/function.h>
#include <deal.II/base/function_parser.h>
DEAL_II_NAMESPACE_OPEN
/**
* Manifold description for a spherical space coordinate system.
*
* You can use this Manifold object to describe any sphere, circle,
* hypersphere or hyperdisc in two or three dimensions, both as a co-dimension
* one manifold descriptor or as co-dimension zero manifold descriptor.
*
* The two template arguments match the meaning of the two template arguments
* in Triangulation<dim, spacedim>, however this Manifold can be used to
* describe both thin and thick objects, and the behavior is identical when
* dim <= spacedim, i.e., the functionality of SphericalManifold<2,3> is
* identical to SphericalManifold<3,3>.
*
* The two dimensional implementation of this class works by transforming
* points to spherical coordinates, taking the average in that coordinate
* system, and then transforming back the point to Cartesian coordinates. For
* the three dimensional case, we use a simpler approach: we take the average
* of the norm of the points, and use this value to shift the average point
* along the radial direction. In order for this manifold to work correctly,
* it cannot be attached to cells containing the center of the coordinate
* system. This point is a singular point of the coordinate transformation,
* and there taking averages does not make any sense.
*
* This class is used in step-1 and step-2 to describe the boundaries of
* circles. Its use is also discussed in the results section of step-6.
*
* @ingroup manifold
*
* @author Luca Heltai, 2014
*/
template <int dim, int spacedim = dim>
class SphericalManifold : public ChartManifold<dim, spacedim, spacedim>
{
public:
/**
* The Constructor takes the center of the spherical coordinates system.
* This class uses the pull_back and push_forward mechanism to transform
* from Cartesian to spherical coordinate systems, taking into account the
* periodicity of base Manifold in two dimensions, while in three dimensions
* it takes the middle point, and project it along the radius using the
* average radius of the surrounding points.
*/
SphericalManifold(const Point<spacedim> center = Point<spacedim>());
/**
* Pull back the given point from the Euclidean space. Will return the polar
* coordinates associated with the point @p space_point. Only used when
* spacedim = 2.
*/
virtual Point<spacedim>
pull_back(const Point<spacedim> &space_point) const;
/**
* Given a point in the spherical coordinate system, this method returns the
* Euclidean coordinates associated to the polar coordinates @p chart_point.
* Only used when spacedim = 3.
*/
virtual Point<spacedim>
push_forward(const Point<spacedim> &chart_point) const;
/**
* Let the new point be the average sum of surrounding vertices.
*
* In the two dimensional implementation, we use the pull_back and
* push_forward mechanism. For three dimensions, this does not work well, so
* we overload the get_new_point function directly.
*/
virtual Point<spacedim>
get_new_point(const Quadrature<spacedim> &quad) const;
/**
* The center of the spherical coordinate system.
*/
const Point<spacedim> center;
private:
/**
* Helper function which returns the periodicity associated with this
* coordinate system, according to dim, chartdim, and spacedim.
*/
static Point<spacedim> get_periodicity();
};
/**
* Cylindrical Manifold description. In three dimensions, points are
* transformed using a cylindrical coordinate system along the <tt>x-</tt>,
* <tt>y-</tt> or <tt>z</tt>-axis (when using the first constructor of this
* class), or an arbitrarily oriented cylinder described by the direction of
* its axis and a point located on the axis.
*
* This class was developed to be used in conjunction with the @p cylinder or
* @p cylinder_shell functions of GridGenerator. This function will throw an
* exception whenever spacedim is not equal to three.
*
* @ingroup manifold
*
* @author Luca Heltai, 2014
*/
template <int dim, int spacedim = dim>
class CylindricalManifold : public Manifold<dim,spacedim>
{
public:
/**
* Constructor. Using default values for the constructor arguments yields a
* cylinder along the x-axis (<tt>axis=0</tt>). Choose <tt>axis=1</tt> or
* <tt>axis=2</tt> for a tube along the y- or z-axis, respectively. The
* tolerance value is used to determine if a point is on the axis.
*/
CylindricalManifold (const unsigned int axis = 0,
const double tolerance = 1e-10);
/**
* Constructor. If constructed with this constructor, the manifold described
* is a cylinder with an axis that points in direction #direction and goes
* through the given #point_on_axis. The direction may be arbitrarily
* scaled, and the given point may be any point on the axis. The tolerance
* value is used to determine if a point is on the axis.
*/
CylindricalManifold (const Point<spacedim> &direction,
const Point<spacedim> &point_on_axis,
const double tolerance = 1e-10);
/**
* Compute new points on the CylindricalManifold. See the documentation of
* the base class for a detailed description of what this function does.
*/
virtual Point<spacedim>
get_new_point(const Quadrature<spacedim> &quad) const;
protected:
/**
* The direction vector of the axis.
*/
const Point<spacedim> direction;
/**
* An arbitrary point on the axis.
*/
const Point<spacedim> point_on_axis;
private:
/**
* Helper FlatManifold to compute tentative midpoints.
*/
FlatManifold<dim,spacedim> flat_manifold;
/**
* Relative tolerance to measure zero distances.
*/
double tolerance;
};
/**
* Manifold description derived from ChartManifold, based on explicit
* Function<spacedim> and Function<chartdim> objects describing the
* push_forward() and pull_back() functions.
*
* You can use this Manifold object to describe any arbitrary shape domain, as
* long as you can express it in terms of an invertible map, for which you
* provide both the forward expression, and the inverse expression.
*
* In debug mode, a check is performed to verify that the transformations are
* actually one the inverse of the other.
*
* @ingroup manifold
*
* @author Luca Heltai, 2014
*/
template <int dim, int spacedim=dim, int chartdim=dim>
class FunctionManifold : public ChartManifold<dim, spacedim, chartdim>
{
public:
/**
* Explicit functions constructor. Takes a push_forward function of spacedim
* components, and a pull_back function of @p chartdim components. See the
* documentation of the base class ChartManifold for the meaning of the
* optional @p periodicity argument.
*
* The tolerance argument is used in debug mode to actually check that the
* two functions are one the inverse of the other.
*/
FunctionManifold(const Function<chartdim> &push_forward_function,
const Function<spacedim> &pull_back_function,
const Point<chartdim> periodicity=Point<chartdim>(),
const double tolerance=1e-10);
/**
* Expressions constructor. Takes the expressions of the push_forward
* function of spacedim components, and of the pull_back function of @p
* chartdim components. See the documentation of the base class
* ChartManifold for the meaning of the optional @p periodicity argument.
*
* The strings should be the readable by the default constructor of the
* FunctionParser classes. You can specify custom variable expressions with
* the last two optional arguments. If you don't, the default names are
* used, i.e., "x,y,z".
*
* The tolerance argument is used in debug mode to actually check that the
* two functions are one the inverse of the other.
*/
FunctionManifold(const std::string push_forward_expression,
const std::string pull_back_expression,
const Point<chartdim> periodicity=Point<chartdim>(),
const typename FunctionParser<spacedim>::ConstMap = typename FunctionParser<spacedim>::ConstMap(),
const std::string chart_vars=FunctionParser<chartdim>::default_variable_names(),
const std::string space_vars=FunctionParser<spacedim>::default_variable_names(),
const double tolerance=1e-10);
/**
* If needed, we delete the pointers we own.
*/
~FunctionManifold();
/**
* Given a point in the @p chartdim coordinate system, uses the
* push_forward_function to compute the push_forward of points in @p
* chartdim space dimensions to @p spacedim space dimensions.
*/
virtual Point<spacedim>
push_forward(const Point<chartdim> &chart_point) const;
/**
* Given a point in the spacedim coordinate system, uses the
* pull_back_function to compute the pull_back of points in @p spacedim
* space dimensions to @p chartdim space dimensions.
*/
virtual Point<chartdim>
pull_back(const Point<spacedim> &space_point) const;
private:
/**
* Constants for the FunctionParser classes.
*/
const typename FunctionParser<spacedim>::ConstMap const_map;
/**
* Pointer to the push_forward function.
*/
SmartPointer<const Function<chartdim>,
FunctionManifold<dim,spacedim,chartdim> > push_forward_function;
/**
* Pointer to the pull_back function.
*/
SmartPointer<const Function<spacedim>,
FunctionManifold<dim,spacedim,chartdim> > pull_back_function;
/**
* Relative tolerance. In debug mode, we check that the two functions
* provided at construction time are actually one the inverse of the other.
* This value is used as relative tolerance in this check.
*/
const double tolerance;
/**
* Check ownership of the smart pointers. Indicates whether this class is
* the owner of the objects pointed to by the previous two member variables.
* This value is set in the constructor of the class. If @p true, then the
* destructor will delete the function objects pointed to be the two
* pointers.
*/
const bool owns_pointers;
};
DEAL_II_NAMESPACE_CLOSE
#endif
|