cellMapper.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 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  //- Calculate addressing for mapping with inserted cells
92  void calcAddressing() const;
93 
94  //- Clear out local storage
95  void clearOut();
96 
97 
98 public:
99 
100  // Static Data Members
101 
102  // Constructors
103 
104  //- Construct from mapPolyMesh
105  cellMapper(const mapPolyMesh& mpm);
106 
107  //- Disallow default bitwise copy construction
108  cellMapper(const cellMapper&) = delete;
109 
110 
111  //- Destructor
112  virtual ~cellMapper();
113 
114 
115  // Member Functions
116 
117  //- Return size before mapping
118  virtual label sizeBeforeMapping() const;
119 
120  //- Is the mapping direct
121  virtual bool direct() const
122  {
123  return direct_;
124  }
126  virtual bool hasUnmapped() const
127  {
128  return insertedObjects();
129  }
130 
131  //- Return direct addressing
132  virtual const labelUList& directAddressing() const;
133 
134  //- Return interpolated addressing
135  virtual const labelListList& addressing() const;
136 
137  //- Return interpolaion weights
138  virtual const scalarListList& weights() const;
139 
140  //- Are there any inserted cells
141  virtual bool insertedObjects() const
142  {
143  return insertedCells_;
144  }
145 
146  //- Return list of inserted cells
147  const virtual labelList& insertedObjectLabels() const;
148 
149 
150  // Member Operators
151 
152  //- Disallow default bitwise assignment
153  void operator=(const cellMapper&) = delete;
154 };
155 
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 } // End namespace Foam
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 #endif
164 
165 // ************************************************************************* //
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:376
virtual const scalarListList & weights() const
Return interpolaion weights.
Definition: cellMapper.C:426
void operator=(const cellMapper &)=delete
Disallow default bitwise assignment.
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:125
virtual const labelListList & addressing() const
Return interpolated addressing.
Definition: cellMapper.C:408
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:60
virtual const labelUList & directAddressing() const
Return direct addressing.
Definition: cellMapper.C:382
cellMapper(const mapPolyMesh &mpm)
Construct from mapPolyMesh.
Definition: cellMapper.C:289
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
virtual const labelList & insertedObjectLabels() const
Return list of inserted cells.
Definition: cellMapper.C:444
virtual ~cellMapper()
Destructor.
Definition: cellMapper.C:368
virtual bool insertedObjects() const
Are there any inserted cells.
Definition: cellMapper.H:140
virtual bool direct() const
Is the mapping direct.
Definition: cellMapper.H:120
Namespace for OpenFOAM.