This file is indexed.

/usr/include/rheolef/field_component.h is in librheolef-dev 6.7-6.

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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
#ifndef _RHEOLEF_FIELD_COMPONENT_H
#define _RHEOLEF_FIELD_COMPONENT_H
///
/// This file is part of Rheolef.
///
/// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
///
/// Rheolef is free software; you can redistribute it and/or modify
/// it under the terms of the GNU General Public License as published by
/// the Free Software Foundation; either version 2 of the License, or
/// (at your option) any later version.
///
/// Rheolef 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 General Public License for more details.
///
/// You should have received a copy of the GNU General Public License
/// along with Rheolef; if not, write to the Free Software
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
///
/// =========================================================================

/* TODO: when slip B.C. or Raviart-Thomas RT H(div) approx :
   uh[0] values are computed on the fly in a temporary
 
struct field_component {	
// data:
   field_basic<T,M>::iterator _start, _last;
   const space_constit&       _constit;         // a ce niveau
   field*                     _tmp_comp_ptr;    // si necesite un temporaire
// actions:
   field_component (field& uh, i_comp) {
	constit = uh.get_space().get_constitution();
	_constit = constit[i_comp]);
	if (! constit.has_slip_bc() && ! constit.has_hdiv()) {
          _tmp_comp_ptr = 0;
	  _star & _last : pointe dans le field uh
	} else {
	  space Vi (_constit);
          _tmp_comp_ptr = new field (Vi);
	  uh.compute_slip_comp (i_comp, *_tmp_comp_ptr);
	  _star & _last : pointe dans *_tmp_comp_ptr
	}
   }
   ~field_component () {
      if (_tmp_comp_ptr) delete _tmp_comp_ptr;
   }
};
*/

#include "rheolef/field.h"
#include "rheolef/field_indirect.h"

namespace rheolef {

// =========================================================================
// field_component
// =========================================================================
template<class T, class M>
class field_component {
public:

// typename:

  typedef typename field_basic<T,M>::size_type      size_type;
  typedef T                                         value_type;
  typedef M                                         memory_type;
  typedef typename scalar_traits<T>::type           scalar_type;
  typedef typename float_traits<T>::type            float_type;
  typedef typename field_basic<T,M>::iterator       iterator;
  typedef typename field_basic<T,M>::const_iterator const_iterator;

// allocators:

  field_component ();
  field_component (field_basic<T,M>&     uh, size_type i_comp);
  field_component (field_component<T,M>& uh, size_type i_comp);

  const T& operator= (const T& alpha);

  template <class Expr,
            class Sfinae = typename std::enable_if<details::is_field_expr_v2_linear_arg<Expr>::value>::type>
  field_component<T,M>& operator=  (const Expr&);

  // explicit copy cstor (avoid simple copy of the proxy; see nfem/ptst/field_comp_assign_tst.cc )
  field_component<T,M>& operator= (const field_component<T,M>& expr) {
	return this -> template  operator=<field_component<T,M> > (expr);
  }

// high-level accessors & modifiers:

  field_indirect<T,M> operator[] (const geo_basic<T,M>& dom);
  field_indirect<T,M> operator[] (const std::string&    dom_name);

// recursive call:

  field_component<T,M> operator[] (size_t i_comp);

// low-level accessors & modifiers:

  const space_constitution<T,M>& get_constitution() const { return _constit; }
  std::string stamp() const { return _constit.stamp(); }
  geo_basic<T,M>   get_geo() const { return _constit.get_geo(); }
  space_basic<T,M> get_space() const { return space_basic<T,M>(_constit); }
  const distributor& ownership() const { return _constit.ownership(); }	
  const communicator& comm() const { return ownership().comm(); }
  size_type     ndof() const { return ownership().size(); }
  size_type dis_ndof() const { return ownership().dis_size(); }
        T& dof (size_type idof)       { return _start [idof]; }
  const T& dof (size_type idof) const { return _start [idof]; }
  iterator begin_dof() { return _start; }
  iterator end_dof()   { return _last; }
  const_iterator begin_dof() const { return const_iterator(_start); }
  const_iterator end_dof() const   { return const_iterator(_last); }

// advanced usage:
  field_component<T,M>& proxy_assign (field_component<T,M>&& uh_comp);
protected:
// data:
  space_constitution<T,M>        _constit;     // at this level
  iterator                       _start;
  iterator                       _last;
};
// =========================================================================
// field_component_const
// =========================================================================
template<class T, class M>
class field_component_const {
public:

// typename:

