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 | Copyright (C) 2011-2013 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::faceMapper
26 
27 Description
28  This object provides mapping and fill-in information for face data
29  between the two meshes after the topological change. It is
30  constructed from mapPolyMesh.
31 
32 SourceFiles
33  faceMapper.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef faceMapper_H
38 #define faceMapper_H
39 
40 #include "morphFieldMapper.H"
41 #include "HashSet.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 // Forward declaration of classes
49 class polyMesh;
50 class mapPolyMesh;
51 
52 /*---------------------------------------------------------------------------*\
53  Class faceMapper Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 class faceMapper
57 :
58  public morphFieldMapper
59 {
60  // Private data
61 
62  //- Reference to polyMesh
63  const polyMesh& mesh_;
64 
65  //- Reference to mapPolyMesh
66  const mapPolyMesh& mpm_;
67 
68  //- Are there any inserted (unmapped) faces
69  bool insertedFaces_;
70 
71  //- Is the mapping direct
72  bool direct_;
73 
74 
75  // Demand-driven private data
76 
77  //- Direct addressing (only one for of addressing is used)
78  mutable labelList* directAddrPtr_;
79 
80  //- Interpolated addressing (only one for of addressing is used)
82 
83  //- Interpolation weights
84  mutable scalarListList* weightsPtr_;
85 
86  //- Inserted faces
88 
89 
90  // Private Member Functions
91 
92  //- Disallow default bitwise copy construct
93  faceMapper(const faceMapper&);
94 
95  //- Disallow default bitwise assignment
96  void operator=(const faceMapper&);
97 
98 
99  //- Calculate addressing for mapping with inserted faces
100  void calcAddressing() const;
101 
102  //- Clear out local storage
103  void clearOut();
104 
105 
106 public:
107 
108  // Static data members
109 
110  // Constructors
111 
112  //- Construct from mapPolyMesh
113  faceMapper(const mapPolyMesh& mpm);
114 
115 
116  //- Destructor
117  virtual ~faceMapper();
118 
119 
120  // Member Functions
121 
122  //- Return size
123  virtual label size() const;
124 
125  //- Return size of field before mapping
126  virtual label sizeBeforeMapping() const;
127 
128  //- Return number of internal faces before mapping
129  virtual label internalSizeBeforeMapping() const;
130 
131  //- Is the mapping direct
132  virtual bool direct() const
133  {
134  return direct_;
135  }
136 
137  virtual bool hasUnmapped() const
138  {
139  return insertedObjects();
140  }
141 
142  //- Return direct addressing
143  virtual const labelUList& directAddressing() const;
144 
145  //- Return interpolated addressing
146  virtual const labelListList& addressing() const;
147 
148  //- Return interpolaion weights
149  virtual const scalarListList& weights() const;
150 
151  //- Return flux flip map
152  virtual const labelHashSet& flipFaceFlux() const;
153 
154  //- Return number of old internalFaces
155  virtual label nOldInternalFaces() const;
156 
157  //- Return old patch starts
158  virtual const labelList& oldPatchStarts() const;
159 
160  //- Return old patch sizes
161  virtual const labelList& oldPatchSizes() const;
162 
163  //- Are there any inserted faces
164  virtual bool insertedObjects() const
165  {
166  return insertedFaces_;
167  }
168 
169  //- Return list of inserted faces
170  virtual const labelList& insertedObjectLabels() const;
171 };
172 
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 } // End namespace Foam
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 #endif
181 
182 // ************************************************************************* //
Foam::faceMapper::directAddressing
virtual const labelUList & directAddressing() const
Return direct addressing.
Definition: faceMapper.C:302
Foam::faceMapper::oldPatchSizes
virtual const labelList & oldPatchSizes() const
Return old patch sizes.
Definition: faceMapper.C:401
Foam::faceMapper::insertedObjects
virtual bool insertedObjects() const
Are there any inserted faces.
Definition: faceMapper.H:163
morphFieldMapper.H
Foam::morphFieldMapper
Abstract base class to hold the Field mapping for mesh morphs.
Definition: morphFieldMapper.H:46
Foam::faceMapper::size
virtual label size() const
Return size.
Definition: faceMapper.C:284
Foam::faceMapper::oldPatchStarts
virtual const labelList & oldPatchStarts() const
Return old patch starts.
Definition: faceMapper.C:395
Foam::faceMapper::internalSizeBeforeMapping
virtual label internalSizeBeforeMapping() const
Return number of internal faces before mapping.
Definition: faceMapper.C:296
Foam::faceMapper::direct_
bool direct_
Is the mapping direct.
Definition: faceMapper.H:71
Foam::faceMapper::mesh_
const polyMesh & mesh_
Reference to polyMesh.
Definition: faceMapper.H:62
Foam::faceMapper::sizeBeforeMapping
virtual label sizeBeforeMapping() const
Return size of field before mapping.
Definition: faceMapper.C:290
Foam::faceMapper::directAddrPtr_
labelList * directAddrPtr_
Direct addressing (only one for of addressing is used)
Definition: faceMapper.H:77
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:136
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::faceMapper::insertedFaces_
bool insertedFaces_
Are there any inserted (unmapped) faces.
Definition: faceMapper.H:68
Foam::faceMapper::insertedFaceLabelsPtr_
labelList * insertedFaceLabelsPtr_
Inserted faces.
Definition: faceMapper.H:86
Foam::faceMapper::calcAddressing
void calcAddressing() const
Calculate addressing for mapping with inserted faces.
Definition: faceMapper.C:33
Foam::faceMapper::weightsPtr_
scalarListList * weightsPtr_
Interpolation weights.
Definition: faceMapper.H:83
HashSet.H
Foam::faceMapper::weights
virtual const scalarListList & weights() const
Return interpolaion weights.
Definition: faceMapper.C:346
Foam::faceMapper
This object provides mapping and fill-in information for face data between the two meshes after the t...
Definition: faceMapper.H:55
Foam::faceMapper::direct
virtual bool direct() const
Is the mapping direct.
Definition: faceMapper.H:131
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::faceMapper::flipFaceFlux
virtual const labelHashSet & flipFaceFlux() const
Return flux flip map.
Definition: faceMapper.C:383
Foam::faceMapper::~faceMapper
virtual ~faceMapper()
Destructor.
Definition: faceMapper.C:276
Foam::faceMapper::clearOut
void clearOut()
Clear out local storage.
Definition: faceMapper.C:193
Foam::faceMapper::mpm_
const mapPolyMesh & mpm_
Reference to mapPolyMesh.
Definition: faceMapper.H:65
Foam::faceMapper::faceMapper
faceMapper(const faceMapper &)
Disallow default bitwise copy construct.
Foam::faceMapper::insertedObjectLabels
virtual const labelList & insertedObjectLabels() const
Return list of inserted faces.
Definition: faceMapper.C:364
Foam::faceMapper::operator=
void operator=(const faceMapper &)
Disallow default bitwise assignment.
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::UList
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:60
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Foam::faceMapper::nOldInternalFaces
virtual label nOldInternalFaces() const
Return number of old internalFaces.
Definition: faceMapper.C:389
Foam::faceMapper::interpolationAddrPtr_
labelListList * interpolationAddrPtr_
Interpolated addressing (only one for of addressing is used)
Definition: faceMapper.H:80
Foam::faceMapper::addressing
virtual const labelListList & addressing() const
Return interpolated addressing.
Definition: faceMapper.C:328