fvSurfaceMapper.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2013 OpenFOAM Foundation
9  Copyright (C) 2024 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::fvSurfaceMapper
29 
30 Description
31  A finiteVolume surface mapper.
32 
33 SourceFiles
34  fvSurfaceMapper.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef Foam_fvSurfaceMapper_H
39 #define Foam_fvSurfaceMapper_H
40 
41 #include "morphFieldMapper.H"
42 #include "fvMesh.H"
43 #include "faceMapper.H"
44 #include "HashSet.H"
45 #include "mapPolyMesh.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class fvSurfaceMapper Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 class fvSurfaceMapper
57 :
58  public morphFieldMapper
59 {
60  // Private Data
61 
62  //- Reference to mesh
63  const fvMesh& mesh_;
64 
65  //- Reference to face mapper
66  const faceMapper& faceMap_;
67 
68 
69  // Demand-Driven Data
70 
71  //- Direct addressing (only one for of addressing is used)
72  mutable std::unique_ptr<labelList> directAddrPtr_;
73 
74  //- Interpolated addressing (only one for of addressing is used)
75  mutable std::unique_ptr<labelListList> interpAddrPtr_;
76 
77  //- Interpolation weights
78  mutable std::unique_ptr<scalarListList> weightsPtr_;
79 
80  //- Inserted faces
81  mutable std::unique_ptr<labelList> insertedObjectsPtr_;
82 
83 
84 
85  // Private Member Functions
86 
87  //- No copy construct
88  fvSurfaceMapper(const fvSurfaceMapper&) = delete;
89 
90  //- No copy assignment
91  void operator=(const fvSurfaceMapper&) = delete;
92 
93 
94  //- Calculate addressing
95  void calcAddressing() const;
96 
97 
98 public:
99 
100  // Constructors
101 
102  //- Construct from components
104  (
105  const fvMesh& mesh,
106  const faceMapper& mapper
107  );
108 
109 
110  //- Destructor
111  virtual ~fvSurfaceMapper();
112 
113 
114  // Member Functions
115 
116  //- Return size
117  virtual label size() const
118  {
119  return mesh_.nInternalFaces();
120  }
121 
122  //- Return size of field before mapping
123  virtual label sizeBeforeMapping() const
124  {
125  return faceMap_.internalSizeBeforeMapping();
126  }
127 
128  //- Is the mapping direct
129  virtual bool direct() const
130  {
131  return faceMap_.direct();
132  }
133 
134  //- Has unmapped elements
135  virtual bool hasUnmapped() const
136  {
137  return insertedObjects();
138  }
139 
140  //- Return direct addressing
141  virtual const labelUList& directAddressing() const;
142 
143  //- Return interpolated addressing
144  virtual const labelListList& addressing() const;
145 
146  //- Return interpolation weights
147  virtual const scalarListList& weights() const;
148 
149  //- Are there any inserted faces
150  virtual bool insertedObjects() const
151  {
152  return faceMap_.insertedObjects();
153  }
154 
155  //- Return list of inserted faces
156  virtual const labelList& insertedObjectLabels() const;
157 
158  //- Return flux flip map
159  const labelHashSet& flipFaceFlux() const
160  {
161  return faceMap_.flipFaceFlux();
162  }
163 };
164 
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 } // End namespace Foam
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #endif
173 
174 // ************************************************************************* //
virtual label internalSizeBeforeMapping() const
Return number of internal faces before mapping.
Definition: faceMapper.C:305
virtual bool insertedObjects() const
Are there any inserted faces.
This object provides mapping and fill-in information for face data between the two meshes after the t...
Definition: faceMapper.H:53
virtual bool direct() const
Is the mapping direct.
A finiteVolume surface mapper.
virtual label size() const
Return size.
virtual bool hasUnmapped() const
Has unmapped elements.
virtual ~fvSurfaceMapper()
Destructor.
dynamicFvMesh & mesh
Abstract base class to hold the Field mapping for mesh morphs.
virtual bool insertedObjects() const
Are there any inserted faces.
Definition: faceMapper.H:207
virtual const labelUList & directAddressing() const
Return direct addressing.
virtual const labelHashSet & flipFaceFlux() const
Return flux flip map.
Definition: faceMapper.C:390
label nInternalFaces() const noexcept
Number of internal faces.
virtual const labelList & insertedObjectLabels() const
Return list of inserted faces.
virtual bool direct() const
Is the mapping direct.
Definition: faceMapper.H:159
virtual label sizeBeforeMapping() const
Return size of field before mapping.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
virtual const scalarListList & weights() const
Return interpolation weights.
const labelHashSet & flipFaceFlux() const
Return flux flip map.
virtual const labelListList & addressing() const
Return interpolated addressing.
Namespace for OpenFOAM.