/usr/include/deal.II/base/function_spherical.h is in libdeal.ii-dev 8.5.1-3.
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 | // ---------------------------------------------------------------------
//
// Copyright (C) 2016 - 2017 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__function_spherical_h
#define dealii__function_spherical_h
#include <deal.II/base/config.h>
#include <deal.II/base/function.h>
#include <deal.II/base/point.h>
#include <deal.II/base/std_cxx11/array.h>
DEAL_II_NAMESPACE_OPEN
namespace Functions
{
/**
* An abstract base class for a scalar-valued function $f=f(r,\theta,\phi)$
* defined in spherical coordinates. This class wraps transformation of values,
* gradients and hessians from spherical coordinates to the Cartesian coordinate
* system used by the Function base class.
* Therefore derived classes only need to implement those functions in
* spherical coordinates (specifically svalue(), sgradient() and
* shessian() ). The convention for angles is the same as in
* GeometricUtilities::Coordinates.
*
* @note This function is currently only implemented for dim==3 .
*
* @author Denis Davydov, 2017
*/
template <int dim>
class Spherical : public Function<dim>
{
public:
/**
* Constructor which should be provided with @p center defining the origin
* of the coordinate system.
*
* Note that components of this function are treated as entirely separate
* quantities -- not as the components of a vector that will be
* re-interpreted in a different coordinate system.
*/
Spherical(const Point<dim> ¢er = Point<dim>(),
const unsigned int n_components=1);
/**
* Return the value of the function at the given point.
*
* This function converts the given point to spherical coordinates,
* calls svalue() with it, and returns the result.
*/
virtual double value (const Point<dim> &point,
const unsigned int component = 0) const;
/**
* Return the gradient with respect to the Cartesian coordinates at point @p p.
*
* This function converts the given point to spherical coordinates,
* calls sgradient() with it, and converts the result into Cartesian
* coordinates.
*/
virtual Tensor<1,dim> gradient (const Point<dim> &p,
const unsigned int component = 0) const;
/**
* Return the Hessian with respect to the Cartesian coordinates at point @p p.
*
* This function converts the given point to spherical coordinates,
* calls sgradient and shessian() with it, and converts the result into
* Cartesian coordinates.
*/
virtual SymmetricTensor<2,dim> hessian (const Point<dim> &p,
const unsigned int component=0) const;
std::size_t memory_consumption () const;
private:
/**
* Return the value at point @p sp. Here, @p sp is provided in spherical
* coordinates.
*/
virtual double svalue(const std_cxx11::array<double, dim> &sp,
const unsigned int component) const;
/**
* Return the gradient in spherical coordinates.
*
* The returned object should contain derivatives in the following order:
* $\{ f_{,r},\, f_{,\theta},\, f_{,\phi}\}$.
*/
virtual std_cxx11::array<double, dim> sgradient(const std_cxx11::array<double, dim> &sp,
const unsigned int component) const;
/**
* Return the Hessian in spherical coordinates.
*
* The returned object should contain derivatives in the following order:
* $\{ f_{,rr},\, f_{,\theta\theta},\, f_{,\phi\phi},\, f_{,r\theta},\, f_{,r\phi},\, f_{,\theta\phi}\}$.
*/
virtual std_cxx11::array<double, 6> shessian (const std_cxx11::array<double, dim> &sp,
const unsigned int component) const;
/**
* A vector from the origin to the center of spherical coordinate system.
*/
const Tensor<1,dim> coordinate_system_offset;
};
}
DEAL_II_NAMESPACE_CLOSE
#endif
|