FreeFOAM The Cross-Platform CFD Toolkit
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 | 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::fvSurfaceMapper
26 
27 Description
28  FV surface mapper.
29 
30 SourceFiles
31  fvSurfaceMapper.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef fvSurfaceMapper_H
36 #define fvSurfaceMapper_H
37 
39 #include <finiteVolume/fvMesh.H>
40 #include <OpenFOAM/faceMapper.H>
41 #include <OpenFOAM/HashSet.H>
42 #include <OpenFOAM/mapPolyMesh.H>
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward declaration of classes
50 
51 /*---------------------------------------------------------------------------*\
52  Class fvSurfaceMapper Declaration
53 \*---------------------------------------------------------------------------*/
54 
56 :
57  public morphFieldMapper
58 {
59  // Private data
60 
61  //- Reference to mesh
62  const fvMesh& mesh_;
63 
64  //- Reference to face mapper
65  const faceMapper& faceMap_;
66 
67 
68  // Demand-driven private data
69 
70  //- Direct addressing (only one for of addressing is used)
71  mutable labelList* directAddrPtr_;
72 
73  //- Interpolated addressing (only one for of addressing is used)
74  mutable labelListList* interpolationAddrPtr_;
75 
76  //- Interpolation weights
77  mutable scalarListList* weightsPtr_;
78 
79  //- Inserted faces
80  mutable labelList* insertedObjectLabelsPtr_;
81 
82 
83 
84  // Private Member Functions
85 
86  //- Disallow default bitwise copy construct
88 
89  //- Disallow default bitwise assignment
90  void operator=(const fvSurfaceMapper&);
91 
92 
93  //- Calculate addressing
94  void calcAddressing() const;
95 
96  //- Clear out local storage
97  void clearOut();
98 
99 
100 public:
101 
102  // Constructors
103 
104  //- Construct from components
106  (
107  const fvMesh& mesh,
108  const faceMapper& fMapper
109  );
110 
111 
112  // Destructor
113 
114  virtual ~fvSurfaceMapper();
115 
116 
117  // Member Functions
118 
119  //- Return size
120  virtual label size() const
121  {
122  return mesh_.nInternalFaces();
123  }
124 
125  //- Return size of field before mapping
126  virtual label sizeBeforeMapping() const
127  {
128  return faceMap_.internalSizeBeforeMapping();
129  }
130 
131  //- Is the mapping direct
132  virtual bool direct() const
133  {
134  return faceMap_.direct();
135  }
136 
137  //- Return direct addressing
138  virtual const unallocLabelList& directAddressing() const;
139 
140  //- Return interpolated addressing
141  virtual const labelListList& addressing() const;
142 
143  //- Return interpolaion weights
144  virtual const scalarListList& weights() const;
145 
146  //- Are there any inserted faces
147  virtual bool insertedObjects() const
148  {
149  return faceMap_.insertedObjects();
150  }
151 
152  //- Return list of inserted faces
153  virtual const labelList& insertedObjectLabels() const;
154 
155  //- Return flux flip map
156  const labelHashSet& flipFaceFlux() const
157  {
158  return faceMap_.flipFaceFlux();
159  }
160 };
161 
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 } // End namespace Foam
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 #endif
170 
171 // ************************ vim: set sw=4 sts=4 et: ************************ //