FreeFOAM The Cross-Platform CFD Toolkit
cellMapper.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::cellMapper
26 
27 Description
28  This object provides mapping and fill-in information for cell data
29  between the two meshes after the topological change. It is
30  constructed from mapPolyMesh.
31 
32 SourceFiles
33  cellMapper.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef cellMapper_H
38 #define cellMapper_H
39 
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward declaration of classes
48 class polyMesh;
49 class mapPolyMesh;
50 
51 /*---------------------------------------------------------------------------*\
52  Class cellMapper Declaration
53 \*---------------------------------------------------------------------------*/
54 
56 :
57  public morphFieldMapper
58 {
59  // Private data
60 
61  //- Reference to polyMesh
62  const polyMesh& mesh_;
63 
64  //- Reference to mapPolyMesh
65  const mapPolyMesh& mpm_;
66 
67  //- Are there any inserted (unmapped) cells
68  bool insertedCells_;
69 
70  //- Is the mapping direct
71  bool direct_;
72 
73 
74  // Demand-driven private data
75 
76  //- Direct addressing (only one for of addressing is used)
77  mutable labelList* directAddrPtr_;
78 
79  //- Interpolated addressing (only one for of addressing is used)
80  mutable labelListList* interpolationAddrPtr_;
81 
82  //- Interpolation weights
83  mutable scalarListList* weightsPtr_;
84 
85  //- Inserted cells
86  mutable labelList* insertedCellLabelsPtr_;
87 
88 
89  // Private Member Functions
90 
91  //- Disallow default bitwise copy construct
92  cellMapper(const cellMapper&);
93 
94  //- Disallow default bitwise assignment
95  void operator=(const cellMapper&);
96 
97 
98  //- Calculate addressing for mapping with inserted cells
99  void calcAddressing() const;
100 
101  //- Clear out local storage
102  void clearOut();
103 
104 
105 public:
106 
107  // Static data members
108 
109  // Constructors
110 
111  //- Construct from mapPolyMesh
112  cellMapper(const mapPolyMesh& mpm);
113 
114 
115  // Destructor
116 
117  virtual ~cellMapper();
118 
119 
120  // Member Functions
121 
122  //- Return size
123  virtual label size() const;
124 
125  //- Return size before mapping
126  virtual label sizeBeforeMapping() const;
127 
128  //- Is the mapping direct
129  virtual bool direct() const
130  {
131  return direct_;
132  }
133 
134  //- Return direct addressing
135  virtual const unallocLabelList& directAddressing() const;
136 
137  //- Return interpolated addressing
138  virtual const labelListList& addressing() const;
139 
140  //- Return interpolaion weights
141  virtual const scalarListList& weights() const;
142 
143  //- Are there any inserted cells
144  bool insertedObjects() const
145  {
146  return insertedCells_;
147  }
148 
149  //- Return list of inserted cells
150  const labelList& insertedObjectLabels() const;
151 };
152 
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 } // End namespace Foam
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 #endif
161 
162 // ************************ vim: set sw=4 sts=4 et: ************************ //