MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
transfermap.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2024, Lawrence Livermore National Security, LLC. Produced
2// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3// LICENSE and NOTICE for details. LLNL-CODE-806117.
4//
5// This file is part of the MFEM library. For more information and source code
6// availability visit https://mfem.org.
7//
8// MFEM is free software; you can redistribute it and/or modify it under the
9// terms of the BSD-3 license. We welcome feedback and contributions, see file
10// CONTRIBUTING.md for details.
11
12#ifndef MFEM_TRANSFERMAP
13#define MFEM_TRANSFERMAP
14
16#include "transfer_category.hpp"
17#include <memory>
18
19namespace mfem
20{
21
22/**
23 * @brief TransferMap represents a mapping of degrees of freedom from a source
24 * GridFunction to a destination GridFunction.
25 *
26 * This map can be constructed from a parent Mesh to a SubMesh or vice versa.
27 * Additionally one can create it between two SubMeshes that share the same root
28 * parent. In this case, a supplemental FiniteElementSpace is created on the
29 * root parent Mesh to transfer degrees of freedom.
30 */
32{
33public:
34 /**
35 * @brief Construct a new TransferMap object which transfers degrees of
36 * freedom from the source GridFunction to the destination GridFunction.
37 *
38 * @param src The source GridFunction
39 * @param dst The destination GridFunction
40 */
41 TransferMap(const GridFunction &src,
42 const GridFunction &dst);
43
44 /**
45 * @brief Transfer the source GridFunction to the destination GridFunction.
46 *
47 * Uses the precomputed maps for the transfer.
48 *
49 * @param src The source GridFunction
50 * @param dst The destination GridFunction
51 */
52 void Transfer(const GridFunction &src, GridFunction &dst) const;
53
54private:
55
56 static void CorrectFaceOrientations(const FiniteElementSpace &fes,
57 const Vector &src,
58 Vector &dst,
59 const Array<int> *s2p_map = NULL);
60
61 TransferCategory category_;
62
63 /// Mapping of the GridFunction defined on the SubMesh to the GridFunction
64 /// of its parent Mesh.
65 Array<int> sub1_to_parent_map_;
66
67 /// Mapping of the GridFunction defined on the second SubMesh to the
68 /// GridFunction of its parent Mesh. This is only used if this TransferMap
69 /// represents a SubMesh to SubMesh transfer.
70 Array<int> sub2_to_parent_map_;
71
72 /// Pointer to the supplemental FiniteElementSpace on the common root parent
73 /// Mesh. This is only used if this TransferMap represents a SubMesh to
74 /// SubMesh transfer.
75 std::unique_ptr<const FiniteElementSpace> root_fes_;
76
77 /// Pointer to the supplemental FiniteElementCollection used with root_fes_.
78 /// This is only used if this TransferMap represents a SubMesh to
79 /// SubMesh transfer where the root requires a different type of collection
80 /// than the SubMesh objects. For example, when the subpaces are L2 on
81 /// boundaries of the parent mesh and the root space can be RT.
82 std::unique_ptr<const FiniteElementCollection> root_fec_;
83
84 /// Temporary vector
85 mutable Vector z_;
86};
87
88} // namespace mfem
89
90#endif // MFEM_TRANSFERMAP
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition fespace.hpp:220
Class for grid function - Vector with associated FE space.
Definition gridfunc.hpp:31
TransferMap represents a mapping of degrees of freedom from a source GridFunction to a destination Gr...
void Transfer(const GridFunction &src, GridFunction &dst) const
Transfer the source GridFunction to the destination GridFunction.
TransferMap(const GridFunction &src, const GridFunction &dst)
Construct a new TransferMap object which transfers degrees of freedom from the source GridFunction to...
Vector data type.
Definition vector.hpp:80
TransferCategory
TransferCategory describes the type of transfer.