This file is indexed.

/usr/include/dune/pdelab/common/jacobiantocurl.hh is in libdune-pdelab-dev 2.0.0-1.

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
// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=8 sw=2 sts=2:
#ifndef DUNE_PDELAB_COMMON_JACOBIANTOCURL_HH
#define DUNE_PDELAB_COMMON_JACOBIANTOCURL_HH

#include <cstddef>

#include <dune/common/fvector.hh>
#include <dune/common/static_assert.hh>

namespace Dune {
  namespace PDELab {

    //! extract the curl of a function from the jacobian of that function
    /**
     * In 3D the curl \f$A=\nabla\times B\f$ is defined as
     * \f{align*}{
     *   a_x = \partial_yb_z-\partial_zb_y \\
     *   a_y = \partial_zb_x-\partial_xb_z \\
     *   a_z = \partial_xb_y-\partial_yb_x
     * \f}
     * In lower dimensions, some of the coordinates may be missing (because
     * the quantity does not vary in that direction), and some of the
     * quantity's components vanish and are thus missing as well.
     */
    template<typename Jacobian, std::size_t dimR = Jacobian::rows,
             std::size_t dimD = Jacobian::cols>
    class JacobianToCurl;

    //! \brief extract the curl of a 1D-valued function in 2D from the
    //!        jacobian of that function
    /**
     * The two coordinates are the \f$x\f$- and \f$y\f$ coordinates and the
     * one value component is the \f$z\f$-component of the quantity.  It is
     * assumed that the quantity shows no variation in the \f$z\f$-direction
     * (thus \f$\partial_z=0\f$) and that its \f$x\f$- and \f$y\f$-components
     * vanish.  From the general 3D formula for the curl
     * \f{align*}{
     *   A &=\nabla\times B \\
     *     & \Downarrow \\
     *   a_x &= \partial_yb_z-\partial_zb_y \\
     *   a_y &= \partial_zb_x-\partial_xb_z \\
     *   a_z &= \partial_xb_y-\partial_yb_x
     * \f}
     * only the first two survive:
     * \f{align*}{
     *   a_x &=  \partial_yb_z \\
     *   a_y &= -\partial_xb_z
     * \f}
     * Replacing \f$x\f$, \f$y\f$ and \f$z\f$ by the apropriate indices yields
     * \f{align*}{
     *   a_0 &=  \partial_1b_0 \\
     *   a_1 &= -\partial_0b_0
     * \f}
     */
    template<typename Jacobian>
    class JacobianToCurl<Jacobian, 1, 2> {
      dune_static_assert
      ( Jacobian::rows == 1 && Jacobian::cols == 2, "This specialization "
        "works only for dimRange == 1 and dimDomain == 2");

    public:
      typedef typename Jacobian::block_type CurlField;
      static const std::size_t dimCurl = 2;
      typedef FieldVector<CurlField, dimCurl> Curl;

      void operator()(const Jacobian& jacobian, Curl& curl) const {
        curl[0] =  jacobian[0][1];
        curl[1] = -jacobian[0][0];
      }
    };

    //! \brief extract the curl of a 2D-valued function in 2D from the
    //!        jacobian of that function
    /**
     * The two coordinates are the \f$x\f$- and \f$y\f$ coordinates and the
     * two value components the \f$x\f$- and \f$y\f$-components of the
     * quantity.  It is assumed that the quantity shows no variation in the
     * \f$z\f$-direction (thus \f$\partial_z=0\f$) and that its
     * \f$z\f$-component vanishes.  From the general 3D formula for the curl
     * \f{align*}{
     *   A &=\nabla\times B \\
     *     & \Downarrow \\
     *   a_x &= \partial_yb_z-\partial_zb_y \\
     *   a_y &= \partial_zb_x-\partial_xb_z \\
     *   a_z &= \partial_xb_y-\partial_yb_x
     * \f}
     * only the last survives:
     * \f{align*}{
     *   a_z &= \partial_xb_y-\partial_yb_x
     * \f}
     * Replacing \f$x\f$, \f$y\f$ and \f$z\f$ by the apropriate indices yields
     * \f{align*}{
     *   a_0 &= \partial_0b_1-\partial_1b_0
     * \f}
     */
    template<typename Jacobian>
    class JacobianToCurl<Jacobian, 2, 2> {
      dune_static_assert
      ( Jacobian::rows == 2 && Jacobian::cols == 2, "This specialization "
        "works only for dimRange == 2 and dimDomain == 2");

    public:
      typedef typename Jacobian::block_type CurlField;
      static const std::size_t dimCurl = 1;
      typedef FieldVector<CurlField, dimCurl> Curl;

      void operator()(const Jacobian& jacobian, Curl& curl) const {
        curl[0] = jacobian[1][0]-jacobian[0][1];
      }
    };

    //! \brief extract the curl of a 3D-valued function in 3D from the
    //!        jacobian of that function
    /**
     * In the general 3D formula for the curl
     * \f{align*}{
     *   A &=\nabla\times B \\
     *     & \Downarrow \\
     *   a_x &= \partial_yb_z-\partial_zb_y \\
     *   a_y &= \partial_zb_x-\partial_xb_z \\
     *   a_z &= \partial_xb_y-\partial_yb_x
     * \f}
     * we just need to replace \f$x\f$, \f$y\f$ and \f$z\f$ by the apropriate
     * indices
     * \f{align*}{
     *   a_0 &= \partial_1b_2-\partial_2b_1 \\
     *   a_1 &= \partial_2b_0-\partial_0b_2 \\
     *   a_2 &= \partial_0b_1-\partial_1b_0
     * \f}
     */
    template<typename Jacobian>
    class JacobianToCurl<Jacobian, 3, 3> {
      dune_static_assert
      ( Jacobian::rows == 3 && Jacobian::cols == 3, "This specialization "
        "works only for dimRange == 3 and dimDomain == 3");

    public:
      typedef typename Jacobian::block_type CurlField;
      static const std::size_t dimCurl = 3;
      typedef FieldVector<CurlField, dimCurl> Curl;

      void operator()(const Jacobian& jacobian, Curl& curl) const {
        for(std::size_t alpha = 0; alpha < 3; ++alpha) {
          std::size_t beta  = (alpha+1)%3;
          std::size_t gamma = (alpha+2)%3;
          curl[alpha] = jacobian[gamma][beta]-jacobian[beta][gamma];
        }
      }
    };

  } // namespace PDELab
} //namespace Dune

#endif // DUNE_PDELAB_COMMON_JACOBIANTOCURL_HH