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 -------------------------------------------------------------------------------
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::cellMapper
28 
29 Description
30  This object provides mapping and fill-in information for cell data
31  between the two meshes after the topological change. It is
32  constructed from mapPolyMesh.
33 
34 SourceFiles
35  cellMapper.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef cellMapper_H
40 #define cellMapper_H
41 
42 #include "morphFieldMapper.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward declaration of classes
50 class polyMesh;
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 polyMesh
64  const polyMesh& mesh_;
65 
66  //- Reference to mapPolyMesh
67  const mapPolyMesh& mpm_;
68 
69  //- Are there any inserted (unmapped) cells
70  bool insertedCells_;
71 
72  //- Is the mapping direct
73  bool direct_;
74 
75 
76  // Demand-driven private data
77 
78  //- Direct addressing (only one for of addressing is used)
79  mutable labelList* directAddrPtr_;
80 
81  //- Interpolated addressing (only one for of addressing is used)
82  mutable labelListList* interpolationAddrPtr_;
83 
84  //- Interpolation weights
85  mutable scalarListList* weightsPtr_;
86 
87  //- Inserted cells
88  mutable labelList* insertedCellLabelsPtr_;
89 
90 
91  // Private Member Functions
92 
93  //- No copy construct
94  cellMapper(const cellMapper&) = delete;
95 
96  //- No copy assignment
97  void operator=(const cellMapper&) = delete;
98 
99 
100  //- Calculate addressing for mapping with inserted cells
101  void calcAddressing() const;
102 
103  //- Clear out local storage
104  void clearOut();
105 
106 
107 public:
108 
109  // Static data members
110 
111  // Constructors
112 
113  //- Construct from mapPolyMesh
114  cellMapper(const mapPolyMesh& mpm);
115 
116 
117  //- Destructor
118  virtual ~cellMapper();
119 
120 
121  // Member Functions
122 
123  //- Return size
124  virtual label size() const;
125 
126  //- Return size before mapping
127  virtual label sizeBeforeMapping() const;
128 
129  //- Is the mapping direct
130  virtual bool direct() const
131  {
132  return direct_;
133  }
134 
135  virtual bool hasUnmapped() const
136  {
137  return insertedObjects();
138  }
139 
140  //- Return direct addressing
141  virtual const labelUList& directAddressing() const;
142 
143  //- Return interpolated addressing
144  virtual const labelListList& addressing() const;
145 
146  //- Return interpolaion weights
147  virtual const scalarListList& weights() const;
148 
149  //- Are there any inserted cells
150  virtual bool insertedObjects() const
151  {
152  return insertedCells_;
153  }
154 
155  //- Return list of inserted cells
156  const virtual labelList& insertedObjectLabels() const;
157 };
158 
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 } // End namespace Foam
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #endif
167 
168 // ************************************************************************* //
Foam::cellMapper::insertedObjects
virtual bool insertedObjects() const
Are there any inserted cells.
Definition: cellMapper.H:149
morphFieldMapper.H
Foam::morphFieldMapper
Abstract base class to hold the Field mapping for mesh morphs.
Definition: morphFieldMapper.H:49
Foam::cellMapper::directAddressing
virtual const labelUList & directAddressing() const
Return direct addressing.
Definition: cellMapper.C:390
Foam::cellMapper
This object provides mapping and fill-in information for cell data between the two meshes after the t...
Definition: cellMapper.H:56
Foam::cellMapper::hasUnmapped
virtual bool hasUnmapped() const
Are there unmapped values? I.e. do all size() elements get.
Definition: cellMapper.H:134
Foam::cellMapper::~cellMapper
virtual ~cellMapper()
Destructor.
Definition: cellMapper.C:370
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::cellMapper::direct
virtual bool direct() const
Is the mapping direct.
Definition: cellMapper.H:129
Foam::cellMapper::addressing
virtual const labelListList & addressing() const
Return interpolated addressing.
Definition: cellMapper.C:416
Foam::cellMapper::sizeBeforeMapping
virtual label sizeBeforeMapping() const
Return size before mapping.
Definition: cellMapper.C:384
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::cellMapper::weights
virtual const scalarListList & weights() const
Return interpolaion weights.
Definition: cellMapper.C:434
Foam::cellMapper::size
virtual label size() const
Return size.
Definition: cellMapper.C:378
Foam::List< label >
Foam::UList< label >
Foam::cellMapper::insertedObjectLabels
const virtual labelList & insertedObjectLabels() const
Return list of inserted cells.
Definition: cellMapper.C:452
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:161