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-2021 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  foamVtkMeshMaps.C
41  foamVtkMeshMapsI.H
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef Foam_vtk_vtkMeshMaps_H
46 #define Foam_vtk_vtkMeshMaps_H
47 
48 #include "DynamicList.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class foamVtkMeshMaps Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class foamVtkMeshMaps
60 {
61  // Private Data
62 
63  //- Original cell ids for all cells (regular and decomposed)
64  DynamicList<label> cellMap_;
65 
66  //- Point labels for subsetted meshes
67  DynamicList<label> pointMap_;
68 
69  //- Any additional (user) labels.
70  // Eg, cell-centre labels for additional points of decomposed cells
71  DynamicList<label> additionalIds_;
72 
73 
74 public:
75 
76  // Constructors
77 
78  //- Default construct: zero-sized, no reserved sizes
79  foamVtkMeshMaps() = default;
80 
81 
82  // Member Functions
83 
84  // Access
85 
86  //- Original cell ids for all cells (regular and decomposed).
87  // For regular mesh comprising only primitive cell types, this will
88  // be an identity list. However, for subsetted meshes and decomposed
89  // cells this becomes a useful means of mapping from the original mesh.
90  inline const labelList& cellMap() const noexcept;
91 
92  //- Write access to original cell ids
93  inline DynamicList<label>& cellMap() noexcept;
94 
95  //- Point labels for subsetted meshes
96  inline const labelList& pointMap() const noexcept;
97 
98  //- Write access to point labels for subsetted meshes
99  inline DynamicList<label>& pointMap() noexcept;
100 
101  //- Any additional (user) labels.
102  // Eg, cell-centre labels for additional points of decomposed cells
103  inline const labelList& additionalIds() const noexcept;
104 
105  //- Write access to additional (user) labels.
106  inline DynamicList<label>& additionalIds() noexcept;
107 
108 
109  // Edit
110 
111  //- Clear sizing
112  inline void clear();
113 
114  //- Renumber cell ids (cellMap and additionalIds) to account for
115  //- subset meshes
116  void renumberCells(const labelUList& mapping);
117 
118  //- Renumber point ids (pointMap) to account for subset meshes
119  void renumberPoints(const labelUList& mapping);
120 };
121 
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 } // End namespace Foam
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 #include "foamVtkMeshMapsI.H"
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 #endif
134 
135 // ************************************************************************* //
foamVtkMeshMapsI.H
Foam::DynamicList< label >
Foam::foamVtkMeshMaps::foamVtkMeshMaps
foamVtkMeshMaps()=default
Default construct: zero-sized, no reserved sizes.
Foam::foamVtkMeshMaps::additionalIds
const labelList & additionalIds() const noexcept
Any additional (user) labels.
Definition: foamVtkMeshMapsI.H:69
Foam::foamVtkMeshMaps::renumberCells
void renumberCells(const labelUList &mapping)
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
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::List< label >
Foam::UList< label >
DynamicList.H
Foam::foamVtkMeshMaps::clear
void clear()
Clear sizing.
Definition: foamVtkMeshMapsI.H:32
Foam::foamVtkMeshMaps::pointMap
const labelList & pointMap() const noexcept
Point labels for subsetted meshes.
Definition: foamVtkMeshMapsI.H:55
Foam::foamVtkMeshMaps
Bookkeeping for mesh subsetting and/or polyhedral cell decomposition. Although the main use case is f...
Definition: foamVtkMeshMaps.H:58
Foam::foamVtkMeshMaps::cellMap
const labelList & cellMap() const noexcept
Original cell ids for all cells (regular and decomposed).
Definition: foamVtkMeshMapsI.H:41