cellEdgeAddressing.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::cellEdgeAddressingData
26  Foam::cellEdgeAddressing
27  Foam::cellEdgeAddressingList
28 
29 Description
30  Engine for providing cell-local cell-edge to face-edge addressing
31 
32 SourceFiles
33  cellEdgeAddressing.C
34  cellEdgeAddressingI.H
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef cellEdgeAddressing_H
39 #define cellEdgeAddressing_H
40 
41 #include "DemandDrivenMeshObject.H"
42 #include "polyMesh.H"
43 #include "CompactListList.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 class polyDistributionMap;
51 class polyTopoChangeMap;
52 class polyMeshMap;
53 class cellEdgeAddressingList;
54 
55 /*---------------------------------------------------------------------------*\
56  Class cellEdgeAddressingData Declaration
57 \*---------------------------------------------------------------------------*/
58 
60 {
61 private:
62 
63  // Private Data
64 
65  //- Map from cell-face-index and face-edge-index to cell-edge-index
66  CompactListList<label> cfiAndFeiToCei_;
67 
68  //- Map from cell-edge-index to cell-face-index and face-edge-index.
69  // Note that there are two sets of indices for each cell-edge,
70  // corresponding to the two faces that are connected to that edge.
71  List<Pair<labelPair>> ceiToCfiAndFei_;
72 
73  //- For each cell-face, whether or not the cell owns it. The same as
74  // the concept of owner in the polyMesh, except this is calculated
75  // using the direction of the face-edges. I.e., if the first face is
76  // know to be "owned" by the face then any face that is edge connected
77  // to the first face is also owned by the cell if the connecting
78  // face-edge is numbered in an opposing direction.
79  boolList cOwns_;
80 
81 
82 public:
83 
84  // Constructors
85 
86  //- Construct from a cell and its faces
88  (
89  const cell& c,
90  const faceList& fs,
91  const bool cOwnsFirst
92  );
93 
94 
95  // Member Functions
96 
97  //- Map from cell-face-index and face-edge-index to cell-edge-index
98  inline const CompactListList<label>& cfiAndFeiToCei() const;
99 
100  //- Map from cell-edge-index to cell-face-index and face-edge-index
101  inline const List<Pair<labelPair>>& ceiToCfiAndFei() const;
102 
103  //- For each cell-face, whether or not the cell owns it
104  inline const boolList& cOwns() const;
105 };
106 
107 
108 /*---------------------------------------------------------------------------*\
109  Class cellEdgeAddressing Declaration
110 \*---------------------------------------------------------------------------*/
111 
112 class cellEdgeAddressing
113 {
114 private:
115 
116  // Private Data
117 
118  //- The cell edge addressing list
119  const cellEdgeAddressingList& cAddrs_;
120 
121  //- The cell index
122  const label celli_;
123 
124 
125 public:
126 
127  // Constructors
128 
129  //- Construct from the cell edge addressing list and a cell index
130  inline cellEdgeAddressing
131  (
132  const cellEdgeAddressingList& cAddrs,
133  const label celli
134  );
135 
136 
137  // Member Functions
138 
139  //- Map from cell-face-index and face-edge-index to cell-edge-index
140  inline const CompactListList<label>& cfiAndFeiToCei() const;
141 
142  //- Map from cell-edge-index to cell-face-index and face-edge-index
143  inline const List<Pair<labelPair>>& ceiToCfiAndFei() const;
144 
145  //- For each cell-face, whether or not the cell owns it
146  inline const boolList& cOwns() const;
147 };
148 
149 
150 /*---------------------------------------------------------------------------*\
151  Class cellEdgeAddressingList Declaration
152 \*---------------------------------------------------------------------------*/
153 
155 :
157  <
158  polyMesh,
159  TopoChangeableMeshObject,
160  cellEdgeAddressingList
161  >
162 {
163  // Private Data
164 
165  //- Edge addressing for each cell
166  mutable PtrList<cellEdgeAddressingData> list_;
167 
168 
169 protected:
170 
171  friend class DemandDrivenMeshObject
172  <
173  polyMesh,
176  >;
177 
178  // Protected Constructors
179 
180  //- Construct for a mesh
182 
183 
184 public:
185 
186  // Member Functions
187 
188  //- Update following mesh motion
189  virtual bool movePoints();
190 
191  //- Update following mesh distribution
192  virtual void distribute(const polyDistributionMap& map);
193 
194  //- Update following topology change
195  virtual void topoChange(const polyTopoChangeMap& map);
196 
197  //- Update following mapping
198  virtual void mapMesh(const polyMeshMap& map);
199 
200 
201  // Member Operators
202 
203  //- Get the addressing data for a given cell
204  const cellEdgeAddressingData& data(const label celli) const;
205 
206  //- Get the addressing for a given cell
207  inline const cellEdgeAddressing operator[](const label celli) const;
208 };
209 
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 } // End namespace Foam
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #include "cellEdgeAddressingI.H"
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #endif
222 
223 // ************************************************************************* //
Templated abstract base-class for demand-driven mesh objects used to automate their allocation to the...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
Engine for providing cell-local cell-edge to face-edge addressing.
const List< Pair< labelPair > > & ceiToCfiAndFei() const
Map from cell-edge-index to cell-face-index and face-edge-index.
const boolList & cOwns() const
For each cell-face, whether or not the cell owns it.
const CompactListList< label > & cfiAndFeiToCei() const
Map from cell-face-index and face-edge-index to cell-edge-index.
cellEdgeAddressingData(const cell &c, const faceList &fs, const bool cOwnsFirst)
Construct from a cell and its faces.
virtual bool movePoints()
Update following mesh motion.
cellEdgeAddressingList(const polyMesh &mesh)
Construct for a mesh.
const cellEdgeAddressing operator[](const label celli) const
Get the addressing for a given cell.
virtual void mapMesh(const polyMeshMap &map)
Update following mapping.
const cellEdgeAddressingData & data(const label celli) const
Get the addressing data for a given cell.
virtual void distribute(const polyDistributionMap &map)
Update following mesh distribution.
virtual void topoChange(const polyTopoChangeMap &map)
Update following topology change.
const List< Pair< labelPair > > & ceiToCfiAndFei() const
Map from cell-edge-index to cell-face-index and face-edge-index.
const boolList & cOwns() const
For each cell-face, whether or not the cell owns it.
const CompactListList< label > & cfiAndFeiToCei() const
Map from cell-face-index and face-edge-index to cell-edge-index.
cellEdgeAddressing(const cellEdgeAddressingList &cAddrs, const label celli)
Construct from the cell edge addressing list and a cell index.
A cell is defined as a list of faces with extra functionality.
Definition: cell.H:60
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const dimensionedScalar c
Speed of light in a vacuum.
Namespace for OpenFOAM.
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:59