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