This file is indexed.

/usr/include/openturns/TBB.hxx is in libopenturns-dev 1.5-7build2.

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
//                                               -*- C++ -*-
/**
 *  @file  TBB.hxx
 *  @brief This file supplies support for multithreading
 *
 *  Copyright 2005-2015 Airbus-EDF-IMACS-Phimeca
 *
 *  This library is free software: you can 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 3 of the License, or
 *  (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  @author schueller
 *  @date   2007-05-10 16:43:31 +0200 (Thu, 10 May 2007)
 */
#ifndef OPENTURNS_TBB_HXX
#define OPENTURNS_TBB_HXX

#include "OTprivate.hxx"
#include "OTconfig.hxx"
#include <algorithm>

#ifdef OPENTURNS_HAVE_TBB
#ifdef OPENTURNS_TBB_NO_IMPLICIT_LINKAGE
# ifndef __TBB_NO_IMPLICIT_LINKAGE
#  define __TBB_NO_IMPLICIT_LINKAGE 1
# endif
# ifndef __TBBMALLOC_NO_IMPLICIT_LINKAGE
#  define __TBBMALLOC_NO_IMPLICIT_LINKAGE 1
# endif
#endif
#include "tbb/tbb.h"
#include "OTwindows.h"
#else /* OPENTURNS_HAVE_TBB */
#include "Exception.hxx"
// We redefine some TBB elements to simulate TBB availability through the code
// Those redefinitions are single threaded
namespace tbb
{

template <typename T>
class blocked_range
{
public:
  typedef T value_type;
  typedef std::size_t size_type;
  blocked_range(value_type from, value_type to, size_type gs = 1)
    : from_(from), to_(to), grainSize_(gs)
  {
#ifdef DEBUG_BOUNDCHECKING
    if (from_ > to_)
      throw OT::InvalidArgumentException(HERE) << "Range is malformed (from > to) with from=" << from_
          << " and to=" << to;
    if (grainSize_ < 1)
      throw OT::InvalidArgumentException(HERE) << "Range is malformed (grainSize < 1) with grainSize=" << grainSize_;
#endif /* DEBUG_BOUNDCHECKING */
  }
  value_type begin() const
  {
    return from_;
  }
  value_type end() const
  {
    return to_;
  }
  size_type size() const
  {
    return size_t(to_ - from_);
  }
  size_type grainsize() const
  {
    return grainSize_;
  }
private:
  value_type from_;
  value_type to_;
  size_type grainSize_;
}; // end class blocked_range

template <typename RANGE, typename BODY>
void parallel_for( const RANGE & range, const BODY & body )
{
  body( range );
}

template <typename RANGE, typename BODY>
void parallel_reduce( const RANGE & range, BODY & body )
{
  body( range );
}

template <typename ITERATOR>
void parallel_sort( ITERATOR first, ITERATOR last )
{
  std::stable_sort( first, last );
}

} // namespace tbb
#endif /* OPENTURNS_HAVE_TBB */

BEGIN_NAMESPACE_OPENTURNS

class OT_API TBB
{
public:
#ifdef OPENTURNS_HAVE_TBB
  typedef tbb::split Split;
#else /* OPENTURNS_HAVE_TBB */
  struct Split {};
#endif /* OPENTURNS_HAVE_TBB */

  template <typename T>
  struct BlockedRange : public tbb::blocked_range<T>
  {
    typedef T value_type;
    typedef typename tbb::blocked_range<T>::size_type size_type;
    BlockedRange(value_type from, value_type to, size_type gs = 1) : tbb::blocked_range<T>(from, to, gs) {}
    BlockedRange(const tbb::blocked_range<T> & range) : tbb::blocked_range<T>(range) {}
  };

private:

  /** Start the machinery of multithreading */
  static void Initialization();

  /** End the machinery of multithreading */
  static void Release();

public:

  template <typename BODY>
  static inline
  void ParallelFor( UnsignedInteger from, UnsignedInteger to, const BODY & body, std::size_t gs = 1 )
  {
    tbb::parallel_for( tbb::blocked_range<UnsignedInteger>( from, to, gs ), body );
  }

  template <typename BODY>
  static inline
  void ParallelReduce( UnsignedInteger from, UnsignedInteger to, BODY & body, std::size_t gs = 1)
  {
    tbb::parallel_reduce( tbb::blocked_range<UnsignedInteger>( from, to, gs ), body );
  }

  template <typename ITERATOR>
  static inline
  void ParallelSort( ITERATOR first, ITERATOR last )
  {
    tbb::parallel_sort( first, last );
  }

private:

  friend struct TBB_init; /* friendship for static member initialization */
}; /* end class TBB */



/** This struct initializes all static members of TBB */
struct OT_API TBB_init
{
  TBB_init();
  ~TBB_init();
}; /* end class TBB_init */

static TBB_init __TBB_initializer;

END_NAMESPACE_OPENTURNS

#endif /* OPENTURNS_TBB_HXX */