This file is indexed.

/usr/include/deal.II/base/tensor_deprecated.h is in libdeal.ii-dev 8.4.2-2+b1.

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
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
// ---------------------------------------------------------------------
//
// Copyright (C) 1998 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
// The deal.II library is free software; you can use it, 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 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE at
// the top level of the deal.II distribution.
//
// ---------------------------------------------------------------------

#ifndef dealii__tensor_deprecated_h
#define dealii__tensor_deprecated_h

#include <deal.II/base/tensor.h>


/* --------- Deprecated non-member functions operating on tensors. ---------- */

DEAL_II_NAMESPACE_OPEN

/**
 * @name Deprecated Tensor operations
 */
//@{

/**
 * Exception.
 *
 * @deprecated
 */
DeclException1 (ExcInvalidTensorContractionIndex,
                int,
                << "You have requested contraction of tensors over index "
                << arg1
                << ", but this is not possible for tensors of the current type.");


/**
 * Double contract two tensors of rank 2, thus computing the Frobenius inner
 * product <tt>sum<sub>i,j</sub> src1[i][j]*src2[i][j]</tt>.
 *
 * @deprecated Use the double_contract() function that takes indices as
 * template arguments and returns its result instead.
 * @relates Tensor
 */
template <int dim, typename Number>
inline
Number double_contract (const Tensor<2, dim, Number> &src1,
                        const Tensor<2, dim, Number> &src2) DEAL_II_DEPRECATED;


/**
 * Contract the last two indices of <tt>src1</tt> with the two indices
 * <tt>src2</tt>, creating a rank-2 tensor. This is the matrix-vector product
 * analog operation between tensors of rank 4 and rank 2.
 *
 * @deprecated Use the double_contract() function that takes indices as
 * template arguments and returns its result instead.
 * @relates Tensor
 */
template <int dim, typename Number>
inline
void double_contract (Tensor<2,dim,Number>       &dest,
                      const Tensor<4,dim,Number> &src1,
                      const Tensor<2,dim,Number> &src2) DEAL_II_DEPRECATED;

/**
 * Contract a tensor of rank 2 with a tensor of rank 2. The contraction is
 * performed over index <tt>index1</tt> of the first tensor, and
 * <tt>index2</tt> of the second tensor. Note that the number of the index is
 * counted from 1 on, not from zero as usual.
 *
 * @deprecated Use the contract() function that takes indices as template
 * arguments and returns its result instead.
 * @relates Tensor
 */
template <int dim, typename Number>
inline
void contract (Tensor<2,dim,Number>       &dest,
               const Tensor<2,dim,Number> &src1,
               const unsigned int          index1,
               const Tensor<2,dim,Number> &src2,
               const unsigned int          index3) DEAL_II_DEPRECATED;

/**
 * Contract a tensor of rank 3 with a tensor of rank 1. The contraction is
 * performed over index <tt>index1</tt> of the first tensor. Note that the
 * number of the index is counted from 1 on, not from zero as usual.
 *
 * @deprecated Use the contract() function that takes indices as template
 * arguments and returns its result instead.
 * @relates Tensor
 */
template <int dim, typename Number>
inline
void contract (Tensor<2,dim,Number>       &dest,
               const Tensor<3,dim,Number> &src1,
               const unsigned int          index1,
               const Tensor<1,dim,Number> &src2) DEAL_II_DEPRECATED;

/**
 * Contract a tensor of rank 3 with a tensor of rank 2. The contraction is
 * performed over index <tt>index1</tt> of the first tensor, and
 * <tt>index2</tt> of the second tensor. Note that the number of the index is
 * counted from 1 on, not from zero as usual.
 *
 * @deprecated Use the contract() function that takes indices as template
 * arguments and returns its result instead.
 * @relates Tensor
 */
template <int dim, typename Number>
inline
void contract (Tensor<3,dim,Number>       &dest,
               const Tensor<3,dim,Number> &src1,
               const unsigned int          index1,
               const Tensor<2,dim,Number> &src2,
               const unsigned int          index2) DEAL_II_DEPRECATED;

/**
 * Single contraction for tensors: contract the last index of a tensor @p src1
 * of rank @p rank_1 with the first index of a tensor @p src2 of rank @p
 * rank_2.
 *
 * @deprecated Use operator* instead. It denotes a single contraction.
 * @relates Tensor
 */
