/usr/include/deal.II/multigrid/mg_transfer_matrix_free.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 | // ---------------------------------------------------------------------
//
// Copyright (C) 2016 - 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__mg_transfer_matrix_free_h
#define dealii__mg_transfer_matrix_free_h
#include <deal.II/base/config.h>
#include <deal.II/lac/parallel_vector.h>
#include <deal.II/multigrid/mg_base.h>
#include <deal.II/multigrid/mg_constrained_dofs.h>
#include <deal.II/base/mg_level_object.h>
#include <deal.II/multigrid/mg_transfer.h>
#include <deal.II/matrix_free/shape_info.h>
#include <deal.II/dofs/dof_handler.h>
DEAL_II_NAMESPACE_OPEN
/*!@addtogroup mg */
/*@{*/
/**
* Implementation of the MGTransferBase interface for which the transfer
* operations is implemented in a matrix-free way based on the interpolation
* matrices of the underlying finite element. This requires considerably less
* memory than MGTransferPrebuilt and can also be considerably faster than
* that variant.
*
* This class currently only works for tensor-product finite elements based on
* FE_Q and FE_DGQ elements, including systems involving multiple components
* of one of these elements. Systems with different elements or other elements
* are currently not implemented.
*
* @author Martin Kronbichler
* @date 2016
*/
template <int dim, typename Number>
class MGTransferMatrixFree : public MGLevelGlobalTransfer<parallel::distributed::Vector<Number> >
{
public:
/**
* Constructor without constraint matrices. Use this constructor only with
* discontinuous finite elements or with no local refinement.
*/
MGTransferMatrixFree ();
/**
* Constructor with constraints. Equivalent to the default constructor
* followed by initialize_constraints().
*/
MGTransferMatrixFree (const MGConstrainedDoFs &mg_constrained_dofs);
/**
* Destructor.
*/
virtual ~MGTransferMatrixFree ();
/**
* Initialize the constraints to be used in build().
*/
void initialize_constraints (const MGConstrainedDoFs &mg_constrained_dofs);
/**
* Reset the object to the state it had right after the default constructor.
*/
void clear ();
/**
* Actually build the information for the prolongation for each level.
*/
void build (const DoFHandler<dim,dim> &mg_dof);
/**
* Prolongate a vector from level <tt>to_level-1</tt> to level
* <tt>to_level</tt> using the embedding matrices of the underlying finite
* element. The previous content of <tt>dst</tt> is overwritten.
*
* @param src is a vector with as many elements as there are degrees of
* freedom on the coarser level involved.
*
* @param dst has as many elements as there are degrees of freedom on the
* finer level.
*/
virtual void prolongate (const unsigned int to_level,
parallel::distributed::Vector<Number> &dst,
const parallel::distributed::Vector<Number> &src) const;
/**
* Restrict a vector from level <tt>from_level</tt> to level
* <tt>from_level-1</tt> using the transpose operation of the prolongate()
* method. If the region covered by cells on level <tt>from_level</tt> is
* smaller than that of level <tt>from_level-1</tt> (local refinement), then
* some degrees of freedom in <tt>dst</tt> are active and will not be
* altered. For the other degrees of freedom, the result of the restriction
* is added.
*
* @param src is a vector with as many elements as there are degrees of
* freedom on the finer level involved.
*
* @param dst has as many elements as there are degrees of freedom on the
* coarser level.
*/
virtual void restrict_and_add (const unsigned int from_level,
parallel::distributed::Vector<Number> &dst,
const parallel::distributed::Vector<Number> &src) const;
/**
* Finite element does not provide prolongation matrices.
*/
DeclException0(ExcNoProlongation);
/**
* Memory used by this object.
*/
std::size_t memory_consumption () const;
private:
/**
* Stores the degree of the finite element contained in the DoFHandler
* passed to build(). The selection of the computational kernel is based on
* this number.
*/
unsigned int fe_degree;
/**
* Stores whether the element is continuous and there is a joint degree of
* freedom in the center of the 1D line.
*/
bool element_is_continuous;
/**
* Stores the number of components in the finite element contained in the
* DoFHandler passed to build().
*/
unsigned int n_components;
/**
* Stores the number of degrees of freedom on all child cells. It is
* <tt>2<sup>dim</sup>*fe.dofs_per_cell</tt> for DG elements and somewhat
* less for continuous elements.
*/
unsigned int n_child_cell_dofs;
/**
* Holds the indices for cells on a given level, extracted from DoFHandler
* for fast access. All DoF indices on a given level are stored as a plain
* array (since this class assumes constant DoFs per cell). To index into
* this array, use the cell number times dofs_per_cell.
*
* This array first is arranged such that all locally owned level cells come
* first (found in the variable n_owned_level_cells) and then other cells
* necessary for the transfer to the next level.
*/
std::vector<std::vector<unsigned int> > level_dof_indices;
/**
* Stores the connectivity from parent to child cell numbers for each level.
*/
std::vector<std::vector<std::pair<unsigned int,unsigned int> > > parent_child_connect;
/**
* Stores the number of cells owned on a given process (sets the bounds for
* the worker loops) for each level.
*/
std::vector<unsigned int> n_owned_level_cells;
/**
* Holds the one-dimensional embedding (prolongation) matrix from mother
* element to the children.
*/
internal::MatrixFreeFunctions::ShapeInfo<Number> shape_info;
/**
* Holds the temporary values for the tensor evaluation
*/
mutable AlignedVector<VectorizedArray<Number> > evaluation_data;
/**
* For continuous elements, restriction is not additive and we need to
* weight the result at the end of prolongation (and at the start of
* restriction) by the valence of the degrees of freedom, i.e., on how many
* elements they appear. We store the data in vectorized form to allow for
* cheap access. Moreover, we utilize the fact that we only need to store
* <tt>3<sup>dim</sup></tt> indices.
*
* Data is organized in terms of each level (outer vector) and the cells on
* each level (inner vector).
*/
std::vector<AlignedVector<VectorizedArray<Number> > > weights_on_refined;
/**
* Stores the local indices of Dirichlet boundary conditions on cells for
* all levels (outer index), the cells within the levels (second index), and
* the indices on the cell (inner index).
*/
std::vector<std::vector<std::vector<unsigned short> > > dirichlet_indices;
/**
* Performs templated prolongation operation
*/
template <int degree>
void do_prolongate_add(const unsigned int to_level,
parallel::distributed::Vector<Number> &dst,
const parallel::distributed::Vector<Number> &src) const;
/**
* Performs templated restriction operation
*/
template <int degree>
void do_restrict_add(const unsigned int from_level,
parallel::distributed::Vector<Number> &dst,
const parallel::distributed::Vector<Number> &src) const;
};
/*@}*/
DEAL_II_NAMESPACE_CLOSE
#endif
|