This file is indexed.

/usr/include/deal.II/matrix_free/mapping_data_on_the_fly.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
// ---------------------------------------------------------------------
//
// Copyright (C) 2014 - 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__matrix_free_mapping_data_on_the_fly_h
#define dealii__matrix_free_mapping_data_on_the_fly_h


#include <deal.II/base/config.h>
#include <deal.II/base/exceptions.h>
#include <deal.II/base/subscriptor.h>
#include <deal.II/base/vectorization.h>
#include <deal.II/base/aligned_vector.h>
#include <deal.II/matrix_free/shape_info.h>
#include <deal.II/matrix_free/mapping_info.h>
#include <deal.II/fe/fe_values.h>
#include <deal.II/fe/fe_nothing.h>


DEAL_II_NAMESPACE_OPEN


namespace internal
{
  namespace MatrixFreeFunctions
  {
    /**
     * This class provides evaluated mapping information using standard
     * deal.II information in a form that FEEvaluation and friends can use for
     * vectorized access. Since no vectorization over cells is available with
     * the DoFHandler/Triangulation cell iterators, the interface to
     * FEEvaluation's vectorization model is to use @p
     * VectorizedArray::n_array_element copies of the same element. This
     * interface is thus primarily useful for evaluating several operators on
     * the same cell, e.g., when assembling cell matrices.
     *
     * As opposed to the Mapping classes in deal.II, this class does not
     * actually provide a boundary description that can be used to evaluate
     * the geometry, but it rather provides the evaluated geometry from a
     * given deal.II mapping (as passed to the constructor of this class) in a
     * form accessible to FEEvaluation.
     *
     * @author Martin Kronbichler, 2014
     */
    template <int dim, typename Number=double>
    class MappingDataOnTheFly
    {
    public:
      /**
       * Constructor, similar to FEValues. Since this class only evaluates the
       * geometry, no finite element has to be specified and the simplest
       * element, FE_Nothing, is used internally for the underlying FEValues
       * object.
       */
      MappingDataOnTheFly (const Mapping<dim> &mapping,
                           const Quadrature<1> &quadrature,
                           const UpdateFlags update_flags);

      /**
       * Constructor. This constructor is equivalent to the other one except
       * that it makes the object use a $Q_1$ mapping (i.e., an object of type
       * MappingQGeneric(1)) implicitly.
       */
      MappingDataOnTheFly (const Quadrature<1> &quadrature,
                           const UpdateFlags update_flags);

      /**
       * Initialize with the given cell iterator.
       */
      void reinit(typename dealii::Triangulation<dim>::cell_iterator cell);

      /**
       * Returns whether reinit() has been called at least once, i.e., a cell
       * has been set.
       */
      bool is_initialized() const;

      /**
       * Return a triangulation iterator to the current cell.
       */
      typename dealii::Triangulation<dim>::cell_iterator get_cell () const;

      /**
       * Return a reference to the underlying FEValues object that evaluates
       * certain quantities (only mapping-related ones like Jacobians or
       * mapped quadrature points are accessible, as no finite element data is
       * actually used).
       */
      const dealii::FEValues<dim> &get_fe_values () const;

      /**
       * Return a vector of inverse transpose Jacobians. For compatibility
       * with FEEvaluation, it returns tensors of vectorized arrays, even
       * though all components are equal.
       */
      const AlignedVector<Tensor<2,dim,VectorizedArray<Number> > > &
      get_inverse_jacobians() const;

      /**
       * Return a vector of quadrature weights times the Jacobian determinant
       * (JxW). For compatibility with FEEvaluation, it returns tensors of
       * vectorized arrays, even though all components are equal.
       */
      const AlignedVector<VectorizedArray<Number> > &
      get_JxW_values() const;

      /**
       * Return a vector of quadrature points in real space on the given cell.
       * For compatibility with FEEvaluation, it returns tensors of vectorized
       * arrays, even though all components are equal.
       */
      const AlignedVector<Point<dim,VectorizedArray<Number> > > &
      get_quadrature_points() const;

      /**
       * Return a vector of normal vectors in real space on the given cell.
       * For compatibility with FEEvaluation, it returns tensors of vectorized
       * arrays, even though all components are equal.
       */
      const AlignedVector<Tensor<1,dim,VectorizedArray<Number> > > &
      get_normal_vectors() const;

      /**
       * Return a reference to 1D quadrature underlying this object.
       */
      const Quadrature<1> &
      get_quadrature () const;

    private:
      /**
       * A cell iterator in case we generate the data on the fly to be able to
       * check if we need to re-generate the information stored in this class.
       */
      typename dealii::Triangulation<dim>::cell_iterator present_cell;

      /**
       * Dummy finite element object necessary for initializing the FEValues
       * object.
       */
      FE_Nothing<dim> fe_dummy;

      /**
       * An underlying FEValues object that performs the (scalar) evaluation.
       */
      dealii::FEValues<dim> fe_values;

      /**
       * Get 1D quadrature formula to be used for reinitializing shape info.
       */
      const Quadrature<1> quadrature_1d;

      /**
       * Inverse Jacobians, stored in vectorized array form.
       */
      AlignedVector<Tensor<2,dim,VectorizedArray<Number> > > inverse_jacobians;

