cellEdgeAddressingI.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 \*---------------------------------------------------------------------------*/
25 
26 #include "cellEdgeAddressing.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
31 (
32  const cellEdgeAddressingList& cAddrs,
33  const label celli
34 )
35 :
36  cAddrs_(cAddrs),
37  celli_(celli)
38 {}
39 
40 
41 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
42 
45 {
46  return cfiAndFeiToCei_;
47 }
48 
49 
52 {
53  return ceiToCfiAndFei_;
54 }
55 
56 
58 {
59  return cOwns_;
60 }
61 
62 
65 {
66  return cAddrs_.data(celli_).cfiAndFeiToCei();
67 }
68 
69 
72 {
73  return cAddrs_.data(celli_).ceiToCfiAndFei();
74 }
75 
76 
78 {
79  return cAddrs_.data(celli_).cOwns();
80 }
81 
82 
83 inline const Foam::cellEdgeAddressingData&
85 {
86  if (!list_.set(celli))
87  {
88  const cell& c = mesh().cells()[celli];
89  const faceList& fs = mesh().faces();
90  const labelList& fOwners = mesh().faceOwner();
91 
92  list_.set
93  (
94  celli,
95  new cellEdgeAddressingData(c, fs, fOwners[c[0]] == celli)
96  );
97  }
98 
99  return list_[celli];
100 }
101 
102 
103 // * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
104 
105 inline const Foam::cellEdgeAddressing
107 {
108  return cellEdgeAddressing(*this, celli);
109 }
110 
111 
112 // ************************************************************************* //
A packed storage unstructured matrix of objects of type <T> using an offset table for access.
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
T * data()
Return a pointer to the first data element,.
Definition: UListI.H:149
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.
const cellEdgeAddressing operator[](const label celli) const
Get the addressing for a given cell.
const cellEdgeAddressingData & data(const label celli) const
Get the addressing data for a given cell.
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
const dimensionedScalar c
Speed of light in a vacuum.
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