Reference documentation for deal.II version 9.5.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
mg_transfer_component.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (C) 2001 - 2023 by the deal.II authors
4//
5// This file is part of the deal.II library.
6//
7// The deal.II library is free software; you can use it, redistribute
8// it, and/or modify it under the terms of the GNU Lesser General
9// Public License as published by the Free Software Foundation; either
10// version 2.1 of the License, or (at your option) any later version.
11// The full text of the license can be found in the file LICENSE.md at
12// the top level directory of deal.II.
13//
14// ---------------------------------------------------------------------
15
16#ifndef dealii_mg_transfer_component_h
17#define dealii_mg_transfer_component_h
18
19#include <deal.II/base/config.h>
20
22
24
26
31
33
34#include <memory>
35
36
37
39
40// Forward declaration
41#ifndef DOXYGEN
42template <int dim, int spacedim>
44class DoFHandler;
45#endif
46
47/*
48 * MGTransferBase is defined in mg_base.h
49 */
50
64{
65public:
69 std::size_t
70 memory_consumption() const;
71
72
73protected:
84 template <int dim, int spacedim>
85 void
86 build(const DoFHandler<dim, spacedim> &dof_handler);
87
96
105
109 std::vector<unsigned int> target_component;
110
114 std::vector<unsigned int> mg_target_component;
115
119 mutable std::vector<std::vector<types::global_dof_index>> sizes;
120
124 std::vector<types::global_dof_index> component_start;
125
129 std::vector<std::vector<types::global_dof_index>> mg_component_start;
130
135
136private:
137 std::vector<std::shared_ptr<BlockSparsityPattern>> prolongation_sparsities;
138
139protected:
145 std::vector<std::shared_ptr<BlockSparseMatrix<double>>> prolongation_matrices;
146
151 std::vector<std::vector<std::pair<types::global_dof_index, unsigned int>>>
153
158 std::vector<std::set<types::global_dof_index>> boundary_indices;
159};
160
161// TODO:[GK] Update documentation for copy_* functions
162
163// TODO: Use same kind of template argument as MGTransferSelect
164
174template <typename number>
175class MGTransferSelect : public MGTransferBase<Vector<number>>,
177{
178public:
184
189
193 virtual ~MGTransferSelect() override = default;
194
195 // TODO: rewrite docs; make sure defaulted args are actually allowed
221 template <int dim, int spacedim>
222 void
224 unsigned int selected,
225 unsigned int mg_selected,
226 const std::vector<unsigned int> &target_component =
227 std::vector<unsigned int>(),
228 const std::vector<unsigned int> &mg_target_component =
229 std::vector<unsigned int>(),
230 const std::vector<std::set<types::global_dof_index>> &boundary_indices =
231 std::vector<std::set<types::global_dof_index>>());
232
236 void
237 select(const unsigned int component,
238 const unsigned int mg_component = numbers::invalid_unsigned_int);
239
240 virtual void
241 prolongate(const unsigned int to_level,
242 Vector<number> & dst,
243 const Vector<number> &src) const override;
244
245 virtual void
246 restrict_and_add(const unsigned int from_level,
247 Vector<number> & dst,
248 const Vector<number> &src) const override;
249
256 template <int dim, typename number2, int spacedim>
257 void
260 const Vector<number2> & src) const;
261
268 template <int dim, typename number2, int spacedim>
269 void
271 Vector<number2> & dst,
272 const MGLevelObject<Vector<number>> &src) const;
273
279 template <int dim, typename number2, int spacedim>
280 void
282 Vector<number2> & dst,
283 const MGLevelObject<Vector<number>> &src) const;
284
291 template <int dim, typename number2, int spacedim>
292 void
295 const BlockVector<number2> & src) const;
296
303 template <int dim, typename number2, int spacedim>
304 void
307 const MGLevelObject<Vector<number>> &src) const;
308
314 template <int dim, typename number2, int spacedim>
315 void
318 const MGLevelObject<Vector<number>> &src) const;
319
323 std::size_t
325
326private:
330 template <int dim, class OutVector, int spacedim>
331 void
333 OutVector & dst,
334 const MGLevelObject<Vector<number>> &src) const;
335
339 template <int dim, class OutVector, int spacedim>
340 void
342 OutVector & dst,
343 const MGLevelObject<Vector<number>> &src) const;
344
348 template <int dim, class InVector, int spacedim>
349 void
352 const InVector & src) const;
356 unsigned int selected_component;
361
367 std::vector<IndexSet> interface_dofs;
368
372public:
374};
375
378//---------------------------------------------------------------------------
379template <typename number>
380inline void
381MGTransferSelect<number>::select(const unsigned int component,
382 const unsigned int mg_component)
383{
384 selected_component = component;
385 mg_selected_component =
386 (mg_component == numbers::invalid_unsigned_int) ? component : mg_component;
387}
388
390
391#endif
std::vector< unsigned int > mg_target_component
std::vector< unsigned int > target_component
std::vector< types::global_dof_index > component_start
std::vector< std::shared_ptr< BlockSparseMatrix< double > > > prolongation_matrices
std::vector< std::vector< std::pair< types::global_dof_index, unsigned int > > > copy_to_and_from_indices
std::vector< std::vector< types::global_dof_index > > mg_component_start
std::vector< std::shared_ptr< BlockSparsityPattern > > prolongation_sparsities
void build(const DoFHandler< dim, spacedim > &dof_handler)
std::vector< std::vector< types::global_dof_index > > sizes
std::size_t memory_consumption() const
Definition multigrid.cc:149
std::vector< std::set< types::global_dof_index > > boundary_indices
void do_copy_to_mg(const DoFHandler< dim, spacedim > &mg_dof, MGLevelObject< Vector< number > > &dst, const InVector &src) const
void copy_to_mg(const DoFHandler< dim, spacedim > &mg_dof, MGLevelObject< Vector< number > > &dst, const Vector< number2 > &src) const
std::size_t memory_consumption() const
void do_copy_from_mg_add(const DoFHandler< dim, spacedim > &mg_dof, OutVector &dst, const MGLevelObject< Vector< number > > &src) const
void copy_from_mg_add(const DoFHandler< dim, spacedim > &mg_dof, BlockVector< number2 > &dst, const MGLevelObject< Vector< number > > &src) const
void do_copy_from_mg(const DoFHandler< dim, spacedim > &mg_dof, OutVector &dst, const MGLevelObject< Vector< number > > &src) const
void copy_from_mg(const DoFHandler< dim, spacedim > &mg_dof, BlockVector< number2 > &dst, const MGLevelObject< Vector< number > > &src) const
virtual void prolongate(const unsigned int to_level, Vector< number > &dst, const Vector< number > &src) const override
Definition multigrid.cc:215
SmartPointer< const AffineConstraints< double > > constraints
unsigned int mg_selected_component
unsigned int selected_component
void copy_to_mg(const DoFHandler< dim, spacedim > &mg_dof, MGLevelObject< Vector< number > > &dst, const BlockVector< number2 > &src) const
virtual ~MGTransferSelect() override=default
void build(const DoFHandler< dim, spacedim > &dof, unsigned int selected, unsigned int mg_selected, const std::vector< unsigned int > &target_component=std::vector< unsigned int >(), const std::vector< unsigned int > &mg_target_component=std::vector< unsigned int >(), const std::vector< std::set< types::global_dof_index > > &boundary_indices=std::vector< std::set< types::global_dof_index > >())
void select(const unsigned int component, const unsigned int mg_component=numbers::invalid_unsigned_int)
void copy_from_mg(const DoFHandler< dim, spacedim > &mg_dof, Vector< number2 > &dst, const MGLevelObject< Vector< number > > &src) const
virtual void restrict_and_add(const unsigned int from_level, Vector< number > &dst, const Vector< number > &src) const override
Definition multigrid.cc:232
std::vector< IndexSet > interface_dofs
void copy_from_mg_add(const DoFHandler< dim, spacedim > &mg_dof, Vector< number2 > &dst, const MGLevelObject< Vector< number > > &src) const
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:472
#define DEAL_II_CXX20_REQUIRES(condition)
Definition config.h:160
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:473
#define DeclException0(Exception0)
Definition exceptions.h:465
static ::ExceptionBase & ExcMatricesNotBuilt()
static const unsigned int invalid_unsigned_int
Definition types.h:213