fvPatchMapper.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::fvPatchMapper
29 
30 Description
31  Mapping class for a fvPatchField.
32 
33 SourceFiles
34  fvPatchMapper.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef Foam_fvPatchMapper_H
39 #define Foam_fvPatchMapper_H
40 
41 #include "fvPatchFieldMapper.H"
42 #include "faceMapper.H"
43 #include "fvPatch.H"
44 #include "primitiveFields.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward Declarations
52 class fvPatch;
53 class mapPolyMesh;
54 
55 /*---------------------------------------------------------------------------*\
56  Class fvPatchMapper Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class fvPatchMapper
60 :
61  public fvPatchFieldMapper
62 {
63  // Private data
64 
65  //- Reference to patch
66  const fvPatch& patch_;
67 
68  //- Reference to face mapper
69  const faceMapper& faceMap_;
70 
71  //- Size before mapping
72  const label sizeBeforeMapping_;
73 
74 
75  // Demand-Driven Data
76 
77  mutable bool hasUnmapped_;
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 
89  // Private Member Functions
90 
91  //- No copy construct
92  fvPatchMapper(const fvPatchMapper&) = delete;
93 
94  //- No copy assignment
95  void operator=(const fvPatchMapper&) = delete;
96 
97 
98  //- Calculate addressing for mapping with inserted cells
99  void calcAddressing() const;
100 
101 
102 public:
103 
104  // Constructors
105 
106  //- Construct from mappers
108  (
109  const fvPatch& patch,
110  const faceMapper& faceMap
111  );
112 
113 
114  //- Destructor
115  virtual ~fvPatchMapper();
116 
117 
118  // Member Functions
119 
120  //- Return size
121  virtual label size() const
122  {
123  return patch_.size();
124  }
125 
126  //- Return size of field before mapping
127  virtual label sizeBeforeMapping() const
128  {
129  return sizeBeforeMapping_;
130  }
131 
132  //- Is the mapping direct
133  virtual bool direct() const
134  {
135  return faceMap_.direct();
136  }
137 
138  virtual bool hasUnmapped() const
139  {
140  return hasUnmapped_;
141  }
142 
143  //- Return direct addressing
144  virtual const labelUList& directAddressing() const;
145 
146  //- Return interpolated addressing
147  virtual const labelListList& addressing() const;
149  //- Return interpolation weights
150  virtual const scalarListList& weights() const;
151 };
152 
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 } // End namespace Foam
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 #endif
162 // ************************************************************************* //
virtual label sizeBeforeMapping() const
Return size of field before mapping.
This object provides mapping and fill-in information for face data between the two meshes after the t...
Definition: faceMapper.H:53
virtual bool hasUnmapped() const
Any unmapped values?
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
virtual ~fvPatchMapper()
Destructor.
virtual bool direct() const
Is the mapping direct.
virtual const labelUList & directAddressing() const
Return direct addressing.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
virtual label size() const
Return size.
virtual const labelListList & addressing() const
Return interpolated addressing.
A FieldMapper for finite-volume patch fields.
virtual label size() const
Patch size is the number of faces, but can be overloaded.
Definition: fvPatch.H:234
virtual bool direct() const
Is the mapping direct.
Definition: faceMapper.H:159
Specialisations of Field<T> for scalar, vector and tensor.
virtual const scalarListList & weights() const
Return interpolation weights.
const std::string patch
OpenFOAM patch number as a std::string.
Mapping class for a fvPatchField.
Definition: fvPatchMapper.H:54
Namespace for OpenFOAM.