faPatchData.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) 2016-2017 Wikki Ltd
9  Copyright (C) 2021-2023 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::faPatchData
29 
30 Description
31  Helper class for holding data during faPatch construction.
32  Most data members are exposed at the moment.
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef Foam_faPatchData_H
37 #define Foam_faPatchData_H
38 
39 #include "labelList.H"
40 #include "labelPair.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward Declarations
48 class faPatch;
49 class dictionary;
50 
51 /*---------------------------------------------------------------------------*\
52  Class faPatchData Declaration
53 \*---------------------------------------------------------------------------*/
54 
56 {
57 public:
58 
59  // Data Members
60 
61  word name_;
62  word type_;
63 
65  label neighPolyPatchId_;
66 
67  //- The owner/neighbour for processor patches
68  int ownerProcId_;
69  int neighProcId_;
70 
71  // Storge (temporary or otherwise) for edge labels
73 
74 
75  // Constructors
76 
77  //- Default construct
78  faPatchData();
79 
80 
81  // Member Functions
82 
83  // Opaque read-only access
84 
85  //- Return the name
86  const word& name() const noexcept;
87 
88  //- Contents transcribed into a patch dictionary,
89  //- usually including the edge labels.
90  dictionary dict(const bool withEdgeLabels = true) const;
91 
92 
93  // Other Functions
94 
95  //- Has name/type etc
96  bool good() const;
97 
98  //- Reset data
99  void clear();
100 
101  //- Clear and populate with values from finiteArea patch
102  void assign(const faPatch& fap);
103 
104  //- Set values consistent with a processor coupling
105  bool assign_coupled(int ownProci, int neiProci);
106 
107  //- True if owner/neighbour processor ids are non-equal
108  bool coupled() const noexcept
109  {
110  return (ownerProcId_ != neighProcId_);
111  }
112 
113  //- Does this side own the patch? Also true for non-coupled patches
114  bool owner() const noexcept
115  {
116  return (ownerProcId_ <= neighProcId_);
117  }
118 
119  //- Does the other side own the patch?
120  bool neighbour() const noexcept
121  {
122  return !owner();
123  }
124 
125  //- Ordered match with owner/neighbour patchPair.
126  // \return
127  // - 0: matched none
128  // - 1: matched first only (owner)
129  // - 2: matched second only (neighbour)
130  // - 3: matched both (owner/neighbour)
131  // .
132  int matchPatchPair(const labelPair& patchPair) const noexcept;
133 
134  //- Unordered comparison with owner/neighbour patchPair.
135  int comparePatchPair(const labelPair& patchPair) const noexcept;
136 };
137 
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 } // End namespace Foam
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 #endif
146 
147 // ************************************************************************* //
int matchPatchPair(const labelPair &patchPair) const noexcept
Ordered match with owner/neighbour patchPair.
Definition: faPatchData.C:130
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
int comparePatchPair(const labelPair &patchPair) const noexcept
Unordered comparison with owner/neighbour patchPair.
Definition: faPatchData.C:148
bool neighbour() const noexcept
Does the other side own the patch?
Definition: faPatchData.H:135
void clear()
Reset data.
Definition: faPatchData.C:76
const word & name() const noexcept
Return the name.
Definition: faPatchData.C:39
bool assign_coupled(int ownProci, int neiProci)
Set values consistent with a processor coupling.
Definition: faPatchData.C:111
label ownerPolyPatchId_
Definition: faPatchData.H:57
bool coupled() const noexcept
True if owner/neighbour processor ids are non-equal.
Definition: faPatchData.H:119
bool owner() const noexcept
Does this side own the patch? Also true for non-coupled patches.
Definition: faPatchData.H:127
A class for handling words, derived from Foam::string.
Definition: word.H:63
dictionary dict(const bool withEdgeLabels=true) const
Contents transcribed into a patch dictionary, usually including the edge labels.
Definition: faPatchData.C:45
labelList edgeLabels_
Definition: faPatchData.H:67
const direction noexcept
Definition: Scalar.H:258
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:72
label neighPolyPatchId_
Definition: faPatchData.H:58
faPatchData()
Default construct.
Definition: faPatchData.C:28
bool good() const
Has name/type etc.
Definition: faPatchData.C:70
Helper class for holding data during faPatch construction. Most data members are exposed at the momen...
Definition: faPatchData.H:48
Namespace for OpenFOAM.
void assign(const faPatch &fap)
Clear and populate with values from finiteArea patch.
Definition: faPatchData.C:91
int ownerProcId_
The owner/neighbour for processor patches.
Definition: faPatchData.H:63