template <int rank_1, int rank_2, int dim, typename Number>
inline
void contract (Tensor<rank_1 + rank_2 - 2, dim, Number> &dest,
               const Tensor<rank_1 ,dim, Number>        &src1,
               const Tensor<rank_2 ,dim, Number>        &src2) DEAL_II_DEPRECATED;

/**
 * Contract a tensor of rank 1 with a tensor of rank 1 and return the result.
 *
 * @deprecated Use operator* instead. It denotes a single contraction.
 * @relates Tensor
 */
template <int dim, typename Number, typename OtherNumber>
inline
typename ProductType<Number,OtherNumber>::type
contract (const Tensor<1,dim,Number> &src1,
          const Tensor<1,dim,OtherNumber> &src2) DEAL_II_DEPRECATED;


/**
 * The cross product of one vector in 2d. This is just a rotation by 90
 * degrees.
 *
 * @deprecated Use the function cross_product_2d() that returns the value.
 * @relates Tensor
 */
template <int dim, typename Number>
inline
void
cross_product (Tensor<1,dim,Number>       &dst,
               const Tensor<1,dim,Number> &src) DEAL_II_DEPRECATED;

/**
 * The cross product of 2 vectors in 3d.
 *
 * @deprecated Use the function cross_product_3d() that returns the value.
 * @relates Tensor
 */
template <int dim, typename Number>
inline
void
cross_product (Tensor<1,dim,Number>       &dst,
               const Tensor<1,dim,Number> &src1,
               const Tensor<1,dim,Number> &src2) DEAL_II_DEPRECATED;

/**
 * Form the outer product of two tensors.
 *
 * @deprecated Use the generic version that returns its result instead.
 * @relates Tensor
 */
template <int rank_1, int rank_2, int dim, typename Number>
inline
void outer_product(Tensor<rank_1 + rank_2, dim, Number> &dst,
                   const Tensor<rank_1, dim, Number>    &src1,
                   const Tensor<rank_2, dim, Number>    &src2) DEAL_II_DEPRECATED;

/**
 * Multiply a Tensor<1,dim,Number> with a Number.
 *
 * @deprecated Use operator* instead.
 * @relates Tensor
 */
template <int dim, typename Number>
inline
void outer_product (Tensor<1,dim,Number>       &dst,
                    const Number                src1,
                    const Tensor<1,dim,Number> &src2) DEAL_II_DEPRECATED;

/**
 * Multiply a Tensor<1,dim,Number> with a Number.
 *
 * @deprecated Use operator* instead.
 * @relates Tensor
 */
template <int dim, typename Number>
inline
void outer_product (Tensor<1,dim,Number>       &dst,
                    const Tensor<1,dim,Number>  src1,
                    const Number                src2) DEAL_II_DEPRECATED;

/**
 * @deprecated Do not use this function, evaluate the value manually.
 * @relates Tensor
 */
template <int rank, typename Number>
inline
Number determinant (const Tensor<rank,1,Number> &t) DEAL_II_DEPRECATED;


/**
 * @deprecated Do not use this function, evaluate the value manually.
 * @relates Tensor
 */
template <typename Number>
inline
Number determinant (const Tensor<1,1,Number> &t) DEAL_II_DEPRECATED;

//@}

/* ----------------------------- Definitions: ------------------------------- */

template <int dim, typename Number>
inline
Number double_contract (const Tensor<2, dim, Number> &src1,
                        const Tensor<2, dim, Number> &src2)
{
  Number res = 0.;
  for (unsigned int i=0; i<dim; ++i)
    res += src1[i] * src2[i];

  return res;
}

template <int dim, typename Number>
inline
void double_contract (Tensor<2,dim,Number>       &dest,
                      const Tensor<4,dim,Number> &src1,
                      const Tensor<2,dim,Number> &src2)
{
  dest.clear ();
  for (unsigned int i=0; i<dim; ++i)
    for (unsigned int j=0; j<dim; ++j)
      for (unsigned int k=0; k<dim; ++k)
        for (unsigned int l=0; l<dim; ++l)
          dest[i][j] += src1[i][j][k][l] * src2[k][l];
}

