Loading...
Searching...
No Matches
faMeshSubset.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) 2022 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::faMeshSubset
28
29Description
30 Holds a reference to the original mesh (the baseMesh)
31 and optionally to a subset of that mesh (the subMesh)
32 with mapping lists for points, faces, and cells.
33
34Caution
35 Currently not really functional for subsetting beyond handling
36 a simple zero-sized mesh.
37
38SourceFiles
39 faMeshSubset.cxx
40 faMeshSubset.txx
41 faMeshSubsetI.H
42
43\*---------------------------------------------------------------------------*/
44
45#ifndef Foam_faMeshSubset_H
46#define Foam_faMeshSubset_H
47
48#include "areaFaMesh.H"
49#include "edgeFaMesh.H"
50#include "GeometricField.H"
51#include "bitSet.H"
52#include "HashSet.H"
53
54// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55
56namespace Foam
57{
58
59// Forward Declarations
62/*---------------------------------------------------------------------------*\
63 Class faMeshSubset Declaration
64\*---------------------------------------------------------------------------*/
65
66class faMeshSubset
67{
68 // Private Data
69
70 //- The base mesh to subset from
71 const faMesh& baseMesh_;
72
73 //- Demand-driven subset mesh (pointer)
74 autoPtr<faMesh> subMeshPtr_;
75
76 //- Optional edge mapping array with flip encoded (-1/+1)
77 mutable autoPtr<labelList> edgeFlipMapPtr_;
78
79 //- Point mapping array
80 labelList pointMap_;
81
82 //- Face mapping array
83 labelList faceMap_;
84
85 //- Cell mapping array
86 labelList cellMap_;
87
88 //- Patch mapping array
89 labelList patchMap_;
90
91
92 // Private Member Functions
93
94 //- Calculate face flip map
95 void calcEdgeFlipMap() const;
96
97
98protected:
99
100 // Protected Member Functions
101
102 //- FatalError if subset has not been performed
103 bool checkHasSubMesh() const;
104
105
106public:
107
108 // Static Data Members
109
110 //- Name for exposed internal edges (default: oldInternalEdges)
111 static word exposedPatchName;
112
113
114 // Generated Methods
115
116 //- No copy construct
117 faMeshSubset(const faMeshSubset&) = delete;
118
119 //- No copy assignment
120 void operator=(const faMeshSubset&) = delete;
121
122
123 // Constructors
124
125 //- Construct using the entire mesh (no subset)
126 explicit faMeshSubset(const faMesh& baseMesh) noexcept;
127
128 //- Construct a zero-sized subset mesh, non-processor patches only
130
131
132 // Member Functions
133
134 // Access
135
136 //- Original mesh
137 inline const faMesh& baseMesh() const noexcept;
138
139 //- Return baseMesh or subMesh, depending on the current state.
140 inline const faMesh& mesh() const noexcept;
141
142 //- Have subMesh?
143 inline bool hasSubMesh() const noexcept;
144
145 //- Return reference to subset mesh
146 inline const faMesh& subMesh() const;
148 //- Return reference to subset mesh
149 inline faMesh& subMesh();
150
151 //- Return point map
152 inline const labelList& pointMap() const;
153
154 //- Return face map
155 inline const labelList& faceMap() const;
156
157 //- Return edge map with sign to encode flipped edges
158 inline const labelList& edgeFlipMap() const;
159
160 //- Return cell map
161 inline const labelList& cellMap() const;
162
163 //- Return patch map
164 inline const labelList& patchMap() const;
165
166
167 // Edit
168
169 //- Reset subMesh and all maps
170 void clear();
171
172 //- Reset subMesh and all maps. Same as clear()
173 void reset();
174
175 //- Reset to a zero-sized subset mesh, non-processor patches only
176 void reset(Foam::zero);
177
178
179 // Field Mapping (static functions)
180
181 //- Map area field.
182 // Optionally allow unmapped faces not to produce a warning
183 template<class Type>
186 (
187 const GeometricField<Type, faPatchField, areaMesh>&,
188 const faMesh& sMesh,
189 const bool allowUnmapped = false
190 );
191
192 //- Map edge field.
193 // Optionally allow unmapped faces not to produce a warning
194 template<class Type>
197 (
199 const faMesh& sMesh
200 );
201
202
203 // Field Mapping
204
205 //- Map area field.
206 // Optionally allow unmapped faces not to produce a warning
207 template<class Type>
210 (
211 const GeometricField<Type, faPatchField, areaMesh>&,
212 const bool allowUnmapped = false
213 ) const;
214
215 //- Map edge field.
216 template<class Type>
219 (
221 const bool allowUnmapped = false
222 ) const;
223};
224
226// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227
228} // End namespace Foam
229
230// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231
232#include "faMeshSubsetI.H"
233
234// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235
236#ifdef NoRepository
237 #include "faMeshSubset.txx"
238#endif
239
240// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241
242#endif
243
244// ************************************************************************* //
Generic GeometricField class.
Mesh data needed to do the Finite Area discretisation.
Definition areaFaMesh.H:50
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
Mesh data needed to do the Finite Area discretisation.
Definition edgeFaMesh.H:50
faMeshSubset(const faMeshSubset &)=delete
No copy construct.
static word exposedPatchName
Name for exposed internal edges (default: oldInternalEdges).
const labelList & faceMap() const
Return face map.
void operator=(const faMeshSubset &)=delete
No copy assignment.
faMeshSubset(const faMesh &baseMesh, Foam::zero)
Construct a zero-sized subset mesh, non-processor patches only.
const labelList & cellMap() const
Return cell map.
const faMesh & mesh() const noexcept
Return baseMesh or subMesh, depending on the current state.
bool checkHasSubMesh() const
FatalError if subset has not been performed.
const faMesh & subMesh() const
Return reference to subset mesh.
const labelList & patchMap() const
Return patch map.
const labelList & pointMap() const
Return point map.
faMeshSubset(const faMesh &baseMesh) noexcept
Construct using the entire mesh (no subset).
void clear()
Reset subMesh and all maps.
bool hasSubMesh() const noexcept
Have subMesh?
void reset()
Reset subMesh and all maps. Same as clear().
static tmp< GeometricField< Type, faPatchField, areaMesh > > interpolate(const GeometricField< Type, faPatchField, areaMesh > &, const faMesh &sMesh, const bool allowUnmapped=false)
Map area field.
const labelList & edgeFlipMap() const
Return edge map with sign to encode flipped edges.
const faMesh & baseMesh() const noexcept
Original mesh.
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition faMesh.H:140
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
faePatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cove...
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition zero.H:58
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
const direction noexcept
Definition scalarImpl.H:265