faAreaMapper.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) 2016-2017 Wikki 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::faAreaMapper
28
29Description
30 FA area mapper.
31
32Author
33 Zeljko Tukovic, FMENA
34 Hrvoje Jasak, Wikki Ltd.
35
36SourceFiles
37 faAreaMapper.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef faAreaMapper_H
42#define faAreaMapper_H
43
44#include "morphFieldMapper.H"
45#include "faMesh.H"
46#include "faceMapper.H"
47#include "HashSet.H"
48#include "mapPolyMesh.H"
49
50// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51
52namespace Foam
53{
54
55/*---------------------------------------------------------------------------*\
56 Class faAreaMapper Declaration
57\*---------------------------------------------------------------------------*/
59class faAreaMapper
60:
61 public morphFieldMapper
62{
63 // Private data
64
65 //- Reference to mesh mapper
66 const faMesh& mesh_;
67
68 //- Reference to mapPolyMesh
69 const mapPolyMesh& mpm_;
70
71 //- Is the mapping direct
72 bool direct_;
73
74
75 // Demand-driven private data
76
77 mutable bool hasUnmapped_;
78
79 //- Old mesh size
80 label sizeBeforeMapping_;
81
82 //- New face labels after mapping
83 mutable labelList* newFaceLabelsPtr_;
84
85 //- New face labels after mapping
86 mutable labelList* newFaceLabelsMapPtr_;
87
88
89 //- Direct addressing (only one form of addressing is used)
90 mutable labelList* directAddrPtr_;
91
92 //- Interpolated addressing (only one form of addressing is used)
93 mutable labelListList* interpolationAddrPtr_;
94
95 //- Interpolation weights
96 mutable scalarListList* weightsPtr_;
97
98 //- Inserted faces
99 mutable labelList* insertedObjectLabelsPtr_;
100
101
102 // Private Member Functions
103
104 //- No copy construct
105 faAreaMapper(const faAreaMapper&) = delete;
106
107 //- No copy assignment
108 void operator=(const faAreaMapper&) = delete;
109
110 //- Calculate addressing
111 void calcAddressing() const;
112
113 //- Clear out local storage
114 void clearOut();
115
116
117public:
118
119 //- Construct from components
121 (
122 const faMesh& mesh,
123 const mapPolyMesh& mpm
124 );
125
126
127 //- Destructor
128 virtual ~faAreaMapper();
129
130
131 // Member Functions
132
133 //- Return new face labels
134 const labelList& newFaceLabels() const;
135
136 //- Return new face labels map
137 // For new faces return old face index if it exists
138 // If the face has been added, index will be -1
139 const labelList& newFaceLabelsMap() const;
140
141 //- Return size
142 virtual label size() const
143 {
144 return newFaceLabels().size();
145 }
146
147 //- Return size of field before mapping
148 virtual label sizeBeforeMapping() const
149 {
150 return sizeBeforeMapping_;
151 }
152
153 //- Is the mapping direct
154 virtual bool direct() const
155 {
156 return direct_;
157 }
159 virtual bool hasUnmapped() const
160 {
161 return hasUnmapped_;
162 }
163
164 //- Return direct addressing
165 virtual const labelUList& directAddressing() const;
166
167 //- Return interpolated addressing
168 virtual const labelListList& addressing() const;
169
170 //- Return interpolation weights
171 virtual const scalarListList& weights() const;
172
173 //- Are there any inserted faces
174 virtual bool insertedObjects() const
175 {
176 return !insertedObjectLabels().empty();
177 }
178
179 //- Return list of inserted faces
180 virtual const labelList& insertedObjectLabels() const;
181};
182
183
184// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185
186} // End namespace Foam
187
188// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189
190#endif
191
192// ************************************************************************* //
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
Definition: UListI.H:427
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
FA area mapper.
Definition: faAreaMapper.H:61
virtual label size() const
Return size.
Definition: faAreaMapper.H:141
virtual label sizeBeforeMapping() const
Return size of field before mapping.
Definition: faAreaMapper.H:147
virtual const labelListList & addressing() const
Return interpolated addressing.
Definition: faAreaMapper.C:366
virtual const scalarListList & weights() const
Return interpolation weights.
Definition: faAreaMapper.C:384
virtual bool hasUnmapped() const
Any unmapped values?
Definition: faAreaMapper.H:158
virtual const labelUList & directAddressing() const
Return direct addressing.
Definition: faAreaMapper.C:348
virtual const labelList & insertedObjectLabels() const
Return list of inserted faces.
Definition: faAreaMapper.C:402
const labelList & newFaceLabelsMap() const
Return new face labels map.
Definition: faAreaMapper.C:337
virtual bool insertedObjects() const
Are there any inserted faces.
Definition: faAreaMapper.H:173
virtual ~faAreaMapper()
Destructor.
Definition: faAreaMapper.C:318
const labelList & newFaceLabels() const
Return new face labels.
Definition: faAreaMapper.C:326
virtual bool direct() const
Is the mapping direct.
Definition: faAreaMapper.H:153
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:100
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:162
Abstract base class to hold the Field mapping for mesh morphs.
dynamicFvMesh & mesh
Namespace for OpenFOAM.