This file is indexed.

/usr/include/dune/pdelab/function/localfunction.hh is in libdune-pdelab-dev 2.5.0~rc1-2build1.

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
//-*- tab-width: 4; c-basic-offset: 2; indent-tabs-mode: nil -*-
#ifndef DUNE_PDELAB_FUNCTION_LOCALFUNCTION_HH
#define DUNE_PDELAB_FUNCTION_LOCALFUNCTION_HH

#include <type_traits>

#include <dune/pdelab/function/tags.hh>
#include <dune/pdelab/function/localfunctionhelper.hh>
#include <dune/pdelab/function/oldinterfaceadapter.hh>
#include <dune/functions/common/signature.hh>
#include <dune/functions/gridfunctions/gridviewfunction.hh>

namespace Dune {
namespace PDELab {

  template<class F, std::size_t k>
  class PowerLocalFunction
    : public TypeTree::PowerNode<F,k>
  {
    typedef TypeTree::PowerNode<F,k> NodeType;
  public:
    typedef PowerDifferentiableFunctionLocalViewTag ImplementationTag;

    //! Set the time in all leaf nodes of this function tree
    template <typename TT>
    void setTime(TT time){
      PowerCompositeSetTimeVisitor<TT> visitor(time);
      TypeTree::applyToTree(*this,visitor);
    }

    template <typename Entity>
    void bind(const Entity & e){
      Imp::PowerCompositeBindVisitor<Entity> visitor(e);
      TypeTree::applyToTree(*this,visitor);
    }

    void unbind(){
      Imp::PowerCompositeUnbindVisitor visitor;
      TypeTree::applyToTree(*this,visitor);
    }

    //! Deafult Constructor
    PowerLocalFunction()
    {}

    //! Construct a PowerGridFunction with k clones of the function t
    PowerLocalFunction (F& f)
      : NodeType(f) {}

    /** \brief Initialize all children with different function objects
     *
     *  @param t0 The initializer for the first child.
     *  @param t1 The initializer for the second child.
     *  @param ... more initializers
     */
    template<typename C0, typename C1, typename... Children>
    PowerLocalFunction (C0&& c0, C1&& c1, Children&&... children)
      : NodeType(std::forward(c0), std::forward(c1), std::forward(children)...)
    {
    }

    //! Transformation Constructor, taking the set of new children
    PowerLocalFunction(const Dune::array<Dune::shared_ptr<F>,k>& children)
      : NodeType(children)
    {}

  };

  template<typename... Children>
  class CompositeLocalFunction
    : public TypeTree::CompositeNode<Children...>
  {
    typedef TypeTree::CompositeNode<Children...> NodeType;
  public:
    typedef CompositeDifferentiableFunctionLocalViewTag ImplementationTag;

    //! Set the time in all leaf nodes of this function tree
    template <typename TT>
    void setTime(TT time){
      PowerCompositeSetTimeVisitor<TT> visitor(time);
      TypeTree::applyToTree(*this,visitor);
    }

    template <typename Entity>
    void bind(const Entity & e){
      Imp::PowerCompositeBindVisitor<Entity> visitor(e);
      TypeTree::applyToTree(*this,visitor);
    }

    void unbind(){
      Imp::PowerCompositeUnbindVisitor visitor;
      TypeTree::applyToTree(*this,visitor);
    }

    //! Default Constructor
    CompositeLocalFunction()
    {}

    //! Initialize all children with the passed-in objects.
    template<typename... Args, typename = typename std::enable_if<(sizeof...(Args) == sizeof...(Children))>::type>
    CompositeLocalFunction(Args&&... args)
      : NodeType(std::forward<Args>(args)...)
    {}

  };

