foamVtkMeshMaps.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) 2017 OpenCFD Ltd.
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::foamVtkMeshMaps
28 
29 Description
30  Bookkeeping for mesh subsetting and/or polyhedral cell decomposition.
31  Although the main use case is for handling vtk meshes, it is not specific
32  to VTK alone.
33 
34  The cellMap is a local-to-global lookup for normal and decomposed cells.
35  The pointMap is an optional local-to-global lookup for point ids.
36  The additional ids is typically used to store the cell-centre labels
37  for additional points of decomposed cells
38 
39 SourceFiles
40  foamVtkMeshMapsI.H
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef foamVtkMeshMaps_H
45 #define foamVtkMeshMaps_H
46 
47 #include "DynamicList.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class foamVtkMeshMaps Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class foamVtkMeshMaps
59 {
60  // Private Data
61 
62  //- Original cell ids for all cells (regular and decomposed)
63  DynamicList<label> cellMap_;
64 
65  //- Point labels for subsetted meshes
66  DynamicList<label> pointMap_;
67 
68  //- Any additional (user) labels.
69  // Eg, cell-centre labels for additional points of decomposed cells
70  DynamicList<label> additionalIds_;
71 
72 
73 public:
74 
75  // Constructors
76 
77  //- Construct null
78  inline explicit foamVtkMeshMaps(const label size = 0);
79 
80 
81  //- Destructor
82  ~foamVtkMeshMaps() = default;
83 
84 
85  // Member Functions
86 
87  // Access
88 
89  //- Original cell ids for all cells (regular and decomposed).
90  // A regular mesh comprising only primitive cell types, this will just
91  // be an identity list. However, for subsetted meshes and decomposed
92  // cells this becomes a useful means of mapping from the original mesh.
93  inline const labelList& cellMap() const;
94 
95  //- Point labels for subsetted meshes
96  inline const labelList& pointMap() const;
97 
98  //- Any additional (user) labels.
99  // Eg, cell-centre labels for additional points of decomposed cells
100  inline const labelList& additionalIds() const;
101 
102 
103  // Edit
104 
105  //- Clear
106  inline void clear();
107 
108  //- Renumber cell ids (cellMap and additionalIds) to account for
109  // subset meshes
110  void renumberCells(const labelUList& mapping);
111 
112  //- Renumber point ids (pointMap) to account for subset meshes
113  void renumberPoints(const labelUList& mapping);
114 
115 
116  //- Original cell ids for all cells (regular and decomposed).
117  // For a regular mesh comprising only primitive cell types, this
118  // will simply be an identity list. However, for subsetted meshes
119  // and decomposed cells this becomes a useful means of mapping from
120  // the original mesh.
121  inline DynamicList<label>& cellMap();
122 
123  //- Point labels for subsetted meshes
124  inline DynamicList<label>& pointMap();
125 
126  //- Any additional (user) labels.
127  // Eg, cell-centre labels for additional points of decomposed cells
129 
130 };
131 
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 } // End namespace Foam
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 #include "foamVtkMeshMapsI.H"
140 
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 
143 #endif
144 
145 // ************************************************************************* //
foamVtkMeshMapsI.H
Foam::foamVtkMeshMaps::foamVtkMeshMaps
foamVtkMeshMaps(const label size=0)
Construct null.
Definition: foamVtkMeshMapsI.H:32
Foam::foamVtkMeshMaps::cellMap
const labelList & cellMap() const
Original cell ids for all cells (regular and decomposed).
Definition: foamVtkMeshMapsI.H:51
Foam::foamVtkMeshMaps::pointMap
const labelList & pointMap() const
Point labels for subsetted meshes.
Definition: foamVtkMeshMapsI.H:65
Foam::DynamicList< label >
Foam::foamVtkMeshMaps::renumberCells
void renumberCells(const labelUList &mapping)
Renumber cell ids (cellMap and additionalIds) to account for.
Definition: foamVtkMeshMaps.C:33
Foam::foamVtkMeshMaps::renumberPoints
void renumberPoints(const labelUList &mapping)
Renumber point ids (pointMap) to account for subset meshes.
Definition: foamVtkMeshMaps.C:40
Foam::label
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:62
Foam::foamVtkMeshMaps::~foamVtkMeshMaps
~foamVtkMeshMaps()=default
Destructor.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::List< label >
Foam::UList< label >
Foam::foamVtkMeshMaps::additionalIds
const labelList & additionalIds() const
Any additional (user) labels.
Definition: foamVtkMeshMapsI.H:79
DynamicList.H
Foam::foamVtkMeshMaps::clear
void clear()
Clear.
Definition: foamVtkMeshMapsI.H:42
Foam::foamVtkMeshMaps
Bookkeeping for mesh subsetting and/or polyhedral cell decomposition. Although the main use case is f...
Definition: foamVtkMeshMaps.H:57