      /**
       * Stored Jacobian determinants and quadrature weights
       */
      AlignedVector<VectorizedArray<Number> > jxw_values;

      /**
       * Stored quadrature points
       */
      AlignedVector<Point<dim,VectorizedArray<Number> > > quadrature_points;

      /**
       * Stored normal vectors (for face integration)
       */
      AlignedVector<Tensor<1,dim,VectorizedArray<Number> > > normal_vectors;
    };


    /*----------------------- Inline functions ----------------------------------*/

    template <int dim, typename Number>
    inline
    MappingDataOnTheFly<dim,Number>::MappingDataOnTheFly (const Mapping<dim> &mapping,
                                                          const Quadrature<1> &quadrature,
                                                          const UpdateFlags update_flags)
      :
      fe_values(mapping, fe_dummy, Quadrature<dim>(quadrature),
                internal::MatrixFreeFunctions::MappingInfo<dim,Number>::compute_update_flags(update_flags)),
      quadrature_1d(quadrature),
      inverse_jacobians(fe_values.get_quadrature().size()),
      jxw_values(fe_values.get_quadrature().size()),
      quadrature_points(fe_values.get_quadrature().size()),
      normal_vectors(fe_values.get_quadrature().size())
    {
      Assert(!(fe_values.get_update_flags() & update_jacobian_grads),
             ExcNotImplemented());
    }



    template <int dim, typename Number>
    inline
    MappingDataOnTheFly<dim,Number>::MappingDataOnTheFly (const Quadrature<1> &quadrature,
                                                          const UpdateFlags update_flags)
      :
      fe_values(fe_dummy, Quadrature<dim>(quadrature),
                internal::MatrixFreeFunctions::MappingInfo<dim,Number>::compute_update_flags(update_flags)),
      quadrature_1d(quadrature),
      inverse_jacobians(fe_values.get_quadrature().size()),
      jxw_values(fe_values.get_quadrature().size()),
      quadrature_points(fe_values.get_quadrature().size()),
      normal_vectors(fe_values.get_quadrature().size())
    {
      Assert(!(fe_values.get_update_flags() & update_jacobian_grads),
             ExcNotImplemented());
    }



    template <int dim, typename Number>
    inline
    void
    MappingDataOnTheFly<dim,Number>::reinit(typename dealii::Triangulation<dim>::cell_iterator cell)
    {
      if (present_cell == cell)
        return;
      present_cell = cell;
      fe_values.reinit(present_cell);
      for (unsigned int q=0; q<fe_values.get_quadrature().size(); ++q)
        {
          if (fe_values.get_update_flags() & update_inverse_jacobians)
            for (unsigned int d=0; d<dim; ++d)
              for (unsigned int e=0; e<dim; ++e)
                inverse_jacobians[q][d][e] = fe_values.inverse_jacobian(q)[e][d];
          if (fe_values.get_update_flags() & update_quadrature_points)
            for (unsigned int d=0; d<dim; ++d)
              quadrature_points[q][d] = fe_values.quadrature_point(q)[d];
          if (fe_values.get_update_flags() & update_normal_vectors)
            for (unsigned int d=0; d<dim; ++d)
              normal_vectors[q][d] = fe_values.normal_vector(q)[d];
          if (fe_values.get_update_flags() & update_JxW_values)
            jxw_values[q] = fe_values.JxW(q);
        }
    }



    template <int dim, typename Number>
    inline
    bool
    MappingDataOnTheFly<dim,Number>::is_initialized() const
    {
      return present_cell != typename dealii::Triangulation<dim>::cell_iterator();
    }



    template <int dim, typename Number>
    inline
    typename dealii::Triangulation<dim>::cell_iterator
    MappingDataOnTheFly<dim,Number>::get_cell() const
    {
      return fe_values.get_cell();
    }



    template <int dim, typename Number>
    inline
    const dealii::FEValues<dim> &
    MappingDataOnTheFly<dim,Number>::get_fe_values() const
    {
      return fe_values;
    }



    template <int dim, typename Number>
    inline
    const AlignedVector<Tensor<2,dim,VectorizedArray<Number> > > &
    MappingDataOnTheFly<dim,Number>::get_inverse_jacobians() const
    {
      return inverse_jacobians;
    }



    template <int dim, typename Number>
    inline
    const AlignedVector<Tensor<1,dim,VectorizedArray<Number> > > &
    MappingDataOnTheFly<dim,Number>::get_normal_vectors() const
    {
      return normal_vectors;
    }



    template <int dim, typename Number>
    inline
    const AlignedVector<Point<dim,VectorizedArray<Number> > > &
    MappingDataOnTheFly<dim,Number>::get_quadrature_points() const
    {
      return quadrature_points;
    }



    template <int dim, typename Number>
    inline
    const AlignedVector<VectorizedArray<Number> > &
    MappingDataOnTheFly<dim,Number>::get_JxW_values() const
    {
      return jxw_values;
    }



    template <int dim, typename Number>
    inline
    const Quadrature<1> &
    MappingDataOnTheFly<dim,Number>::get_quadrature() const
    {
      return quadrature_1d;
    }


  } // end of namespace MatrixFreeFunctions
} // end of namespace internal


DEAL_II_NAMESPACE_CLOSE

#endif