faceMapper.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::faceMapper
28 
29 Description
30  This object provides mapping and fill-in information for face data
31  between the two meshes after the topological change. It is
32  constructed from mapPolyMesh.
33 
34 SourceFiles
35  faceMapper.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef faceMapper_H
40 #define faceMapper_H
41 
42 #include "morphFieldMapper.H"
43 #include "HashSet.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Forward declaration of classes
51 class polyMesh;
52 class mapPolyMesh;
53 
54 /*---------------------------------------------------------------------------*\
55  Class faceMapper Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class faceMapper
59 :
60  public morphFieldMapper
61 {
62  // Private data
63 
64  //- Reference to polyMesh
65  const polyMesh& mesh_;
66 
67  //- Reference to mapPolyMesh
68  const mapPolyMesh& mpm_;
69 
70  //- Are there any inserted (unmapped) faces
71  bool insertedFaces_;
72 
73  //- Is the mapping direct
74  bool direct_;
75 
76 
77  // Demand-driven private data
78 
79  //- Direct addressing (only one for of addressing is used)
80  mutable labelList* directAddrPtr_;
81 
82  //- Interpolated addressing (only one for of addressing is used)
83  mutable labelListList* interpolationAddrPtr_;
84 
85  //- Interpolation weights
86  mutable scalarListList* weightsPtr_;
87 
88  //- Inserted faces
89  mutable labelList* insertedFaceLabelsPtr_;
90 
91 
92  // Private Member Functions
93 
94  //- No copy construct
95  faceMapper(const faceMapper&) = delete;
96 
97  //- No copy assignment
98  void operator=(const faceMapper&) = delete;
99 
100 
101  //- Calculate addressing for mapping with inserted faces
102  void calcAddressing() const;
103 
104  //- Clear out local storage
105  void clearOut();
106 
107 
108 public:
109 
110  // Static data members
111 
112  // Constructors
113 
114  //- Construct from mapPolyMesh
115  faceMapper(const mapPolyMesh& mpm);
116 
117 
118  //- Destructor
119  virtual ~faceMapper();
120 
121 
122  // Member Functions
123 
124  //- Return size
125  virtual label size() const;
126 
127  //- Return size of field before mapping
128  virtual label sizeBeforeMapping() const;
129 
130  //- Return number of internal faces before mapping
131  virtual label internalSizeBeforeMapping() const;
132 
133  //- Is the mapping direct
134  virtual bool direct() const
135  {
136  return direct_;
137  }
138 
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 interpolaion weights
151  virtual const scalarListList& weights() const;
152 
153  //- Return flux flip map
154  virtual const labelHashSet& flipFaceFlux() const;
155 
156  //- Return number of old internalFaces
157  virtual label nOldInternalFaces() const;
158 
159  //- Return old patch starts
160  virtual const labelList& oldPatchStarts() const;
161 
162  //- Return old patch sizes
163  virtual const labelList& oldPatchSizes() const;
164 
165  //- Are there any inserted faces
166  virtual bool insertedObjects() const
167  {
168  return insertedFaces_;
169  }
170 
171  //- Return list of inserted faces
172  virtual const labelList& insertedObjectLabels() const;
173 };
174 
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 } // End namespace Foam
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 #endif
183 
184 // ************************************************************************* //
Foam::faceMapper::directAddressing
virtual const labelUList & directAddressing() const
Return direct addressing.
Definition: faceMapper.C:303
Foam::faceMapper::oldPatchSizes
virtual const labelList & oldPatchSizes() const
Return old patch sizes.
Definition: faceMapper.C:402
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
Foam::faceMapper::size
virtual label size() const
Return size.
Definition: faceMapper.C:285
Foam::faceMapper::oldPatchStarts
virtual const labelList & oldPatchStarts() const
Return old patch starts.
Definition: faceMapper.C:396
Foam::faceMapper::internalSizeBeforeMapping
virtual label internalSizeBeforeMapping() const
Return number of internal faces before mapping.
Definition: faceMapper.C:297
Foam::faceMapper::sizeBeforeMapping
virtual label sizeBeforeMapping() const
Return size of field before mapping.
Definition: faceMapper.C:291
Foam::HashSet< label, Hash< label > >
Foam::faceMapper::hasUnmapped
virtual bool hasUnmapped() const
Are there unmapped values? I.e. do all size() elements get.
Definition: faceMapper.H:138
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
HashSet.H
Foam::faceMapper::weights
virtual const scalarListList & weights() const
Return interpolaion weights.
Definition: faceMapper.C:347
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
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::faceMapper::~faceMapper
virtual ~faceMapper()
Destructor.
Definition: faceMapper.C:277
Foam::faceMapper::insertedObjectLabels
virtual const labelList & insertedObjectLabels() const
Return list of inserted faces.
Definition: faceMapper.C:365
Foam::List< label >
Foam::UList< label >
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:161
Foam::faceMapper::nOldInternalFaces
virtual label nOldInternalFaces() const
Return number of old internalFaces.
Definition: faceMapper.C:390
Foam::faceMapper::addressing
virtual const labelListList & addressing() const
Return interpolated addressing.
Definition: faceMapper.C:329