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-2020 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 foamVtkMeshMaps_H
46 #define foamVtkMeshMaps_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 size
79  inline foamVtkMeshMaps();
80 
81  //- Construct with reserved size
82  inline explicit foamVtkMeshMaps(const label size);
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  //- Write access to original cell ids
96  inline DynamicList<label>& cellMap();
97 
98  //- Point labels for subsetted meshes
99  inline const labelList& pointMap() const;
100 
101  //- Write access to point labels for subsetted meshes
102  inline DynamicList<label>& pointMap();
103 
104  //- Any additional (user) labels.
105  // Eg, cell-centre labels for additional points of decomposed cells
106  inline const labelList& additionalIds() const;
107 
108  //- Write access to additional (user) labels.
110 
111 
112  // Edit
113 
114  //- Clear sizing
115  inline void clear();
116 
117  //- Renumber cell ids (cellMap and additionalIds) to account for
118  // subset meshes
119  void renumberCells(const labelUList& mapping);
120 
121  //- Renumber point ids (pointMap) to account for subset meshes
122  void renumberPoints(const labelUList& mapping);
123 };
124 
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 } // End namespace Foam
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 #include "foamVtkMeshMapsI.H"
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 #endif
137 
138 // ************************************************************************* //
foamVtkMeshMapsI.H
Foam::foamVtkMeshMaps::foamVtkMeshMaps
foamVtkMeshMaps()
Default construct: zero-sized, no reserved size.
Definition: foamVtkMeshMapsI.H:32
Foam::foamVtkMeshMaps::cellMap
const labelList & cellMap() const
Original cell ids for all cells (regular and decomposed).
Definition: foamVtkMeshMapsI.H:59
Foam::foamVtkMeshMaps::pointMap
const labelList & pointMap() const
Point labels for subsetted meshes.
Definition: foamVtkMeshMapsI.H:73
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
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:87
DynamicList.H
Foam::foamVtkMeshMaps::clear
void clear()
Clear sizing.
Definition: foamVtkMeshMapsI.H:50
Foam::foamVtkMeshMaps
Bookkeeping for mesh subsetting and/or polyhedral cell decomposition. Although the main use case is f...
Definition: foamVtkMeshMaps.H:58