This file is indexed.

/usr/include/rheolef/space_constitution.h is in librheolef-dev 6.6-1build2.

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
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
#ifndef _RHEOLEF_SPACE_CONSTITUTION_H
#define _RHEOLEF_SPACE_CONSTITUTION_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
///
/// =========================================================================

#include "rheolef/geo.h"
#include "rheolef/geo_domain.h"
#include "rheolef/space_constant.h"

namespace rheolef {

// forward declarations:
template <class T, class M> class space_mult_list;
template <class T, class M> class space_constitution;

// =====================================================================
// space_act = a domain + an act (block, unblock)
// =====================================================================

class space_act {
public:

// typedefs:

    enum act_type {
        block = 0,
        unblock = 1
    };

// allocators:

    space_act() : _dom_name(), _act() {}
    space_act(const std::string& dom_name, act_type act)
	: _dom_name(dom_name), _act(act) {}
    space_act(const space_act& sp)
	: _dom_name(sp._dom_name), _act(sp._act) {}

// accessors:

    const std::string& get_domain_name() const { return _dom_name; }
    act_type           get_act()         const { return _act; }

// data:
protected:
    std::string _dom_name;
    act_type    _act;
};
// =====================================================================
// space_scalar_constitution = a table of acts
// =====================================================================

template <class T, class M>
class space_scalar_constitution_rep {
public:
    typedef typename  std::vector<space_act>         container_type;
    typedef typename  container_type::size_type      size_type;
    typedef typename  container_type::const_iterator const_iterator;

// allocators:

    space_scalar_constitution_rep()
      : _acts(), _omega(), _numbering() {}
    space_scalar_constitution_rep(const geo_basic<T,M>& omega, std::string approx)
      : _acts(), _omega(compact(omega)), _numbering(approx) {}
    space_scalar_constitution_rep (const space_scalar_constitution_rep<T,M>& scr)
      : _acts(scr._acts), _omega(scr._omega), _numbering(scr._numbering)
    {
	trace_macro ("physical copy of space_scalar_constitution_rep: size="<< size());
    }

// accessors:

    const geo_basic<T,M>& get_geo()       const { return _omega; }
    const numbering<T,M>& get_numbering() const { return _numbering; }

    bool           is_initialized() const { return _numbering.is_initialized(); }
    size_type      size()  const { return _acts.size(); }
    const_iterator begin() const { return _acts.begin(); }
    const_iterator end()   const { return _acts.end(); }

// modifiers

    void set_geo       (const geo_basic<T,M>& omega)  { _omega = omega; }
    void set_numbering (const numbering<T,M>& numb)  { _numbering = numb; }
    void do_act        (const space_act& act);

// comparator:

    bool operator== (const space_scalar_constitution_rep<T,M>& V2) const { return _omega == V2._omega && _numbering == V2._numbering; }

// internal:
    size_type internal_ndof() const;
    size_type internal_dis_ndof() const;
    communicator internal_comm() const;
    void build_blocked_flag (
      array<size_type,M>& blocked_flag,
      const distributor&  comp_ownership,
      const distributor&  start_by_component) const;
protected:
// data:
    std::vector<space_act>             _acts;
    geo_basic<T,M>                     _omega;
    numbering<T,M>                     _numbering;
};
template <class T, class M>
class space_scalar_constitution : public smart_pointer<space_scalar_constitution_rep<T,M> > {
public:

    typedef space_scalar_constitution_rep<T,M>   rep;
    typedef smart_pointer<rep>            base;
    typedef typename  rep::size_type      size_type;
    typedef typename  rep::const_iterator const_iterator;

// allocators:

    space_scalar_constitution()
     : smart_pointer<rep>(new_macro(rep)) {}

    space_scalar_constitution(const geo_basic<T,M>& omega, std::string approx)
     : smart_pointer<rep>(new_macro(rep (omega,approx))) {}

// accessors:

