ExaDG
Toggle main menu visibility
Loading...
Searching...
No Matches
include
exadg
operators
solution_transfer.h
1
/* ______________________________________________________________________
2
*
3
* ExaDG - High-Order Discontinuous Galerkin for the Exa-Scale
4
*
5
* Copyright (C) 2023 by the ExaDG authors
6
*
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <https://www.gnu.org/licenses/>.
19
* ______________________________________________________________________
20
*/
21
22
#ifndef EXADG_OPERATORS_SOLUTION_TRANSFER_H_
23
#define EXADG_OPERATORS_SOLUTION_TRANSFER_H_
24
25
// deal.II
26
#include <deal.II/distributed/tria.h>
27
#include <deal.II/grid/tria.h>
28
#include <deal.II/numerics/solution_transfer.h>
29
30
namespace
ExaDG
31
{
32
template
<
int
dim,
typename
VectorType>
33
class
SolutionTransfer
34
{
35
public
:
36
/*
37
* Constructor.
38
*/
39
SolutionTransfer(dealii::DoFHandler<dim>
const
& dof_handler_in)
40
{
41
dof_handler = &dof_handler_in;
42
}
43
44
void
45
prepare_coarsening_and_refinement(std::vector<VectorType *> & vectors)
46
{
47
std::vector<VectorType const *> vectors_old_grid_ptr(vectors.size());
48
for
(
unsigned
int
i = 0; i < vectors.size(); ++i)
49
{
50
vectors[i]->update_ghost_values();
51
vectors_old_grid_ptr[i] = vectors[i];
52
}
53
54
pd_solution_transfer =
55
std::make_shared<dealii::SolutionTransfer<dim, VectorType>>(*dof_handler);
56
57
pd_solution_transfer->prepare_for_coarsening_and_refinement(vectors_old_grid_ptr);
58
}
59
60
void
61
interpolate_after_coarsening_and_refinement(std::vector<VectorType *> & vectors)
62
{
63
// Note that the sequence of vectors per DofHandler/SolutionTransfer
64
// defined in Operator<dim, Number>::prepare_coarsening_and_refinement()
65
// and solution transfer calls here *need to match*.
66
pd_solution_transfer->interpolate(vectors);
67
}
68
69
private
:
70
std::shared_ptr<dealii::SolutionTransfer<dim, VectorType>> pd_solution_transfer;
71
72
dealii::ObserverPointer<dealii::DoFHandler<dim>
const
> dof_handler;
73
};
74
75
}
// namespace ExaDG
76
77
#endif
/* EXADG_OPERATORS_SOLUTION_TRANSFER_H_ */
ExaDG
Definition
driver.cpp:33
Generated by
1.17.0