template <int dim, typename Number>
inline
void contract (Tensor<2,dim,Number>       &dest,
               const Tensor<2,dim,Number> &src1,   const unsigned int index1,
               const Tensor<2,dim,Number> &src2,   const unsigned int index2)
{
  dest.clear ();

  switch (index1)
    {
    case 1:
      switch (index2)
        {
        case 1:
          for (unsigned int i=0; i<dim; ++i)
            for (unsigned int j=0; j<dim; ++j)
              for (unsigned int k=0; k<dim; ++k)
                dest[i][j] += src1[k][i] * src2[k][j];
          break;
        case 2:
          for (unsigned int i=0; i<dim; ++i)
            for (unsigned int j=0; j<dim; ++j)
              for (unsigned int k=0; k<dim; ++k)
                dest[i][j] += src1[k][i] * src2[j][k];
          break;

        default:
          Assert (false, (ExcInvalidTensorContractionIndex (index2)));
        };
      break;
    case 2:
      switch (index2)
        {
        case 1:
          for (unsigned int i=0; i<dim; ++i)
            for (unsigned int j=0; j<dim; ++j)
              for (unsigned int k=0; k<dim; ++k)
                dest[i][j] += src1[i][k] * src2[k][j];
          break;
        case 2:
          for (unsigned int i=0; i<dim; ++i)
            for (unsigned int j=0; j<dim; ++j)
              for (unsigned int k=0; k<dim; ++k)
                dest[i][j] += src1[i][k] * src2[j][k];
          break;

        default:
          Assert (false, (ExcInvalidTensorContractionIndex (index2)));
        };
      break;

    default:
      Assert (false, (ExcInvalidTensorContractionIndex (index1)));
    };
}

template <int dim, typename Number>
inline
void contract (Tensor<2,dim,Number>       &dest,
               const Tensor<3,dim,Number> &src1,   const unsigned int index1,
               const Tensor<1,dim,Number> &src2)
{
  dest.clear ();

  switch (index1)
    {
    case 1:
      for (unsigned int i=0; i<dim; ++i)
        for (unsigned int j=0; j<dim; ++j)
          for (unsigned int k=0; k<dim; ++k)
            dest[i][j] += src1[k][i][j] * src2[k];
      break;

    case 2:
      for (unsigned int i=0; i<dim; ++i)
        for (unsigned int j=0; j<dim; ++j)
          for (unsigned int k=0; k<dim; ++k)
            dest[i][j] += src1[i][k][j] * src2[k];
      break;

    case 3:
      for (unsigned int i=0; i<dim; ++i)
        for (unsigned int j=0; j<dim; ++j)
          for (unsigned int k=0; k<dim; ++k)
            dest[i][j] += src1[i][j][k] * src2[k];
      break;

    default:
      Assert (false, (ExcInvalidTensorContractionIndex (index1)));
    };
}