    const geo_basic<T,M>& get_geo()       const { return base::data().get_geo(); }
    const numbering<T,M>& get_numbering() const { return base::data().get_numbering(); }
    size_type      size()  const { return base::data().size(); }
    const_iterator begin() const { return base::data().begin(); }
    const_iterator end()   const { return base::data().end(); }

// comparator:

    bool operator== (const space_scalar_constitution<T,M>& V2) const { return base::data().operator==(V2.data()); }

// modifiers

    void set_geo (const geo_basic<T,M>& omega) { base::data().set_geo (omega); }
    void set_numbering (const numbering<T,M>& numb) { base::data().set_numbering (numb); }

    void do_act         (const space_act& act)         { base::data().do_act(act); }
    void block   (const domain_indirect_basic<M>& dom) { do_act (space_act(dom.name(), space_act::block)); }
    void unblock (const domain_indirect_basic<M>& dom) { do_act (space_act(dom.name(), space_act::unblock)); }

// internals:
    size_type internal_ndof()        const { return base::data().internal_ndof(); }
    size_type internal_dis_ndof()    const { return base::data().internal_dis_ndof(); }
    communicator internal_comm()     const { return base::data().internal_comm(); }
};
// =======================================================================
// space_constitution = a recursive hierarchy of constitution
// =======================================================================
template <class T, class M>
class space_constitution_rep {
public:
    typedef space_constitution_rep<T,M>   this_type;
#ifdef TO_CLEAN
    typedef smart_pointer<space_constitution_rep<T,M> > value_type;
#endif // TO_CLEAN
    typedef space_constitution<T,M>       value_type;
    typedef std::vector<value_type>                    hierarchy_type;
    typedef space_scalar_constitution<T,M>             scalar_type;
    typedef typename  hierarchy_type::size_type        size_type;
    typedef typename  hierarchy_type::iterator         iterator;
    typedef typename  hierarchy_type::const_iterator   const_iterator;
    typedef typename  space_constant::valued_type valued_type;

// allocator:

    space_constitution_rep()
      : _ownership(),
        _start_by_component(),
        _valued_tag(space_constant::mixed),
        _is_hier(false),
        _scalar_constit(),
        _hier_constit()
        {}
    
    space_constitution_rep (const space_constitution_rep<T,M>& x)
      : _ownership(x._ownership),
        _start_by_component(x._start_by_component),
        _valued_tag(x._valued_tag),
        _is_hier(x._is_hier),
        _scalar_constit(x._scalar_constit),
        _hier_constit(x._hier_constit)
       {}

    space_constitution_rep (const geo_basic<T,M>& omega, std::string approx, std::string valued);
    space_constitution_rep (const space_mult_list<T,M>&);

// accessors & modifiers:

    const distributor& ownership() const { return _ownership; }
    size_type     ndof() const { return _ownership.size(); }
    size_type dis_ndof() const { return _ownership.dis_size(); }
    communicator comm()  const { return _ownership.comm(); }
    size_type ios_ndof() const;
    void do_act         (const space_act& act);
    const geo_basic<T,M>& get_geo()       const;
    const numbering<T,M>& get_numbering() const;
    size_type loc_ndof (const reference_element& hat_K) const;
    void dis_idof (const geo_element& K, std::vector<size_type>& dis_idof) const;
    void compute_external_dofs (std::set<size_type>& ext_dof_set) const;
    void set_valued_tag (valued_type valued_tag){ _valued_tag = valued_tag; }
    void set_valued     (const std::string& valued){ _valued_tag = space_constant::valued_tag (valued); }
    const valued_type& valued_tag() const       { return _valued_tag; }
    const std::string& valued()     const       { return space_constant::valued_name (_valued_tag); }
    bool is_hierarchical() const                { return _is_hier; }
    void set_hierarchy (bool hier)              { _is_hier = hier; }

// scalar accessors & modifiers:

