This file is indexed.

/usr/include/dune/functions/common/functionfromcallable.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
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_FUNCTIONS_COMMON_FUNCTION_FROM_CALLABLE_HH
#define DUNE_FUNCTIONS_COMMON_FUNCTION_FROM_CALLABLE_HH

#include <dune/common/function.hh>

#include <dune/functions/common/signature.hh>


namespace Dune {
namespace Functions {



template<class Signature, class F,
  class FunctionInterface = typename Dune::VirtualFunction<
    typename SignatureTraits<Signature>::RawDomain,
    typename SignatureTraits<Signature>::RawRange> >
class FunctionFromCallable;

/**
 * \brief Wrap a callable object as Dune::Function or Dune::VirtualFunction
 *
 * \ingroup FunctionUtility
 *
 * You can use this to implement a DifferentiableFunction including
 * a variable number of derivatives using callable objects. All
 * types that can be assigned to std::function<Range(Domain)> are supported,
 * i.e. functions, functors, lambdas, ...
 *
 * \tparam Range Range type
 * \tparam Domain Domain type
 * \tparam F Type of wrapped function
 * \tparam FunctionInterface Interface to implement, this can be either Dune::Function or Dune::VirtualFunction
 */
template<class Range, class Domain, class F, class FunctionInterface>
class FunctionFromCallable<Range(Domain), F, FunctionInterface> :
  public FunctionInterface
{
public:

  /**
   * \brief Create VirtualFunction from callable object
   *
   * This will store the given function and pass evaluate()
   * to its operator(). This constructor moves data
   * from given function.
   *
   * \param f Callable object to use for evaluate()
   */
  FunctionFromCallable(F&& f) :
    f_(f)
  {}

  /**
   * \brief Create VirtualFunction from callable object
   *
   * This will store the given function and pass evaluate()
   * to its operator(). This constructor copies the given function.
   *
   * \param f Callable object to use for evaluate()
   */
  FunctionFromCallable(const F& f) :
    f_(f)
  {}

  /**
   * \brief Evaluate function
   *
   * This call is passed to the function
   */
  void evaluate(const Domain& x, Range&y) const
  {
    y = f_(x);
  }

private:
  F f_;
};



} // namespace Functions
} // namespace Dune

#endif //DUNE_FUNCTIONS_COMMON_FUNCTION_FROM_CALLABLE_HH