  typedef typename field_basic<T,M>::size_type      size_type;
  typedef T                                         value_type;
  typedef M                                         memory_type;
  typedef typename scalar_traits<T>::type           scalar_type;
  typedef typename float_traits<T>::type            float_type;
  typedef typename field_basic<T,M>::const_iterator const_iterator;

// allocators:

  field_component_const ();
  field_component_const (const field_basic<T,M>& uh, size_type i_comp);
  field_component_const (const field_component<T,M>& uh_comp);
  const space_constitution<T,M>& get_constitution() const { return _constit; }
  std::string stamp() const { return _constit.stamp(); }
  const distributor& ownership() const { return _constit.ownership(); }	
  const communicator& comm() const { return ownership().comm(); }
  geo_basic<T,M>   get_geo() const { return _constit.get_geo(); }
  space_basic<T,M> get_space() const { return space_basic<T,M>(_constit); }
  size_type     ndof() const { return ownership().size(); }
  size_type dis_ndof() const { return ownership().dis_size(); }
  const T& dof (size_type idof) const { return _start [idof]; }
  const_iterator begin_dof() const { return const_iterator(_start); }
  const_iterator end_dof() const   { return const_iterator(_last); }

// advanced usage:
  field_component_const<T,M>& proxy_assign (const field_component_const<T,M>& uh_comp);
protected:
// data:
  space_constitution<T,M>        _constit;     // at this level
  const_iterator                 _start;
  const_iterator                 _last;
private:
  field_component_const<T,M>& operator= (const field_component_const<T,M>& uh_comp);
};
// =========================================================================
// inlined
// =========================================================================
template<class T, class M>
inline
field_component<T,M>::field_component()
 : _constit(),
   _start(),
   _last()
{
}
template<class T, class M>
inline
field_component_const<T,M>::field_component_const()
 : _constit(),
   _start(),
   _last()
{
}
template<class T, class M>
field_component<T,M>::field_component (field_basic<T,M>& uh, size_type i_comp)
 : _constit (uh.get_space().get_constitution() [i_comp]),
   _start(uh.begin_dof()),
   _last(uh.begin_dof())
{
  check_macro (i_comp < uh.size(),
      "field component index "<<i_comp<<" is out of range [0:"<<uh.size()<<"[");
  const space_constitution<T,M>& sup_constit = uh.get_space().get_constitution();
  size_type shift = 0;
  for (size_type j_comp = 0; j_comp < i_comp; j_comp++) {
    shift += sup_constit [j_comp].ndof();
  }
  size_type sz = sup_constit [i_comp].ndof();
  _start += shift;	
  _last  += shift + sz;	
}
template<class T, class M>
field_component_const<T,M>::field_component_const (const field_basic<T,M>& uh, size_type i_comp)
 : _constit (uh.get_space().get_constitution() [i_comp]),
   _start(uh.begin_dof()),
   _last(uh.begin_dof())
{
  check_macro (i_comp < uh.size(),
      "field component index "<<i_comp<<" is out of range [0:"<<uh.size()<<"[");
  const space_constitution<T,M>& sup_constit = uh.get_space().get_constitution();
  size_type shift = 0;
  for (size_type j_comp = 0; j_comp < i_comp; j_comp++) {
    shift += sup_constit [j_comp].ndof();
  }
  size_type sz = sup_constit [i_comp].ndof();
  _start += shift;	
  _last  += shift + sz;	
}
template<class T, class M>
field_component<T,M>::field_component (field_component<T,M>& uh, size_type i_comp)
 : _constit (),
   _start(uh._start),
   _last(uh._last)
{
  const space_constitution<T,M>& sup_constit = uh._constit;
  check_macro (i_comp < sup_constit.size(),
      "field component index "<<i_comp<<" is out of range [0:"<<sup_constit.size()<<"[");
  size_type shift = 0;
  for (size_type j_comp = 0; j_comp < i_comp; j_comp++) {
    shift += sup_constit [j_comp].ndof();
  }
  _constit = sup_constit [i_comp];
  size_type sz = _constit.ndof();
  _start += shift;	
  _last  += shift + sz;	
}
template<class T, class M>
inline
field_component_const<T,M>::field_component_const (const field_component<T,M>& uh_comp)
 : _constit (uh_comp.get_constitution()),
   _start(uh_comp.begin_dof()),
   _last(uh_comp.end_dof())
{
}
template<class T, class M>
inline
field_component_const<T,M>&
field_component_const<T,M>::operator= (const field_component_const<T,M>& uh_comp)
{
  // avoided at compile time: is private
  fatal_macro ("try to assign const field in field[i_comp] = field[j_comp]");
  return *this;
}
template<class T, class M>
inline
field_component_const<T,M>&
field_component_const<T,M>::proxy_assign (const field_component_const<T,M>& uh_comp)
{
   _constit = uh_comp.get_constitution();
   _start   = uh_comp.begin_dof();
   _last    = uh_comp.end_dof();
  return *this;
}
template<class T, class M>
inline
field_component<T,M>&
field_component<T,M>::proxy_assign (field_component<T,M>&& uh_comp)
{
   _constit = uh_comp.get_constitution();
   _start   = uh_comp.begin_dof();
   _last    = uh_comp.end_dof();
  return *this;
}
template<class T, class M>
inline
field_component<T,M>
field_basic<T,M>::operator[] (size_type i_comp) 
{
  dis_dof_indexes_requires_update();
  return field_component<T,M> (*this, i_comp);
}
template<class T, class M>
inline
field_component<T,M>
field_component<T,M>::operator[] (size_t i_comp)
{
  return field_component<T,M> (*this, i_comp);
}
template<class T, class M>
inline
field_component_const<T,M>
field_basic<T,M>::operator[] (size_type i_comp) const
{
  return field_component_const<T,M> (*this, i_comp);
}
template<class T, class M>
inline
const T&
field_component<T,M>::operator= (const T& alpha)
{
  std::fill (begin_dof(), end_dof(), alpha);
  return alpha;
}
#ifdef TODO
// TODO: as: field vh; din >> vh ; uh[i_comp] = vh;
template <class T, class M>
inline
idiststream& operator >> (odiststream& ids, field_basic<T,M>& u);
#endif // TODO

template <class T, class M>
odiststream& operator << (odiststream& ods, const field_component<T,M>& uh_comp)
{
  return ods << field_basic<T,M>(uh_comp);
}
template <class T, class M>
inline
odiststream& operator << (odiststream& ods, const field_component_const<T,M>& uh_comp)
{
  return ods << field_basic<T,M>(uh_comp);
}
// =========================================================================
// uh[0]["boundary"] = alpha;
// => field_component & field_indirect together
// =========================================================================
template <class T, class M>
inline
field_indirect<T,M>::field_indirect (field_component<T,M>& uh_comp, const geo_basic<T,M>& dom)
  : _V(uh_comp.get_space()),
    _W(dom, _V.get_numbering().name()),
    _dom(dom),
    _indirect(_V.build_indirect_array (_W, _dom.name())),
    _val(uh_comp.begin_dof())
{
}
template <class T, class M>
inline
field_indirect<T,M>
field_component<T,M>::operator[] (const geo_basic<T,M>& dom)
{
  return field_indirect<T,M> (*this, dom);
}
template <class T, class M>
inline
field_indirect<T,M>
field_component<T,M>::operator[] (const std::string& dom_name)
{
  return field_indirect<T,M> (*this, get_geo().operator[](dom_name));
}

} // namespace rheolef
#endif // _RHEOLEF_FIELD_COMPONENT_H