    const scalar_type& get_scalar() const { scalar_guard(); return _scalar_constit; }
    scalar_type&       get_scalar()       { scalar_guard(); return _scalar_constit; }

// hierarchy accessors & modifiers:

    const hierarchy_type& get_hierarchy() const { hierarchy_guard(); return _hier_constit; }
    hierarchy_type&       get_hierarchy()       { hierarchy_guard(); return _hier_constit; }
    size_type size() const { return _is_hier ? _hier_constit.size() : 0; }
    space_constitution<T,M>&       operator[] (size_type i_comp)       { return get_hierarchy() [i_comp]; }
    const space_constitution<T,M>& operator[] (size_type i_comp) const { return get_hierarchy() [i_comp]; }

// utility:

    void set_ios_permutations (
        array<size_type,M>& idof2ios_dis_idof,
        array<size_type,M>& ios_idof2dis_idof) const;

// comparator:

    bool operator== (const space_constitution_rep<T,M>& V2) const;

// internal:
    void initialize();
    size_type internal_ndof() const;
    size_type internal_dis_ndof() const;
    communicator internal_comm() const;
    void continuous_append_external_dof (
        const geo_basic<T,M>&         dom,
        std::set<size_type>&          ext_dof_set,
        const distributor&            dof_ownership,
        const distributor&            start_by_component) const;
    void discontinuous_append_external_dof (
        const geo_basic<T,M>&         dom,
        std::set<size_type>&          ext_dof_set,
        const distributor&            dof_ownership,
        const distributor&            start_by_component) const;
    void compute_external_dofs (
        std::set<size_type>&            ext_dof_set,
        const distributor&              dof_ownership,
	const std::vector<distributor>& start_by_component,
	size_type&                      i_comp) const;
    size_type n_component_recursive() const;
    void init_start_by_component (
	std::vector<distributor>& start_by_component,
	size_type&                i_comp,
	const communicator&	  comm,
	size_type&                comp_start_idof,
	size_type&                comp_start_dis_idof) const;
    void init_start_by_component();
    void build_blocked_flag_recursive (
      array<size_type,M>&             blocked_flag, // array<bool,M> not supported
      const std::vector<distributor>& start_by_component,
      size_type&                      i_comp) const;
    array<size_type,M> build_blocked_flag() const;

protected:
    friend class space_constitution<T,M>;
    void hierarchy_guard() const { check_macro ( _is_hier, "invalid access to a non-hierarchical constitution"); }
    void scalar_guard()   const { check_macro (!_is_hier, "invalid access to a hierarchical constitution"); }
    void set_ios_permutation_recursion (
	array<size_type,M>& idof2ios_dis_idof, 
	size_type&          comp_start_idof,
	size_type&          comp_start_dis_idof) const;
// data:
    // union (hier,not hier):
    distributor              _ownership;
    std::vector<distributor> _start_by_component;
    valued_type              _valued_tag;
    bool		     _is_hier;
    scalar_type              _scalar_constit;
    hierarchy_type           _hier_constit;
};

template <class T, class M = rheo_default_memory_model>
class space_constitution : public smart_pointer<space_constitution_rep<T,M> > {
public:

    typedef space_constitution_rep<T,M>   rep;
    typedef smart_pointer<rep>                         base;
    typedef typename  rep::size_type                   size_type;
    typedef typename  rep::const_iterator              const_iterator;
    typedef typename  rep::scalar_type                 scalar_type;
    typedef typename  rep::hierarchy_type              hierarchy_type;
    typedef typename  rep::valued_type                 valued_type;

// allocators:

    space_constitution()
     : base(new_macro(rep)) {}

    space_constitution(const base& b)
     : base(b) {}

    space_constitution(const geo_basic<T,M>& omega, std::string approx, std::string valued = "scalar")
     : base(new_macro(rep (omega,approx,valued))) {}