  /** \brief turn a given function tree into a local function tree

    To create a tree with a local view we have to do destinguish
    between the following cases:

    a) HasFreeLocalFunction, but no NodeTag -> call localView(f) -> LocalViewLeafNodeWrapper
    b) operator(), but no Tag -> makeGridViewFunction -> LocalViewLeafNodeWrapper
    c) HasFreeLocalFunction and NodeTag -> call localView(f)
    d) GridFunctionTag -> create a LocalGridViewFunctionAdapter
    e) LeafNodeTag, derived from GridFunctionInterface -> create a LocalGridViewFunctionAdapter (this is always a leaf node)
  */
  template<class F, class GV,
           typename std::enable_if<
             // case (a)
             models< Dune::Functions::Imp::HasFreeLocalFunction, F>()
             and
             not(TypeTree::has_node_tag<typename std::decay<F>::type>::value), int>::type = 0>
  auto makeLocalFunctionTree(const F& f, const GV & gv)
    -> Imp::LocalFunctionLeafNodeWrapper< decltype(localFunction(f)) >
  {
    return Imp::LocalFunctionLeafNodeWrapper< decltype(localFunction(f)) >(localFunction(f));
  }

  template<class F, class GV,
           // case (b)
           typename std::enable_if<
             Dune::Functions::Concept::isCallable<F, typename GV::template Codim<0>::Entity::Geometry::GlobalCoordinate>()
             and
             not(models< Dune::Functions::Imp::HasFreeLocalFunction, F>())
             and
             not(TypeTree::has_node_tag<typename std::decay<F>::type>::value), int>::type = 0>
  auto makeLocalFunctionTree(const F& f, const GV & gv)
    -> decltype(makeLocalFunctionTree(Functions::makeGridViewFunction(f,gv), gv))
  {
    return makeLocalFunctionTree(Functions::makeGridViewFunction(f,gv), gv);
  }

  template<class F, class GV,
           typename std::enable_if<
             // case (c)
             models< Dune::Functions::Imp::HasFreeLocalFunction, F>()
             and
             TypeTree::has_node_tag<typename std::decay<F>::type>::value, int>::type = 0>
  auto makeLocalFunctionTree(F&& f, const GV & gv)
    -> decltype(localView(f))
  {
    return localView(std::forward(f));
  }

  struct GridFunctionToLocalViewTransformation {};

  template<typename LeafNode>
  Dune::TypeTree::GenericLeafNodeTransformation<LeafNode,GridFunctionToLocalViewTransformation, Imp::LocalGridViewFunctionAdapter<LeafNode> >
  registerNodeTransformation(LeafNode* l, GridFunctionToLocalViewTransformation* t, GridFunctionTag* tag);

  template<typename PowerNode>
  Dune::TypeTree::SimplePowerNodeTransformation<PowerNode,GridFunctionToLocalViewTransformation,PowerLocalFunction>
  registerNodeTransformation(PowerNode* p, GridFunctionToLocalViewTransformation* t, PowerGridFunctionTag* tag);

  template<typename CompositeNode>
  Dune::TypeTree::SimpleCompositeNodeTransformation<CompositeNode,GridFunctionToLocalViewTransformation,CompositeLocalFunction>
  registerNodeTransformation(CompositeNode* c, GridFunctionToLocalViewTransformation* t, CompositeGridFunctionTag* tag);

  template<class F, class GV,
           typename std::enable_if<
             // case (d)
             IsGridFunction<F>::value, int>::type = 0>
  auto makeLocalFunctionTree(const F& f, const GV & gv)
  -> typename Dune::TypeTree::TransformTree<typename std::decay<F>::type,
                                            GridFunctionToLocalViewTransformation>::transformed_type
  {
    // call the transformation
    return Dune::TypeTree::TransformTree<typename std::decay<F>::type,
                                         GridFunctionToLocalViewTransformation>::transform(f);
  }

  template<class F, class GV,
           typename std::enable_if<
             // case (e)
             not(IsGridFunction<F>::value)
             &&
             std::is_same<TypeTree::NodeTag<F>,TypeTree::LeafNodeTag>::value, int>::type = 0>
  auto makeLocalFunctionTree(const GridFunctionInterface<typename F::Traits,F>& f, const GV & gv)
    -> Imp::LocalGridViewFunctionAdapter<F>
  {
    // call the transformation
    return Imp::LocalGridViewFunctionAdapter<F>(static_cast<const F&>(f));
  }

} // end namespace PDELab
} // end namespace Dune

#endif // DUNE_PDELAB_FUNCTION_LOCALFUNCTION_HH