This file is indexed.

/usr/include/dune/functions/gridfunctions/gridfunction.hh is in libdune-functions-dev 2.5.1-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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_FUNCTIONS_GRIDFUNCTIONS_GRID_FUNCTION_HH
#define DUNE_FUNCTIONS_GRIDFUNCTIONS_GRID_FUNCTION_HH

#include <type_traits>

#include <dune/common/typeutilities.hh>

#include <dune/functions/common/typeerasure.hh>
#include <dune/functions/common/defaultderivativetraits.hh>
#include <dune/functions/common/differentiablefunction.hh>
#include <dune/functions/common/localfunction.hh>
#include <dune/functions/common/functionconcepts.hh>
#include <dune/functions/gridfunctions/localderivativetraits.hh>
#include <dune/functions/gridfunctions/gridfunction_imp.hh>



namespace Dune {
namespace Functions {



/*
 * Default implementation is empty
 * The actual implementation is only given if Signature is an type
 * describing a function signature as Range(Domain).
 */
template<class Signature, class EntitySet, template<class> class DerivativeTraits=DefaultDerivativeTraits, size_t bufferSize=56>
class GridFunction
{};



namespace Imp
{

  /// Traits class providing type information for DifferentiableFunction
  template<class S, class ES, template<class> class DerivativeTraits, size_t bufferSize>
  struct GridFunctionTraits :
    DifferentiableFunctionTraits<S, DerivativeTraits, bufferSize>
  {
  protected:
    using Base=DifferentiableFunctionTraits<S, DerivativeTraits, bufferSize>;

  public:
    /// EntitySet the GridFunction lives on
    using EntitySet = ES;

    /// Element type of EntitySet
    using Element = typename EntitySet::Element;

    /// Signature of the derivative
    using DerivativeSignature = typename Base::DerivativeSignature;

    /// Interface type of the derivative
    using DerivativeInterface = GridFunction<DerivativeSignature, ES, DerivativeTraits, bufferSize>;

    /// Signature of the derivative
    using LocalSignature = typename Base::Range(typename EntitySet::LocalCoordinate);

    template<class R>
    using LocalDerivativeTraits = typename Dune::Functions::LocalDerivativeTraits<EntitySet, DerivativeTraits>::template Traits<R>;

    /// LocalFunctionTraits associated with this type
    using LocalFunctionTraits = typename Dune::Functions::Imp::LocalFunctionTraits<LocalSignature, Element, LocalDerivativeTraits, bufferSize>;

    /// Interface type of the local function
    using LocalFunctionInterface = LocalFunction<LocalSignature, Element, LocalDerivativeTraits, bufferSize>;

    /// Internal concept type for type erasure
    using Concept = GridFunctionWrapperInterface<S, DerivativeInterface, LocalFunctionInterface, ES>;

    /// Internal model template for type erasure
    template<class B>
    using Model = GridFunctionWrapperImplementation<S, DerivativeInterface, LocalFunctionInterface, ES, B>;
  };
}



/**
 * \brief Wrapper class for functions defined on a Grid
 *
 * \ingroup FunctionInterface
 *
 * Being defined on a grid means in particular that you can evaluate the function
 * in local coordinates of a given entities of the grid. The set of the entities
 * this function is defined on is given by an EntitySet.
 *
 * This models the \ref Concept::GridFunction<Range(Domain), EntitySet, DerivativeTraits> concept.
 */
template<class Range, class Domain, class ES, template<class> class DerivativeTraits, size_t bufferSize>
class GridFunction<Range(Domain), ES, DerivativeTraits, bufferSize> :
  public TypeErasureBase<
    typename Imp::GridFunctionTraits<Range(Domain), ES, DerivativeTraits, bufferSize>::Concept,
    Imp::GridFunctionTraits<Range(Domain), ES, DerivativeTraits, bufferSize>::template Model>
{
  using Traits = Imp::GridFunctionTraits<Range(Domain), ES, DerivativeTraits, bufferSize>;

  using Base = TypeErasureBase<typename Traits::Concept, Traits::template Model>;

  using DerivativeInterface = typename Traits::DerivativeInterface;

  using LocalFunctionInterface = typename Traits::LocalFunctionInterface;

  using EntitySet = typename Traits::EntitySet;

public:

  /**
   * \brief Construct from function
   *
   * \tparam F Function type
   *
   * \param f Function of type F
   *
   * Calling derivative(DifferentiableFunction) will result in an exception
   * if the passed function does provide a free derivative() function
   * found via ADL.
   */
  template<class F, disableCopyMove<GridFunction, F> = 0 >
  GridFunction(F&& f) :
    Base(std::forward<F>(f))
  {
    static_assert(Dune::Functions::Concept::isGridFunction<F, Range(Domain), EntitySet, DerivativeTraits>(), "Trying to construct a GridFunction from type that does not model the GridFunction concept");
  }

  GridFunction() = default;

  /**
   * \brief Evaluation of wrapped function
   */
  Range operator() (const Domain& x) const
  {
    return this->asInterface().operator()(x);
  }

  /**
   * \copydoc DifferentiableFunction::derivative
   */
  friend DerivativeInterface derivative(const GridFunction& t)
  {
    return t.asInterface().derivative();
  }

  /**
   * \brief Get local function of wrapped function
   *
   * This is free function will be found by ADL.
   *
   * Notice that the returned LocalFunction can
   * only be used after it has been bound to a
   * proper local context.
   */
  friend LocalFunctionInterface localFunction(const GridFunction& t)
  {
    return t.asInterface().wrappedLocalFunction();
  }

  /**
   * \brief Get associated EntitySet
   *
   * This is free function will be found by ADL.
   */
  const EntitySet& entitySet() const
  {
    return this->asInterface().wrappedEntitySet();
  }
};



}} // namespace Dune::Functions



#endif // DUNE_FUNCTIONS_GRIDFUNCTIONS_GRID_FUNCTION_HH