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 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 faPatchData_H
37 #define 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 
55 class faPatchData
56 {
57 public:
58 
59  // Data Members
60 
62  word type_;
63 
65  label neighPolyPatchId_;
66 
67  //- The owner/neighbour for processor patches
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  //- Reset data
96  void clear();
97 
98  //- Clear and populate with values from finiteArea patch
99  void assign(const faPatch& fap);
100 
101  //- Set values consistent with a processor coupling
102  bool assign_coupled(int ownProci, int neiProci);
103 
104  //- True if owner/neighbour processor ids are non-equal
105  bool coupled() const noexcept
106  {
107  return (ownerProcId_ != neighProcId_);
108  }
109 
110  //- Does this side own the patch? Also true for non-coupled patches
111  bool owner() const noexcept
112  {
113  return (ownerProcId_ <= neighProcId_);
114  }
115 
116  //- Does the other side own the patch?
117  bool neighbour() const noexcept
118  {
119  return !owner();
120  }
121 
122  //- Ordered match with owner/neighbour patchPair.
123  // \return
124  // - 0: matched none
125  // - 1: matched first only (owner)
126  // - 2: matched second only (neighbour)
127  // - 3: matched both (owner/neighbour)
128  // .
129  int matchPatchPair(const labelPair& patchPair) const noexcept;
130 
131  //- Unordered comparison with owner/neighbour patchPair.
132  int comparePatchPair(const labelPair& patchPair) const noexcept;
133 };
134 
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 } // End namespace Foam
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 #endif
143 
144 // ************************************************************************* //
Foam::faPatchData::coupled
bool coupled() const noexcept
True if owner/neighbour processor ids are non-equal.
Definition: faPatchData.H:104
Foam::faPatchData::assign
void assign(const faPatch &fap)
Clear and populate with values from finiteArea patch.
Definition: faPatchData.C:92
Foam::faPatchData::neighbour
bool neighbour() const noexcept
Does the other side own the patch?
Definition: faPatchData.H:116
Foam::faPatchData
Helper class for holding data during faPatch construction. Most data members are exposed at the momen...
Definition: faPatchData.H:54
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::faPatchData::ownerPolyPatchId_
label ownerPolyPatchId_
Definition: faPatchData.H:63
Foam::faPatchData::type_
word type_
Definition: faPatchData.H:61
Foam::faPatchData::faPatchData
faPatchData()
Default construct.
Definition: faPatchData.C:35
Foam::faPatchData::ownerProcId_
int ownerProcId_
The owner/neighbour for processor patches.
Definition: faPatchData.H:67
Foam::faPatchData::dict
dictionary dict(const bool withEdgeLabels=true) const
Definition: faPatchData.C:52
Foam::faPatchData::neighProcId_
int neighProcId_
Definition: faPatchData.H:68
Foam::faPatchData::clear
void clear()
Reset data.
Definition: faPatchData.C:77
labelList.H
Foam::faPatchData::comparePatchPair
int comparePatchPair(const labelPair &patchPair) const noexcept
Unordered comparison with owner/neighbour patchPair.
Definition: faPatchData.C:149
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::faPatchData::edgeLabels_
labelList edgeLabels_
Definition: faPatchData.H:71
Foam::faPatchData::name_
word name_
Definition: faPatchData.H:60
Foam::faPatchData::assign_coupled
bool assign_coupled(int ownProci, int neiProci)
Set values consistent with a processor coupling.
Definition: faPatchData.C:112
Foam::faPatchData::name
const word & name() const noexcept
Return the name.
Definition: faPatchData.C:46
Foam::Pair< label >
Foam::List< label >
Foam::faPatchData::matchPatchPair
int matchPatchPair(const labelPair &patchPair) const noexcept
Ordered match with owner/neighbour patchPair.
Definition: faPatchData.C:131
Foam::faPatchData::neighPolyPatchId_
label neighPolyPatchId_
Definition: faPatchData.H:64
Foam::faPatch
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:69
labelPair.H
Foam::faPatchData::owner
bool owner() const noexcept
Does this side own the patch? Also true for non-coupled patches.
Definition: faPatchData.H:110