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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2013 OpenFOAM Foundation
9  Copyright (C) 2024 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::cellMapper
29 
30 Description
31  This object provides mapping and fill-in information for cell data
32  between the two meshes after the topological change. It is
33  constructed from mapPolyMesh.
34 
35 SourceFiles
36  cellMapper.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef Foam_cellMapper_H
41 #define Foam_cellMapper_H
42 
43 #include "morphFieldMapper.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Forward Declarations
51 class mapPolyMesh;
52 
53 /*---------------------------------------------------------------------------*\
54  Class cellMapper Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class cellMapper
58 :
59  public morphFieldMapper
60 {
61  // Private Data
62 
63  //- Reference to mapPolyMesh
64  const mapPolyMesh& mpm_;
65 
66  //- The size of the mapper = polyMesh::nCells()
67  const label mapperLen_;
68 
69  //- Number of inserted (unmapped) cells
70  label nInsertedObjects_;
71 
72  //- Is the mapping direct
73  bool direct_;
74 
75 
76  // Demand-Driven Data
77 
78  //- Direct addressing (only one for of addressing is used)
79  mutable std::unique_ptr<labelList> directAddrPtr_;
80 
81  //- Interpolated addressing (only one for of addressing is used)
82  mutable std::unique_ptr<labelListList> interpAddrPtr_;
83 
84  //- Interpolation weights
85  mutable std::unique_ptr<scalarListList> weightsPtr_;
86 
87  //- Inserted cells
88  mutable std::unique_ptr<labelList> insertedObjectsPtr_;
89 
90 
91  // Private Member Functions
92 
93  //- Calculate addressing for mapping with inserted cells
94  void calcAddressing() const;
95 
96 public:
97 
98  // Generated Methods
99 
100  //- No copy construct
101  cellMapper(const cellMapper&) = delete;
102 
103  //- No copy assignment
104  void operator=(const cellMapper&) = delete;
105 
106 
107  // Constructors
108 
109  //- Construct from mapPolyMesh
110  explicit cellMapper(const mapPolyMesh& mpm);
111 
112 
113  //- Destructor
114  virtual ~cellMapper();
115 
116 
117  // Member Functions
118 
119  //- The mapper size
120  virtual label size() const;
121 
122  //- Return size before mapping
123  virtual label sizeBeforeMapping() const;
124 
125  //- Is the mapping direct
126  virtual bool direct() const
127  {
128  return direct_;
129  }
130 
131  //- Are there unmapped values?
132  virtual bool hasUnmapped() const
133  {
134  return insertedObjects();
135  }
136 
137  //- Return direct addressing
138  virtual const labelUList& directAddressing() const;
139 
140  //- Return interpolated addressing
141  virtual const labelListList& addressing() const;
142 
143  //- Return interpolaion weights
144  virtual const scalarListList& weights() const;
145 
146  //- Are there any inserted cells
147  virtual bool insertedObjects() const
148  {
149  return bool(nInsertedObjects_);
150  }
151 
152  //- Return list of inserted cells
153  const virtual labelList& insertedObjectLabels() const;
154 };
155 
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 } // End namespace Foam
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 #endif
164 
165 // ************************************************************************* //
virtual label sizeBeforeMapping() const
Return size before mapping.
Definition: cellMapper.C:358
virtual const scalarListList & weights() const
Return interpolaion weights.
Definition: cellMapper.C:408
void operator=(const cellMapper &)=delete
No copy assignment.
This object provides mapping and fill-in information for cell data between the two meshes after the t...
Definition: cellMapper.H:52
cellMapper(const cellMapper &)=delete
No copy construct.
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?
Definition: cellMapper.H:161
virtual const labelListList & addressing() const
Return interpolated addressing.
Definition: cellMapper.C:390
virtual const labelUList & directAddressing() const
Return direct addressing.
Definition: cellMapper.C:364
virtual label size() const
The mapper size.
Definition: cellMapper.C:351
virtual const labelList & insertedObjectLabels() const
Return list of inserted cells.
Definition: cellMapper.C:426
virtual ~cellMapper()
Destructor.
Definition: cellMapper.C:345
virtual bool insertedObjects() const
Are there any inserted cells.
Definition: cellMapper.H:184
virtual bool direct() const
Is the mapping direct.
Definition: cellMapper.H:153
Namespace for OpenFOAM.