MFEM  v4.5.1
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
transfermap.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2022, 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 
15 #include "../../fem/gridfunc.hpp"
16 #include "transfer_category.hpp"
17 
18 namespace mfem
19 {
20 
21 /**
22  * @brief TransferMap represents a mapping of degrees of freedom from a source
23  * GridFunction to a destination GridFunction.
24  *
25  * This map can be constructed from a parent Mesh to a SubMesh or vice versa.
26  * Additionally one can create it between two SubMeshes that share the same root
27  * parent. In this case, a supplemental FiniteElementSpace is created on the
28  * root parent Mesh to transfer degrees of freedom.
29  */
31 {
32 public:
33  /**
34  * @brief Construct a new TransferMap object which transfers degrees of
35  * freedom from the source GridFunction to the destination GridFunction.
36  *
37  * @param src The source GridFunction
38  * @param dst The destination Gridfunction
39  */
40  TransferMap(const GridFunction &src,
41  const GridFunction &dst);
42 
43  /**
44  * @brief Transfer the source GridFunction to the destination GridFunction.
45  *
46  * Uses the precomputed maps for the transfer.
47  *
48  * @param src The source GridFunction
49  * @param dst The destination Gridfunction
50  */
51  void Transfer(const GridFunction &src, GridFunction &dst) const;
52 
53  ~TransferMap();
54 
55 private:
56  TransferCategory category_;
57 
58  /// Mapping of the GridFunction defined on the SubMesh to the Gridfunction
59  /// of its parent Mesh.
60  Array<int> sub1_to_parent_map_;
61 
62  /// Mapping of the GridFunction defined on the second SubMesh to the
63  /// GridFunction of its parent Mesh. This is only used if this TransferMap
64  /// represents a SubMesh to SubMesh transfer.
65  Array<int> sub2_to_parent_map_;
66 
67  /// Pointer to the supplemental FiniteElementSpace on the common root parent
68  /// Mesh. This is only used if this TransferMap represents a SubMesh to
69  /// SubMesh transfer.
70  const FiniteElementSpace *root_fes_ = nullptr;
71 
72  /// Temporary vector
73  mutable Vector z_;
74 };
75 
76 } // namespace mfem
77 
78 #endif // MFEM_TRANSFERMAP
Class for grid function - Vector with associated FE space.
Definition: gridfunc.hpp:30
TransferCategory
TransferCategory describes the type of transfer.
void Transfer(const GridFunction &src, GridFunction &dst) const
Transfer the source GridFunction to the destination GridFunction.
Definition: transfermap.cpp:90
TransferMap represents a mapping of degrees of freedom from a source GridFunction to a destination Gr...
Definition: transfermap.hpp:30
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition: fespace.hpp:96
Vector data type.
Definition: vector.hpp:60
TransferMap(const GridFunction &src, const GridFunction &dst)
Construct a new TransferMap object which transfers degrees of freedom from the source GridFunction to...
Definition: transfermap.cpp:18