Debian Codegraph @

include/deal.II/distributed/field_transfer.h

raw
1 // ------------------------------------------------------------------------
2 //
3 // SPDX-License-Identifier: LGPL-2.1-or-later
4 // Copyright (C) 2022 - 2023 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // Part of the source code is dual licensed under Apache-2.0 WITH
9 // LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10 // governing the source code and code contributions can be found in
11 // LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12 //
13 // ------------------------------------------------------------------------
14
15 #ifndef dealii_distributed_field_transfer_h
16 #define dealii_distributed_field_transfer_h
17
18 #include <deal.II/base/config.h>
19
20 #include <deal.II/distributed/cell_data_transfer.templates.h>
21
22 #include <deal.II/dofs/dof_handler.h>
23
24 #include <memory>
25
26 DEAL_II_NAMESPACE_OPEN
27
28 namespace parallel
29 {
30 namespace distributed
31 {
32 /**
33 * Classes and functions in the experimental namespace can be modified or
34 * removed without being deprecated first.
35 */
36 namespace experimental
37 {
38 /**
39 * This class is similar to SolutionTransfer but it supports the case
40 * where elements have been activated during refinement, i.e., FE_Nothing
41 * elements have been associated with a finite elements during refinement.
42 */
43 template <int dim, typename VectorType, int spacedim = dim>
44 class FieldTransfer
45 {
46 private:
47 using Number = typename VectorType::value_type;
48
49 public:
50 /**
51 * Constructor.
52 *
53 * @param[in] dof_handler The DoFHandler on which all the operations
54 * will happen. This constructor must be called before the underlying
55 * Triangulation is coarsened/refined.
56 */
57 FieldTransfer(const DoFHandler<dim, spacedim> &dof_handler);
58
59 /**
60 * Prepare the current object for coarsening and refinement.
61 * @param[in] in The vector that will be interpolated
62 * @param[in] fe_nothing_index The finite element index associated with
63 * FE_Nothing
64 */
65 void
66 prepare_for_coarsening_and_refinement(
67 const VectorType &in,
68 const unsigned int fe_nothing_index);
69
70 /**
71 * Interpolate the data previously stored in this object before the mesh
72 * was refined or coarsened onto the current set of cells. @p new_value
73 * is the value associated to the new degrees of freedom that where
74 * created during the element activation. @p affine_constraints is the
75 * AffineConstraints after refinement.
76 */
77 void
78 interpolate(const Number &new_value,
79 const AffineConstraints<Number> &affine_constraints,
80 VectorType &out);
81
82 private:
83 /**
84 * DoFHandler associated with the object.
85 */
86 const DoFHandler<dim, spacedim> &dof_handler;
87
88 /**
89 * Data transferred by cell_data_transfer.
90 */
91 std::vector<Vector<Number>> data_to_transfer;
92
93 /**
94 * CellDataTransfer used to perform the field transfer.
95 */
96 std::unique_ptr<
97 CellDataTransfer<dim, spacedim, std::vector<Vector<Number>>>>
98 cell_data_transfer;
99 };
100 } // namespace experimental
101 } // namespace distributed
102 } // namespace parallel
103
104 DEAL_II_NAMESPACE_CLOSE
105
106 #endif