This file is indexed.

/usr/include/rheolef/integrate.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
#ifndef _RHEO_INTEGRATE_H
#define _RHEO_INTEGRATE_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
/// 
/// =========================================================================
//
// SUMMARY:
// 1. numeric integration
//    1.1. general integration of a nonlinear expression
//    1.2. measure of the domain
//    1.3. when the valued result type is undetermined
// 2. field-result integration of a variational expression
//    2.1. general call
//    2.2. missing domain
//    2.3. subdomain by its name
// 3. form-result integration of a variational expression
//    3.1. general call
//    3.2. missing domain
//    3.3. subdomain by its name
// 4. variational integration: on a band
//
#include "rheolef/field_expr_v2_nonlinear.h"
#include "rheolef/field_expr_v2_variational.h"
#include "rheolef/form_expr_v2_variational.h"

#include "rheolef/field_expr_v2_value_assembly.h"
#include "rheolef/field_vf_assembly.h"
#include "rheolef/form_vf_assembly.h"

#include "rheolef/functor.h" // used to convert functions to functors

namespace rheolef { 

/*Class:integrate
NAME: @code{integrate} - integrate a function or an expression
@findex  integrate
DESCRIPTION:
  Integrate an expression over a domain by using a quadrature formulae.
  There are three main usages of the integrate function, depending upon the 
  type of the expression.
  (i) When the expression is a numerical one, it leads to a numerical value.
  (ii) When the expression involves a symbolic test-function @pxref{test class},
  the result is a linear form, represented by the @code{field} class. 
  (iii) When the expression involves both  symbolic trial- and test-functions @pxref{test class},
  the result is a bilinear form, represented by the @code{field} class. 
SYNOPSYS:
@example
 Float integrate (geo domain);
 Float integrate (geo domain, quadrature_option_type qopt);
 Value integrate (geo domain, Expression, quadrature_option_type qopt);

 field integrate (Expression);
 field integrate (Expression, quadrature_option_type qopt);
 field integrate (geo domain, Expression);
 field integrate (geo domain, Expression, quadrature_option_type qopt);

 form integrate (Expression);
 form integrate (Expression, form_option_type qopt);
 form integrate (geo domain, Expression);
 form integrate (geo domain, Expression, form_option_type qopt);
@end example
EXAMPLE:
@noindent
  For computing the measure of a domain:
@example
  Float meas_omega = integrate (omega);
@end example
  For computing the integral of a function:
@example
  Float f (const point& x);
  ...
  quadrature_option_type qopt;
  qopt.set_order (3);
  Float int_f = integrate (omega, f, qopt);
@end example
  The last argument specifies the quadrature formulae 
  (see @ref{quadrature_option_type class})
  used for the computation of the integral.
  The function can be replaced by any field-valued expression (see @ref{field class}).
  For computing a right-hand-side of a variational formulation
  with the previous function @code{f}:
@example
  space Xh (omega, "P1");
  test v (Xh);
  field lh = integrate (f*v);
@end example
  For computing a bilinear form:
@example
  trial u (Xh);
  test v (Xh);
  form m = integrate (u*v);
@end example
  The expression @code{u*v} can be replaced by any bilinear expression (see @ref{field class}).
DEFAULT ARGUMENTS:
  In the case of a linear or bilinear form, the domain is optional: by default it is
  the full domain definition of the test function.
  Also, the quadrature formulae is optional: by default, its order
  is @code{2*k+1} where @code{k} is the polynomial degree of the
  @code{Xh} space associated to the test function @code{v}.
  When both a test @code{u} and trial @code{v} functions are suppied, let k1 and k2 be their polynomial degrees.
  Then the default quadrature is choosen to be exact at least for k1+k2+1 polynoms.
  When the integration is perfomed on a subdomain, this subdomain
  simply replace the first argument and a domain name could also be used:
@example
  field l2h = integrate (omega["boundary"], f*v);
  field l3h = integrate ("boundary", f*v);
@end example
  For convenience, only the domain name can be supplied.
End: */

// ---------------------------------------------------
// 1. numeric integration
// ---------------------------------------------------
// 1.1. general integration of a nonlinear expression
// ---------------------------------------------------
template <class T, class M, class Expr,
    class Result = typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr>::type::value_type>
inline
typename std::enable_if<
     details::is_field_expr_v2_nonlinear_arg<Expr>::value
  && ! is_undeterminated<Result>::value,
  Result
>::type
integrate (const geo_basic<T,M>& omega, const Expr& expr, const quadrature_option_type& qopt,
	   Result dummy = Result())
{
  typedef typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr>::type  wrap_t;
  if (omega.map_dimension() < omega.get_background_geo().map_dimension()) {
    omega.get_background_geo().neighbour_guard();
  }
  Result result(0);
  field_expr_v2_value_assembly (omega, wrap_t(expr), qopt, result);
  return result;
}
// ---------------------------------------------------
// 1.2. measure of the domain
// ---------------------------------------------------
template <class T, class M>
T
integrate (const geo_basic<T,M>& omega, quadrature_option_type&& qopt = quadrature_option_type())
{
  if (qopt.get_order() == std::numeric_limits<quadrature_option_type::size_type>::max()) {
    qopt.set_order(0);
  }
  details::f_constant <point_basic<T>,T> one(1);
  return integrate (omega, one, qopt);
}
// ---------------------------------------------------
// 1.3. when the valued result type is undetermined
// ---------------------------------------------------
// TODO: return a overdetermined<T> value that is an union of all possibilities with a valued_tag
template<class T, class M, class Expr>
inline
typename std::enable_if<
     details::is_field_expr_v2_nonlinear_arg<Expr>::value
  && is_undeterminated<typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr>::type::value_type>::value,
  typename scalar_traits<typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr>::type::value_type>::type
>::type
integrate (const geo_basic<T,M>& omega, const Expr& expr, const quadrature_option_type& qopt)
{
  typedef typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr>::type::value_type undef_t;
  typedef typename scalar_traits<undef_t>::type scalar_type;
  switch (expr.valued_tag()) {
    case space_constant::scalar: {
        return integrate (omega, expr, qopt, scalar_type());
    }
    // others type: problem on how to return a run-type type ?
    // TODO: return an overdetermined union type that convert to one of scalar, point, tensor, etc ?
    default:
        warning_macro ("Expr="<<pretty_typename_macro(Expr));
        error_macro ("integrate: not yet for `"
	  << space_constant::valued_name (expr.valued_tag())
          << "' valued expression");
        return 0;
  }
}
// -------------------------------------------------------
// 2. field-result integration of a variational expression
// -------------------------------------------------------
// 2.1. general call
// -------------------------------------------------------
template <class T, class M, class Expr>
inline
typename
std::enable_if<
  details::is_field_expr_v2_variational_arg<Expr>::value
 ,field_basic<T,M>
>::type
integrate (
  const geo_basic<T,M>& domain, 
  const Expr& expr,
  const quadrature_option_type& qopt = quadrature_option_type())
{
  field_basic<T,M> lh;
  lh.assembly (domain, expr, qopt);
  return lh;
}
// ----------------------------------------------
// 2.2. missing domain
// ----------------------------------------------
template <class Expr>
inline
typename
std::enable_if<
  details::is_field_expr_v2_variational_arg<Expr>::value
 ,field_basic <typename Expr::scalar_type, typename Expr::memory_type>
>::type
integrate (
  const Expr& expr,
  const quadrature_option_type& qopt = quadrature_option_type())
{
  field_basic <typename Expr::scalar_type, typename Expr::memory_type> lh;
  lh.assembly (expr.get_vf_space().get_geo(), expr, qopt);
  return lh;
}
// ----------------------------------------------
// 2.3. subdomain by its name
// ----------------------------------------------
template <class Expr>
inline
typename
std::enable_if<
  details::is_field_expr_v2_variational_arg<Expr>::value
 ,field_basic <typename Expr::scalar_type, typename Expr::memory_type>
>::type
integrate (
  const std::string& domname, 
  const Expr& expr,
  const quadrature_option_type& qopt = quadrature_option_type())
{
  field_basic <typename Expr::scalar_type, typename Expr::memory_type> lh;
  lh.assembly (expr.get_vf_space().get_geo()[domname], expr, qopt);
  return lh;
}
// -------------------------------------------------------
// 3. form-result integration of a variational expression
// -------------------------------------------------------
// 3.1. general call
// -------------------------------------------------------
template <class T, class M, class Expr>
inline
typename
std::enable_if<
  details::is_form_expr_v2_variational_arg<Expr>::value
 ,form_basic <typename Expr::scalar_type, typename Expr::memory_type>
>::type
integrate (
  const geo_basic<T,M>& domain, 
  const Expr& expr,
  const form_option_type& fopt = form_option_type())
{
  form_basic<T,M> a;
  a.assembly (domain, expr, fopt);
  return a;
}
// ----------------------------------------------
// 3.2. missing domain
// ----------------------------------------------
template <class Expr>
inline
typename
std::enable_if<
  details::is_form_expr_v2_variational_arg<Expr>::value
 ,form_basic <typename Expr::scalar_type, typename Expr::memory_type>
>::type
integrate (
  const Expr& expr,
  const form_option_type& fopt = form_option_type())
{
  form_basic <typename Expr::scalar_type, typename Expr::memory_type> a;
  a.assembly (expr.get_test_space().get_geo(), expr, fopt);
  return a;
}
// ----------------------------------------------
// 3.3. subdomain by its name
// ----------------------------------------------
template <class Expr>
inline
typename
std::enable_if<
  details::is_form_expr_v2_variational_arg<Expr>::value
 ,form_basic <typename Expr::scalar_type, typename Expr::memory_type>
>::type
integrate (
  const std::string& domname, 
  const Expr& expr,
  const form_option_type& fopt = form_option_type())
{
  form_basic <typename Expr::scalar_type, typename Expr::memory_type> a;
  a.assembly (expr.get_test_space().get_geo()[domname], expr, fopt);
  return a;
}
// ----------------------------------------------
// 4. variational integration: on a band
// ----------------------------------------------
template <class T, class M, class Expr>
inline
typename
std::enable_if<
  details::is_field_expr_v2_variational_arg<Expr>::value
 ,field_basic <typename Expr::scalar_type, typename Expr::memory_type>
>::type
integrate (
  const band_basic<T,M>& gh, 
  const Expr& expr,
  const quadrature_option_type& qopt = quadrature_option_type())
{
  field_basic <typename Expr::scalar_type, typename Expr::memory_type> lh;
  lh.assembly (gh, expr, qopt);
  return lh;
}
template <class T, class M, class Expr>
inline
typename
std::enable_if<
  details::is_form_expr_v2_variational_arg<Expr>::value
 ,form_basic <typename Expr::scalar_type, typename Expr::memory_type>
>::type
integrate (
  const band_basic<T,M>& gh, 
  const Expr& expr,
  const form_option_type& fopt = form_option_type())
{
  form_basic <typename Expr::scalar_type, typename Expr::memory_type> a;
  a.assembly (gh, expr, fopt);
  return a;
}

}// namespace rheolef
#endif // _RHEO_INTEGRATE_H