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) 2011-2013 OpenFOAM Foundation
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 
40 #include "morphFieldMapper.H"
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 
55 class cellMapper
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  virtual ~cellMapper();
117 
118 
119  // Member Functions
120 
121  //- Return size
122  virtual label size() const;
123 
124  //- Return size before mapping
125  virtual label sizeBeforeMapping() const;
126 
127  //- Is the mapping direct
128  virtual bool direct() const
129  {
130  return direct_;
131  }
133  virtual bool hasUnmapped() const
134  {
135  return insertedObjects();
136  }
137 
138  //- Return direct addressing
139  virtual const labelUList& 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  //- Are there any inserted cells
148  virtual bool insertedObjects() const
149  {
150  return insertedCells_;
151  }
152 
153  //- Return list of inserted cells
154  const virtual labelList& insertedObjectLabels() const;
155 };
156 
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 } // End namespace Foam
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 #endif
165 
166 // ************************************************************************* //
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
virtual label sizeBeforeMapping() const
Return size before mapping.
Definition: cellMapper.C:382
virtual const scalarListList & weights() const
Return interpolaion weights.
Definition: cellMapper.C:432
This object provides mapping and fill-in information for cell data between the two meshes after the t...
Definition: cellMapper.H:54
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Abstract base class to hold the Field mapping for mesh morphs.
virtual bool hasUnmapped() const
Are there unmapped values? I.e. do all size() elements get.
Definition: cellMapper.H:132
virtual const labelListList & addressing() const
Return interpolated addressing.
Definition: cellMapper.C:414
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:61
virtual const labelUList & directAddressing() const
Return direct addressing.
Definition: cellMapper.C:388
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
virtual label size() const
Return size.
Definition: cellMapper.C:376
virtual const labelList & insertedObjectLabels() const
Return list of inserted cells.
Definition: cellMapper.C:450
virtual ~cellMapper()
Destructor.
Definition: cellMapper.C:368
virtual bool insertedObjects() const
Are there any inserted cells.
Definition: cellMapper.H:147
virtual bool direct() const
Is the mapping direct.
Definition: cellMapper.H:127
Namespace for OpenFOAM.