FreeFOAM The Cross-Platform CFD Toolkit
pointPatchMapper.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::pointPatchMapper
26 
27 Description
28  Mapping class for a pointPatchField.
29 
30 SourceFiles
31  pointPatchMapper.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef pointPatchMapper_H
36 #define pointPatchMapper_H
37 
38 #include "pointMapper.H"
40 #include <OpenFOAM/pointPatch.H>
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 // Forward declaration of classes
49 class pointPatch;
50 class mapPolyMesh;
51 
52 /*---------------------------------------------------------------------------*\
53  Class pointPatchMapper Declaration
54 \*---------------------------------------------------------------------------*/
55 
57 :
59 {
60  // Private data
61 
62  //- Reference to patch
63  const pointPatch& patch_;
64 
65  //- Reference to point mapper for internal field
66  const morphFieldMapper& pointMapper_;
67 
68  //- Reference to mapping data
69  const mapPolyMesh& mpm_;
70 
71  //- Size before mapping
72  const label sizeBeforeMapping_;
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 
87  // Private Member Functions
88 
89  //- Disallow default bitwise copy construct
91  (
92  const pointPatchMapper&
93  );
94 
95  //- Disallow default bitwise assignment
96  void operator=(const pointPatchMapper&);
97 
98 
99  //- Calculate addressing for mapping with inserted cells
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 mappers
114  (
115  const pointPatch& patch,
116  const pointMapper& pointMap,
117  const mapPolyMesh& mpm
118  );
119 
120 
121  // Destructor
122 
123  virtual ~pointPatchMapper();
124 
125 
126  // Member Functions
127 
128  //- Return size
129  virtual label size() const
130  {
131  return patch_.size();
132  }
133 
134  //- Return size of field before mapping
135  virtual label sizeBeforeMapping() const
136  {
137  return sizeBeforeMapping_;
138  }
139 
140  //- Is the mapping direct
141  virtual bool direct() const
142  {
143  return pointMapper_.direct();
144  }
145 
146  //- Return direct addressing
147  virtual const unallocLabelList& directAddressing() const;
148 
149  //- Return interpolated addressing
150  virtual const labelListList& addressing() const;
151 
152  //- Return interpolaion weights
153  virtual const scalarListList& weights() const;
154 
155 };
156 
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 } // End namespace Foam
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 #endif
165 
166 // ************************ vim: set sw=4 sts=4 et: ************************ //