    space_constitution(const space_mult_list<T,M>& expr)
     : base(new_macro(rep (expr))) {}

// accessors & modifiers:

    const distributor& ownership() const { return base::data().ownership(); }
    std::string stamp() const;
    size_type ndof()        const { return base::data().ndof(); }
    size_type dis_ndof()    const { return base::data().dis_ndof(); }
    size_type ios_ndof()    const { return base::data().ios_ndof(); }
    communicator comm()     const { return base::data().comm(); }
    const geo_basic<T,M>& get_geo()       const { return base::data().get_geo(); }
    const numbering<T,M>& get_numbering() const { return base::data().get_numbering(); }
    size_type loc_ndof (const reference_element& hat_K) const { return base::data().loc_ndof (hat_K); }
    void dis_idof (const geo_element& K, std::vector<size_type>& dis_idof) const { base::data().dis_idof (K, dis_idof); }
    void do_act         (const space_act& act)       { base::data().do_act(act); }
    void block   (const domain_indirect_basic<M>& dom) { do_act (space_act(dom.name(), space_act::block)); }
    void unblock (const domain_indirect_basic<M>& dom) { do_act (space_act(dom.name(), space_act::unblock)); }
    array<size_type,M> build_blocked_flag() const { return base::data().build_blocked_flag(); }
    void compute_external_dofs (std::set<size_type>& ext_dof_set) const
    					{ base::data().compute_external_dofs(ext_dof_set); }
    bool is_hierarchical() const { return base::data().is_hierarchical(); }

// scalar accessors & modifiers:

    const space_scalar_constitution<T,M>& get_scalar() const { return base::data().get_scalar(); }
    space_scalar_constitution<T,M>&       get_scalar()       { return base::data().get_scalar(); }

// hierarchy accessors & modifiers:

    void set_hierarchy(bool hier = true)        { return base::data().set_hierarchy(hier); }
    void set_valued_tag (valued_type valued_tag){ base::data().set_valued_tag(valued_tag); }
    void set_valued     (const std::string& valued){ base::data().set_valued (valued); }
    const valued_type& valued_tag() const       { return base::data().valued_tag(); }
    const std::string& valued()     const       { return base::data().valued(); }
    const hierarchy_type& get_hierarchy() const { return base::data().get_hierarchy(); }
    hierarchy_type&       get_hierarchy()       { return base::data().get_hierarchy(); }
    size_type size() const { return base::data().size(); }
    space_constitution<T,M>&       operator[] (size_type i_comp)       { return base::data().operator[] (i_comp); }
    const space_constitution<T,M>& operator[] (size_type i_comp) const { return base::data().operator[] (i_comp); }

// utility:

    void set_ios_permutations (
        array<size_type,M>& idof2ios_dis_idof,
        array<size_type,M>& ios_idof2dis_idof) const
        { base::data().set_ios_permutations (idof2ios_dis_idof, ios_idof2dis_idof); }
    size_type internal_ndof()        const { return base::data().internal_ndof(); }
    size_type internal_dis_ndof()    const { return base::data().internal_dis_ndof(); }
    communicator internal_comm()     const { return base::data().internal_comm(); }

// comparator:

    bool operator== (const space_constitution<T,M>& V2) const { return base::data().operator==(V2.data()); }

protected:
// internal:
    friend class space_constitution_rep<T,M>;
    void set_ios_permutation_recursion (
	array<size_type,M>& idof2ios_dis_idof, 
	size_type&          comp_start_idof,
	size_type&          comp_start_dis_idof) const
        { base::data().set_ios_permutation_recursion (idof2ios_dis_idof, comp_start_idof, comp_start_dis_idof); }
};
template<class T, class M>
idiststream& operator>> (idiststream&, space_constitution<T,M>&);

template<class T, class M>
std::ostream& operator<< (std::ostream&, const space_constitution<T,M>&);

} // namespace rheolef
#endif // _RHEOLEF_SPACE_CONSTITUTION_H