pointMapper.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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::pointMapper
28 
29 Description
30  This object provides mapping and fill-in information for point data
31  between the two meshes after the topological change. It is
32  constructed from mapPolyMesh.
33 
34 SourceFiles
35  pointMapper.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef pointMapper_H
40 #define pointMapper_H
41 
42 #include "morphFieldMapper.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward declaration of classes
50 class pointMesh;
51 class mapPolyMesh;
52 class polyMesh;
53 
54 /*---------------------------------------------------------------------------*\
55  Class pointMapper Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class pointMapper
59 :
60  public morphFieldMapper
61 {
62  // Private data
63 
64  //- Reference to pointMesh
65  const pointMesh& pMesh_;
66 
67  //- Reference to mapPolyMesh
68  const mapPolyMesh& mpm_;
69 
70  //- Are there any inserted (unmapped) points
71  bool insertedPoints_;
72 
73  //- Is the mapping direct
74  bool direct_;
75 
76 
77  // Demand-driven private data
78 
79  //- Direct addressing (only one for of addressing is used)
80  mutable labelList* directAddrPtr_;
81 
82  //- Interpolated addressing (only one for of addressing is used)
83  mutable labelListList* interpolationAddrPtr_;
84 
85  //- Interpolation weights
86  mutable scalarListList* weightsPtr_;
87 
88  //- Inserted points
89  mutable labelList* insertedPointLabelsPtr_;
90 
91 
92  // Private Member Functions
93 
94  //- No copy construct
95  pointMapper(const pointMapper&) = delete;
96 
97  //- No copy assignment
98  void operator=(const pointMapper&) = delete;
99 
100 
101  //- Calculate addressing for mapping with inserted points
102  void calcAddressing() const;
103 
104  //- Clear out local storage
105  void clearOut();
106 
107 
108 public:
109 
110  // Constructors
111 
112  //- Construct from mapPolyMesh
113  pointMapper(const pointMesh&, const mapPolyMesh& mpm);
114 
115 
116  //- Destructor
117  virtual ~pointMapper();
118 
119 
120  // Member Functions
121 
122  //- Return size
123  virtual label size() const;
124 
125  //- Return size before mapping
126  virtual label sizeBeforeMapping() const;
127 
128  //- Is the mapping direct
129  virtual bool direct() const
130  {
131  return direct_;
132  }
133 
134  //- Are there unmapped values? I.e. do all size() elements get
135  // get value
136  virtual bool hasUnmapped() const
137  {
138  return insertedObjects();
139  }
140 
141  //- Return direct addressing
142  virtual const labelUList& directAddressing() const;
143 
144  //- Return interpolated addressing
145  virtual const labelListList& addressing() const;
146 
147  //- Return interpolation weights
148  virtual const scalarListList& weights() const;
149 
150  //- Are there any inserted points
151  bool insertedObjects() const
152  {
153  return insertedPoints_;
154  }
155 
156  //- Return list of inserted points
157  const labelList& insertedObjectLabels() const;
158 };
159 
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 } // End namespace Foam
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 #endif
168 
169 // ************************************************************************* //
Foam::scalarListList
List< scalarList > scalarListList
A List of scalarList.
Definition: scalarList.H:66
Foam::pointMapper::~pointMapper
virtual ~pointMapper()
Destructor.
Definition: pointMapper.C:214
morphFieldMapper.H
Foam::morphFieldMapper
Abstract base class to hold the Field mapping for mesh morphs.
Definition: morphFieldMapper.H:49
Foam::pointMapper::direct
virtual bool direct() const
Is the mapping direct.
Definition: pointMapper.H:128
Foam::pointMapper::directAddressing
virtual const labelUList & directAddressing() const
Return direct addressing.
Definition: pointMapper.C:234
Foam::pointMapper::sizeBeforeMapping
virtual label sizeBeforeMapping() const
Return size before mapping.
Definition: pointMapper.C:228
Foam::pointMapper
This object provides mapping and fill-in information for point data between the two meshes after the ...
Definition: pointMapper.H:57
Foam::pointMapper::insertedObjectLabels
const labelList & insertedObjectLabels() const
Return list of inserted points.
Definition: pointMapper.C:296
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::pointMesh
Mesh representing a set of points created from polyMesh.
Definition: pointMesh.H:51
Foam::pointMapper::insertedObjects
bool insertedObjects() const
Are there any inserted points.
Definition: pointMapper.H:150
Foam::pointMapper::hasUnmapped
virtual bool hasUnmapped() const
Are there unmapped values? I.e. do all size() elements get.
Definition: pointMapper.H:135
Foam::labelListList
List< labelList > labelListList
A List of labelList.
Definition: labelList.H:56
Foam::List< label >
Foam::pointMapper::size
virtual label size() const
Return size.
Definition: pointMapper.C:222
Foam::UList< label >
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:161
Foam::labelUList
UList< label > labelUList
A UList of labels.
Definition: UList.H:85
Foam::pointMapper::weights
virtual const scalarListList & weights() const
Return interpolation weights.
Definition: pointMapper.C:278
Foam::pointMapper::addressing
virtual const labelListList & addressing() const
Return interpolated addressing.
Definition: pointMapper.C:260