fvSurfaceMapper.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 -------------------------------------------------------------------------------
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::fvSurfaceMapper
28 
29 Description
30  FV surface mapper.
31 
32 SourceFiles
33  fvSurfaceMapper.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef fvSurfaceMapper_H
38 #define fvSurfaceMapper_H
39 
40 #include "morphFieldMapper.H"
41 #include "fvMesh.H"
42 #include "faceMapper.H"
43 #include "HashSet.H"
44 #include "mapPolyMesh.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward declaration of classes
52 
53 /*---------------------------------------------------------------------------*\
54  Class fvSurfaceMapper Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class fvSurfaceMapper
58 :
59  public morphFieldMapper
60 {
61  // Private data
62 
63  //- Reference to mesh
64  const fvMesh& mesh_;
65 
66  //- Reference to face mapper
67  const faceMapper& faceMap_;
68 
69 
70  // Demand-driven private data
71 
72  //- Direct addressing (only one for of addressing is used)
73  mutable labelList* directAddrPtr_;
74 
75  //- Interpolated addressing (only one for of addressing is used)
76  mutable labelListList* interpolationAddrPtr_;
77 
78  //- Interpolation weights
79  mutable scalarListList* weightsPtr_;
80 
81  //- Inserted faces
82  mutable labelList* insertedObjectLabelsPtr_;
83 
84 
85 
86  // Private Member Functions
87 
88  //- No copy construct
89  fvSurfaceMapper(const fvSurfaceMapper&) = delete;
90 
91  //- No copy assignment
92  void operator=(const fvSurfaceMapper&) = delete;
93 
94 
95  //- Calculate addressing
96  void calcAddressing() const;
97 
98  //- Clear out local storage
99  void clearOut();
100 
101 
102 public:
103 
104  // Constructors
105 
106  //- Construct from components
108  (
109  const fvMesh& mesh,
110  const faceMapper& fMapper
111  );
112 
113 
114  //- Destructor
115  virtual ~fvSurfaceMapper();
116 
117 
118  // Member Functions
119 
120  //- Return size
121  virtual label size() const
122  {
123  return mesh_.nInternalFaces();
124  }
125 
126  //- Return size of field before mapping
127  virtual label sizeBeforeMapping() const
128  {
129  return faceMap_.internalSizeBeforeMapping();
130  }
131 
132  //- Is the mapping direct
133  virtual bool direct() const
134  {
135  return faceMap_.direct();
136  }
137 
138  //- Has unmapped elements
139  virtual bool hasUnmapped() const
140  {
141  return insertedObjects();
142  }
143 
144  //- Return direct addressing
145  virtual const labelUList& directAddressing() const;
146 
147  //- Return interpolated addressing
148  virtual const labelListList& addressing() const;
149 
150  //- Return interpolation weights
151  virtual const scalarListList& weights() const;
152 
153  //- Are there any inserted faces
154  virtual bool insertedObjects() const
155  {
156  return faceMap_.insertedObjects();
157  }
158 
159  //- Return list of inserted faces
160  virtual const labelList& insertedObjectLabels() const;
161 
162  //- Return flux flip map
163  const labelHashSet& flipFaceFlux() const
164  {
165  return faceMap_.flipFaceFlux();
166  }
167 };
168 
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 } // End namespace Foam
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #endif
177 
178 // ************************************************************************* //
Foam::faceMapper::insertedObjects
virtual bool insertedObjects() const
Are there any inserted faces.
Definition: faceMapper.H:165
morphFieldMapper.H
Foam::morphFieldMapper
Abstract base class to hold the Field mapping for mesh morphs.
Definition: morphFieldMapper.H:49
mapPolyMesh.H
Foam::fvSurfaceMapper::hasUnmapped
virtual bool hasUnmapped() const
Has unmapped elements.
Definition: fvSurfaceMapper.H:138
Foam::faceMapper::internalSizeBeforeMapping
virtual label internalSizeBeforeMapping() const
Return number of internal faces before mapping.
Definition: faceMapper.C:297
Foam::fvSurfaceMapper::addressing
virtual const labelListList & addressing() const
Return interpolated addressing.
Definition: fvSurfaceMapper.C:191
Foam::HashSet< label, Hash< label > >
Foam::fvSurfaceMapper::directAddressing
virtual const labelUList & directAddressing() const
Return direct addressing.
Definition: fvSurfaceMapper.C:173
Foam::fvSurfaceMapper::size
virtual label size() const
Return size.
Definition: fvSurfaceMapper.H:120
Foam::fvSurfaceMapper::direct
virtual bool direct() const
Is the mapping direct.
Definition: fvSurfaceMapper.H:132
Foam::fvSurfaceMapper::~fvSurfaceMapper
virtual ~fvSurfaceMapper()
Destructor.
Definition: fvSurfaceMapper.C:165
faceMapper.H
HashSet.H
Foam::faceMapper
This object provides mapping and fill-in information for face data between the two meshes after the t...
Definition: faceMapper.H:57
Foam::faceMapper::direct
virtual bool direct() const
Is the mapping direct.
Definition: faceMapper.H:133
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::faceMapper::flipFaceFlux
virtual const labelHashSet & flipFaceFlux() const
Return flux flip map.
Definition: faceMapper.C:384
Foam::fvSurfaceMapper::flipFaceFlux
const labelHashSet & flipFaceFlux() const
Return flux flip map.
Definition: fvSurfaceMapper.H:162
Foam::primitiveMesh::nInternalFaces
label nInternalFaces() const noexcept
Number of internal faces.
Definition: primitiveMeshI.H:78
Foam::List< label >
Foam::UList< label >
Foam::fvSurfaceMapper::insertedObjectLabels
virtual const labelList & insertedObjectLabels() const
Return list of inserted faces.
Definition: fvSurfaceMapper.C:227
Foam::fvSurfaceMapper::insertedObjects
virtual bool insertedObjects() const
Are there any inserted faces.
Definition: fvSurfaceMapper.H:153
Foam::fvSurfaceMapper::sizeBeforeMapping
virtual label sizeBeforeMapping() const
Return size of field before mapping.
Definition: fvSurfaceMapper.H:126
Foam::fvSurfaceMapper
FV surface mapper.
Definition: fvSurfaceMapper.H:56
Foam::fvSurfaceMapper::weights
virtual const scalarListList & weights() const
Return interpolation weights.
Definition: fvSurfaceMapper.C:209