template <int dim, typename Number>
inline
void contract (Tensor<3,dim,Number>       &dest,
               const Tensor<3,dim,Number> &src1, const unsigned int index1,
               const Tensor<2,dim,Number> &src2, const unsigned int index2)
{
  dest.clear ();

  switch (index1)
    {
    case 1:
      switch (index2)
        {
        case 1:
          for (unsigned int i=0; i<dim; ++i)
            for (unsigned int j=0; j<dim; ++j)
              for (unsigned int k=0; k<dim; ++k)
                for (unsigned int l=0; l<dim; ++l)
                  dest[i][j][k] += src1[l][i][j] * src2[l][k];
          break;
        case 2:
          for (unsigned int i=0; i<dim; ++i)
            for (unsigned int j=0; j<dim; ++j)
              for (unsigned int k=0; k<dim; ++k)
                for (unsigned int l=0; l<dim; ++l)
                  dest[i][j][k] += src1[l][i][j] * src2[k][l];
          break;
        default:
          Assert (false, (ExcInvalidTensorContractionIndex (index2)));
        }

      break;
    case 2:
      switch (index2)
        {
        case 1:
          for (unsigned int i=0; i<dim; ++i)
            for (unsigned int j=0; j<dim; ++j)
              for (unsigned int k=0; k<dim; ++k)
                for (unsigned int l=0; l<dim; ++l)
                  dest[i][j][k] += src1[i][l][j] * src2[l][k];
          break;
        case 2:
          for (unsigned int i=0; i<dim; ++i)
            for (unsigned int j=0; j<dim; ++j)
              for (unsigned int k=0; k<dim; ++k)
                for (unsigned int l=0; l<dim; ++l)
                  dest[i][j][k] += src1[i][l][j] * src2[k][l];
          break;
        default:
          Assert (false, (ExcInvalidTensorContractionIndex (index2)));
        }

      break;
    case 3:
      switch (index2)
        {
        case 1:
          for (unsigned int i=0; i<dim; ++i)
            for (unsigned int j=0; j<dim; ++j)
              for (unsigned int k=0; k<dim; ++k)
                for (unsigned int l=0; l<dim; ++l)
                  dest[i][j][k] += src1[i][j][l] * src2[l][k];
          break;
        case 2:
          for (unsigned int i=0; i<dim; ++i)
            for (unsigned int j=0; j<dim; ++j)
              for (unsigned int k=0; k<dim; ++k)
                for (unsigned int l=0; l<dim; ++l)
                  dest[i][j][k] += src1[i][j][l] * src2[k][l];
          break;
        default:
          Assert (false, (ExcInvalidTensorContractionIndex (index2)));
        }

      break;
    default:
      Assert (false, (ExcInvalidTensorContractionIndex (index1)));
    }
}

template <int rank_1, int rank_2, int dim, typename Number>
inline
void contract (Tensor<rank_1 + rank_2 - 2, dim, Number> &dest,
               const Tensor<rank_1 ,dim, Number>        &src1,
               const Tensor<rank_2 ,dim, Number>        &src2)
{
  TensorAccessors::internal::ReorderedIndexView<0, rank_2, const Tensor<rank_2, dim, Number> >
  reordered = TensorAccessors::reordered_index_view<0, rank_2>(src2);
  TensorAccessors::contract<1, rank_1, rank_2, dim>(dest, src1, reordered);
}

template <int dim, typename Number, typename OtherNumber>
inline
typename ProductType<Number,OtherNumber>::type
contract (const Tensor<1,dim,Number> &src1,
          const Tensor<1,dim,OtherNumber> &src2)
{
  typename ProductType<Number,OtherNumber>::type res
    = typename ProductType<Number,OtherNumber>::type();
  for (unsigned int i=0; i<dim; ++i)
    res += src1[i] * src2[i];

  return res;
}

template <int dim, typename Number>
inline
void
cross_product (Tensor<1,dim,Number>       &dst,
               const Tensor<1,dim,Number> &src)
{
  dst = cross_product_2d(src);
}

template <int dim, typename Number>
inline
void
cross_product (Tensor<1,dim,Number>       &dst,
               const Tensor<1,dim,Number> &src1,
               const Tensor<1,dim,Number> &src2)
{
  dst = cross_product_3d(src1, src2);
}

template <int rank_1, int rank_2, int dim, typename Number>
inline
void outer_product(Tensor<rank_1 + rank_2, dim, Number> &dst,
                   const Tensor<rank_1, dim, Number>    &src1,
                   const Tensor<rank_2, dim, Number>    &src2)
{
  TensorAccessors::contract<0, rank_1, rank_2, dim>(dst, src1, src2);
}

template <int dim, typename Number>
inline
void outer_product (Tensor<1,dim,Number>       &dst,
                    const Number                src1,
                    const Tensor<1,dim,Number> &src2)
{
  for (unsigned int i=0; i<dim; ++i)
    dst[i] = src1 * src2[i];
}

template <int dim, typename Number>
inline
void outer_product (Tensor<1,dim,Number>       &dst,
                    const Tensor<1,dim,Number>  src1,
                    const Number         src2)
{
  for (unsigned int i=0; i<dim; ++i)
    dst[i] = src1[i] * src2;
}

template <int rank, typename Number>
inline
Number determinant (const Tensor<rank,1,Number> &t)
{
  return determinant(t[0]);
}

template <typename Number>
inline
Number determinant (const Tensor<1,1,Number> &t)
{
  return t[0];
}

DEAL_II_NAMESPACE_CLOSE

#endif