FreeFOAM The Cross-Platform CFD Toolkit
fvPatchMapper.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::fvPatchMapper
26 
27 Description
28  Mapping class for a fvPatchField.
29 
30 SourceFiles
31  fvPatchMapper.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef fvPatchMapper_H
36 #define fvPatchMapper_H
37 
39 #include <OpenFOAM/faceMapper.H>
40 #include <finiteVolume/fvPatch.H>
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 // Forward declaration of classes
49 class fvPatch;
50 class mapPolyMesh;
51 
52 /*---------------------------------------------------------------------------*\
53  Class fvPatchMapper Declaration
54 \*---------------------------------------------------------------------------*/
55 
57 :
58  public fvPatchFieldMapper
59 {
60  // Private data
61 
62  //- Reference to patch
63  const fvPatch& patch_;
64 
65  //- Reference to face mapper
66  const faceMapper& faceMap_;
67 
68  //- Size before mapping
69  const label sizeBeforeMapping_;
70 
71 
72  // Demand-driven private data
73 
74  //- Direct addressing (only one for of addressing is used)
75  mutable labelList* directAddrPtr_;
76 
77  //- Interpolated addressing (only one for of addressing is used)
78  mutable labelListList* interpolationAddrPtr_;
79 
80  //- Interpolation weights
81  mutable scalarListList* weightsPtr_;
82 
83 
84  // Private Member Functions
85 
86  //- Disallow default bitwise copy construct
88  (
89  const fvPatchMapper&
90  );
91 
92  //- Disallow default bitwise assignment
93  void operator=(const fvPatchMapper&);
94 
95 
96  //- Calculate addressing for mapping with inserted cells
97  void calcAddressing() const;
98 
99  //- Clear out local storage
100  void clearOut();
101 
102 
103 public:
104 
105  // Static data members
106 
107  // Constructors
108 
109  //- Construct from mappers
111  (
112  const fvPatch& patch,
113  const faceMapper& faceMap
114  );
115 
116 
117  // Destructor
118 
119  virtual ~fvPatchMapper();
120 
121 
122  // Member Functions
123 
124  //- Return size
125  virtual label size() const
126  {
127  return patch_.size();
128  }
129 
130  //- Return size of field before mapping
131  virtual label sizeBeforeMapping() const
132  {
133  return sizeBeforeMapping_;
134  }
135 
136  //- Is the mapping direct
137  virtual bool direct() const
138  {
139  return faceMap_.direct();
140  }
141 
142  //- Return direct addressing
143  virtual const unallocLabelList& 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 };
152 
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 } // End namespace Foam
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 #endif
161 
162 // ************************ vim: set sw=4 sts=4 et: ************************ //