faceMapper.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::faceMapper
29 
30 Description
31  This object provides mapping and fill-in information for face data
32  between the two meshes after the topological change. It is
33  constructed from mapPolyMesh.
34 
35 SourceFiles
36  faceMapper.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef Foam_faceMapper_H
41 #define Foam_faceMapper_H
42 
43 #include "morphFieldMapper.H"
44 #include "HashSet.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward Declarations
52 class mapPolyMesh;
53 
54 /*---------------------------------------------------------------------------*\
55  Class faceMapper Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class faceMapper
59 :
60  public morphFieldMapper
61 {
62  // Private Data
63 
64  //- Reference to mapPolyMesh
65  const mapPolyMesh& mpm_;
66 
67  //- The size of the mapper = polyMesh::nFaces()
68  const label mapperLen_;
69 
70  //- Number of inserted (unmapped) faces
71  label nInsertedObjects_;
72 
73  //- Is the mapping direct
74  bool direct_;
75 
76 
77  // Demand-Driven Data
78 
79  //- Direct addressing (only one for of addressing is used)
80  mutable std::unique_ptr<labelList> directAddrPtr_;
81 
82  //- Interpolated addressing (only one for of addressing is used)
83  mutable std::unique_ptr<labelListList> interpAddrPtr_;
84 
85  //- Interpolation weights
86  mutable std::unique_ptr<scalarListList> weightsPtr_;
87 
88  //- Inserted faces
89  mutable std::unique_ptr<labelList> insertedObjectsPtr_;
90 
91 
92  // Private Member Functions
93 
94  //- Calculate addressing for mapping with inserted faces
95  void calcAddressing() const;
96 
97 public:
98 
99  // Generated Methods
100 
101  //- No copy construct
102  faceMapper(const faceMapper&) = delete;
103 
104  //- No copy assignment
105  void operator=(const faceMapper&) = delete;
106 
107 
108  // Constructors
109 
110  //- Construct from mapPolyMesh
111  explicit faceMapper(const mapPolyMesh& mpm);
112 
113 
114  //- Destructor
115  virtual ~faceMapper();
116 
117 
118  // Member Functions
119 
120  //- The mapper size
121  virtual label size() const;
122 
123  //- Return size of field before mapping
124  virtual label sizeBeforeMapping() const;
125 
126  //- Return number of internal faces before mapping
127  virtual label internalSizeBeforeMapping() const;
128 
129  //- Is the mapping direct
130  virtual bool direct() const
131  {
132  return direct_;
133  }
134 
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 interpolaion weights
147  virtual const scalarListList& weights() const;
148 
149  //- Return flux flip map
150  virtual const labelHashSet& flipFaceFlux() const;
151 
152  //- Return number of old internalFaces
153  virtual label nOldInternalFaces() const;
154 
155  //- Return old patch starts
156  virtual const labelList& oldPatchStarts() const;
157 
158  //- Return old patch sizes
159  virtual const labelList& oldPatchSizes() const;
160 
161  //- Are there any inserted faces
162  virtual bool insertedObjects() const
163  {
164  return bool(nInsertedObjects_);
165  }
166 
167  //- Return list of inserted faces
168  virtual const labelList& insertedObjectLabels() const;
169 };
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace Foam
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #endif
179 
180 // ************************************************************************* //
virtual label internalSizeBeforeMapping() const
Return number of internal faces before mapping.
Definition: faceMapper.C:305
This object provides mapping and fill-in information for face data between the two meshes after the t...
Definition: faceMapper.H:53
virtual const labelList & insertedObjectLabels() const
Return list of inserted faces.
Definition: faceMapper.C:373
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
virtual label sizeBeforeMapping() const
Return size of field before mapping.
Definition: faceMapper.C:299
faceMapper(const faceMapper &)=delete
No copy construct.
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 labelListList & addressing() const
Return interpolated addressing.
Definition: faceMapper.C:337
virtual const labelHashSet & flipFaceFlux() const
Return flux flip map.
Definition: faceMapper.C:390
virtual const scalarListList & weights() const
Return interpolaion weights.
Definition: faceMapper.C:355
virtual bool direct() const
Is the mapping direct.
Definition: faceMapper.H:159
virtual ~faceMapper()
Destructor.
Definition: faceMapper.C:287
virtual label size() const
The mapper size.
Definition: faceMapper.C:293
void operator=(const faceMapper &)=delete
No copy assignment.
virtual const labelList & oldPatchStarts() const
Return old patch starts.
Definition: faceMapper.C:402
virtual label nOldInternalFaces() const
Return number of old internalFaces.
Definition: faceMapper.C:396
virtual const labelUList & directAddressing() const
Return direct addressing.
Definition: faceMapper.C:311
Namespace for OpenFOAM.
virtual const labelList & oldPatchSizes() const
Return old patch sizes.
Definition: faceMapper.C:408
virtual bool hasUnmapped() const
Any unmapped values?
Definition: faceMapper.H:164