MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
ptransfermap.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_PTRANSFERMAP
13#define MFEM_PTRANSFERMAP
14
16#include "transfer_category.hpp"
17#include <memory>
18
19namespace mfem
20{
21
22/**
23 * @brief ParTransferMap represents a mapping of degrees of freedom from a
24 * source ParGridFunction to a destination ParGridFunction.
25 *
26 * This map can be constructed from a parent ParMesh to a ParSubMesh or vice
27 * versa. Additionally one can create it between two ParSubMeshes that share the
28 * same root parent. In this case, a supplemental ParFiniteElementSpace is
29 * created on the root parent ParMesh to transfer degrees of freedom.
30 */
32{
33public:
34 /**
35 * @brief Construct a new ParTransferMap object which transfers degrees of
36 * freedom from the source ParGridFunction to the destination
37 * ParGridFunction.
38 *
39 * @param src The source ParGridFunction
40 * @param dst The destination ParGridFunction
41 */
43 const ParGridFunction &dst);
44
45 /**
46 * @brief Transfer the source ParGridFunction to the destination
47 * ParGridFunction.
48 *
49 * Uses the precomputed maps for the transfer.
50 *
51 * @param src The source ParGridFunction
52 * @param dst The destination ParGridFunction
53 */
54 void Transfer(const ParGridFunction &src, ParGridFunction &dst) const;
55
56private:
57 /**
58 * @brief Communicate from each local processor which index in map is set.
59 *
60 * The result is accumulated in the member variable indices_set_global_ and
61 * indicates which and how many processors in total will set a certain degree
62 * of freedom.
63 *
64 * Convenience method for tidyness. Uses and changes member variables.
65 */
66 void CommunicateIndicesSet(Array<int> &map, int dst_sz);
67
68 /**
69 * @brief Communicate shared vdofs in Vector f.
70 *
71 * Guarantees that all ranks have the appropriate dofs set. See comments in
72 * implementation for more details.
73 *
74 * Convenience method for tidyness. Uses and changes member variables.
75 */
76 void CommunicateSharedVdofs(Vector &f) const;
77
78 static void CorrectFaceOrientations(const ParFiniteElementSpace &fes,
79 const Vector &src,
80 Vector &dst,
81 const Array<int> *s2p_map = NULL);
82
83 TransferCategory category_;
84
85 /// Mapping of the ParGridFunction defined on the SubMesh to the
86 /// ParGridFunction of its parent ParMesh.
87 Array<int> sub1_to_parent_map_;
88
89 /// Mapping of the ParGridFunction defined on the second SubMesh to the
90 /// ParGridFunction of its parent ParMesh. This is only used if this
91 /// ParTransferMap represents a ParSubMesh to ParSubMesh transfer.
92 Array<int> sub2_to_parent_map_;
93
94 /// Set of indices in the dof map that are set by the local rank.
95 Array<int> indices_set_local_;
96
97 /// Set of indices in the dof map that are set by all ranks. The number is
98 /// accumulated by summation.
99 Array<int> indices_set_global_;
100
101 /// Pointer to the supplemental ParFiniteElementSpace on the common root
102 /// parent ParMesh. This is only used if this ParTransferMap represents a
103 /// ParSubMesh to ParSubMesh transfer.
104 std::unique_ptr<const ParFiniteElementSpace> root_fes_;
105
106 /// Pointer to the supplemental FiniteElementCollection used with root_fes_.
107 /// This is only used if this TransferMap represents a SubMesh to
108 /// SubMesh transfer where the root requires a different type of collection
109 /// than the SubMesh objects. For example, when the subpaces are L2 on
110 /// boundaries of the parent mesh and the root space can be RT.
111 std::unique_ptr<const FiniteElementCollection> root_fec_;
112
113 const GroupCommunicator *root_gc_ = nullptr;
114
115 /// Temporary vector
116 mutable Vector z_;
117};
118
119} // namespace mfem
120
121#endif // MFEM_PTRANSFERMAP
Communicator performing operations within groups defined by a GroupTopology with arbitrary-size data ...
Abstract parallel finite element space.
Definition pfespace.hpp:29
Class for parallel grid function.
Definition pgridfunc.hpp:33
ParTransferMap represents a mapping of degrees of freedom from a source ParGridFunction to a destinat...
void Transfer(const ParGridFunction &src, ParGridFunction &dst) const
Transfer the source ParGridFunction to the destination ParGridFunction.
ParTransferMap(const ParGridFunction &src, const ParGridFunction &dst)
Construct a new ParTransferMap object which transfers degrees of freedom from the source ParGridFunct...
Vector data type.
Definition vector.hpp:80
TransferCategory
TransferCategory describes the type of transfer.
std::function< real_t(const Vector &)> f(real_t mass_coeff)
Definition lor_mms.hpp:30