pointMapper.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::pointMapper
26 
27 Description
28  This object provides mapping and fill-in information for point data
29  between the two meshes after the topological change. It is
30  constructed from mapPolyMesh.
31 
32 SourceFiles
33  pointMapper.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef pointMapper_H
38 #define pointMapper_H
39 
40 #include "morphFieldMapper.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward declaration of classes
48 class pointMesh;
49 class mapPolyMesh;
50 class polyMesh;
51 
52 /*---------------------------------------------------------------------------*\
53  Class pointMapper Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 class pointMapper
57 :
58  public morphFieldMapper
59 {
60  // Private Data
61 
62  //- Reference to pointMesh
63  const pointMesh& pMesh_;
64 
65  //- Reference to mapPolyMesh
66  const mapPolyMesh& mpm_;
67 
68  //- Are there any inserted (unmapped) points
69  bool insertedPoints_;
70 
71  //- Is the mapping direct
72  bool direct_;
73 
74 
75  // Demand-driven private data
76 
77  //- Direct addressing (only one for of addressing is used)
78  mutable labelList* directAddrPtr_;
79 
80  //- Interpolated addressing (only one for of addressing is used)
81  mutable labelListList* interpolationAddrPtr_;
82 
83  //- Interpolation weights
84  mutable scalarListList* weightsPtr_;
85 
86  //- Inserted points
87  mutable labelList* insertedPointLabelsPtr_;
88 
89 
90  // Private Member Functions
91 
92  //- Calculate addressing for mapping with inserted points
93  void calcAddressing() const;
94 
95  //- Clear out local storage
96  void clearOut();
97 
98 
99 public:
100 
101  // Constructors
102 
103  //- Construct from mapPolyMesh
104  pointMapper(const pointMesh&, const mapPolyMesh& mpm);
105 
106  //- Disallow default bitwise copy construction
107  pointMapper(const pointMapper&) = delete;
108 
109 
110  //- Destructor
111  virtual ~pointMapper();
112 
113 
114  // Member Functions
115 
116  //- Return size before mapping
117  virtual label sizeBeforeMapping() const;
118 
119  //- Is the mapping direct
120  virtual bool direct() const
121  {
122  return direct_;
123  }
124 
125  //- Are there unmapped values? I.e. do all size() elements get
126  // get value
127  virtual bool hasUnmapped() const
128  {
129  return insertedObjects();
130  }
131 
132  //- Return direct addressing
133  virtual const labelUList& directAddressing() const;
134 
135  //- Return interpolated addressing
136  virtual const labelListList& addressing() const;
137 
138  //- Return interpolation weights
139  virtual const scalarListList& weights() const;
140 
141  //- Are there any inserted points
142  bool insertedObjects() const
143  {
144  return insertedPoints_;
145  }
146 
147  //- Return list of inserted points
148  const labelList& insertedObjectLabels() const;
149 
150 
151  // Member Operators
152 
153  //- Disallow default bitwise assignment
154  void operator=(const pointMapper&) = delete;
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 const labelListList & addressing() const
Return interpolated addressing.
Definition: pointMapper.C:252
virtual bool hasUnmapped() const
Are there unmapped values? I.e. do all size() elements get.
Definition: pointMapper.H:126
virtual label sizeBeforeMapping() const
Return size before mapping.
Definition: pointMapper.C:220
const labelList & insertedObjectLabels() const
Return list of inserted points.
Definition: pointMapper.C:288
virtual ~pointMapper()
Destructor.
Definition: pointMapper.C:212
pointMapper(const pointMesh &, const mapPolyMesh &mpm)
Construct from mapPolyMesh.
Definition: pointMapper.C:161
void operator=(const pointMapper &)=delete
Disallow default bitwise assignment.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
bool insertedObjects() const
Are there any inserted points.
Definition: pointMapper.H:141
Mesh representing a set of points created from polyMesh.
Definition: pointMesh.H:48
virtual const scalarListList & weights() const
Return interpolation weights.
Definition: pointMapper.C:270
virtual const labelUList & directAddressing() const
Return direct addressing.
Definition: pointMapper.C:226
Abstract base class to hold the Field mapping for mesh morphs.
virtual bool direct() const
Is the mapping direct.
Definition: pointMapper.H:119
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
This object provides mapping and fill-in information for point data between the two meshes after the ...
Definition: pointMapper.H:55
Namespace for OpenFOAM.