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-2023 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 polyTopoChangeMap.
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 polyTopoChangeMap;
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 polyTopoChangeMap
65  const polyTopoChangeMap& 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 polyTopoChangeMap
105  cellMapper(const polyTopoChangeMap& 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  //- Is the mapping direct
118  virtual bool direct() const
119  {
120  return direct_;
121  }
122 
123  //- Return direct addressing
124  virtual const labelUList& directAddressing() const;
125 
126  //- Return interpolated addressing
127  virtual const labelListList& addressing() const;
128 
129  //- Return interpolation weights
130  virtual const scalarListList& weights() const;
131 
132  //- Return size before mapping
133  virtual label sizeBeforeMapping() const;
134 
135  //- Are there any inserted cells
136  virtual bool insertedObjects() const
137  {
138  return insertedCells_;
139  }
140 
141  //- Return list of inserted cells
142  virtual const labelList& insertedObjectLabels() const;
143 
144 
145  // Member Operators
146 
147  //- Disallow default bitwise assignment
148  void operator=(const cellMapper&) = delete;
149 };
150 
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 } // End namespace Foam
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 #endif
159 
160 // ************************************************************************* //
This object provides mapping and fill-in information for cell data between the two meshes after the t...
Definition: cellMapper.H:57
cellMapper(const polyTopoChangeMap &mpm)
Construct from polyTopoChangeMap.
Definition: cellMapper.C:219
virtual ~cellMapper()
Destructor.
Definition: cellMapper.C:271
virtual const labelListList & addressing() const
Return interpolated addressing.
Definition: cellMapper.C:305
virtual const scalarListList & weights() const
Return interpolation weights.
Definition: cellMapper.C:323
virtual const labelUList & directAddressing() const
Return direct addressing.
Definition: cellMapper.C:279
void operator=(const cellMapper &)=delete
Disallow default bitwise assignment.
virtual const labelList & insertedObjectLabels() const
Return list of inserted cells.
Definition: cellMapper.C:347
virtual label sizeBeforeMapping() const
Return size before mapping.
Definition: cellMapper.C:341
virtual bool insertedObjects() const
Are there any inserted cells.
Definition: cellMapper.H:135
virtual bool direct() const
Is the mapping direct.
Definition: cellMapper.H:117
Abstract base class to hold the Field mapping for mesh morphs.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Namespace for OpenFOAM.
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