FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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 
41 #include <OpenFOAM/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 
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)
81  mutable labelListList* interpolationAddrPtr_;
82 
83  //- Interpolation weights
84  mutable scalarListList* weightsPtr_;
85 
86  //- Inserted faces
87  mutable labelList* insertedFaceLabelsPtr_;
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 
118  virtual ~faceMapper();
119 
120 
121  // Member Functions
122 
123  //- Return size
124  virtual label size() const;
125 
126  //- Return size of field before mapping
127  virtual label sizeBeforeMapping() const;
128 
129  //- Return number of internal faces before mapping
130  virtual label internalSizeBeforeMapping() const;
131 
132  //- Is the mapping direct
133  virtual bool direct() const
134  {
135  return direct_;
136  }
137 
138  //- Return direct addressing
139  virtual const unallocLabelList& directAddressing() const;
140 
141  //- Return interpolated addressing
142  virtual const labelListList& addressing() const;
143 
144  //- Return interpolaion weights
145  virtual const scalarListList& weights() const;
146 
147  //- Return flux flip map
148  virtual const labelHashSet& flipFaceFlux() const;
149 
150  //- Return number of old internalFaces
151  virtual label nOldInternalFaces() const;
152 
153  //- Return old patch starts
154  virtual const labelList& oldPatchStarts() const;
155 
156  //- Return old patch sizes
157  virtual const labelList& oldPatchSizes() const;
158 
159  //- Are there any inserted faces
160  virtual bool insertedObjects() const
161  {
162  return insertedFaces_;
163  }
164 
165  //- Return list of inserted faces
166  virtual const labelList& insertedObjectLabels() const;
167 };
168 
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 } // End namespace Foam
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #endif
177 
178 // ************************ vim: set sw=4 sts=4 et: ************************ //