AssemblyFvPatch.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) 2021 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::AssemblyFvPatch
28 
29 Description
30  An assembly of lduMatrix that is specific inter-region coupling
31  through mapped patches.
32 
33 SourceFiles
34  AssemblyFvPatch.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef AssemblyFvPatch_H
39 #define AssemblyFvPatch_H
40 
41 
42 #include "cyclicFvPatch.H"
43 #include "cyclicAMIFvPatch.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class AssemblyFvPatch Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 template<class CyclicType>
55 class AssemblyFvPatch
56 :
57  public CyclicType
58 {
59 protected:
60 
61  // Protected Data
62 
63  //- Nbr faceCell
64  const labelList& nrbFaceCells_;
65 
66  //- Local faceCells
67  const labelList& faceCells_;
68 
69  //- Nbr patch ID
70  label nbrPatchID_;
71 
72  //- Non-overlap patch ID
73  label nonOverlapPatchID_;
74 
75 
76 public:
77 
78  //- Runtime type information
79  TypeName(CyclicType::typeName_());
80 
81 
82  // Constructors
83 
84  //- Construct from components
86  (
87  const polyPatch& patch,
88  const fvBoundaryMesh& bm,
89  const labelList& nrbFaceCells,
90  const labelList& faceCells,
91  const label nbrPatchID,
92  const label nonOverPatchID = -1
93  )
94  :
95  CyclicType(patch, bm),
96  nrbFaceCells_(nrbFaceCells),
98  nbrPatchID_(nbrPatchID),
99  nonOverlapPatchID_(nonOverPatchID)
100  {}
101 
102 
103  //- Destructor
104  virtual ~AssemblyFvPatch() = default;
105 
106 
107  // Member Functions
108 
109  //- Return neighbour field
111  (
112  const Pstream::commsTypes commsType,
113  const labelUList& internalData
114  ) const
115  {
116  auto tpif = tmp<labelField>::New(nrbFaceCells_.size());
117  auto& pif = tpif.ref();
118 
119  forAll(pif, facei)
120  {
121  pif[facei] = internalData[nrbFaceCells_[facei]];
122  }
123 
124  return tpif;
125  }
126 
127  //- Return neighbour
128  virtual label neighbPatchID() const
129  {
130  return nbrPatchID_;
131  }
132 
133  //- Return non-overlap patch ID for ACMI
134  virtual label nonOverlapPatchID() const
135  {
136  return nonOverlapPatchID_;
137  }
138 
139  //- Return non-overlapping fvPatch for ACMI
140  virtual const fvPatch& nonOverlapPatch() const
141  {
142  return this->boundaryMesh()[nonOverlapPatchID_];
143  }
144 
145  //- Return nbr patch
146  virtual const CyclicType& neighbPatch() const
147  {
148  return refCast<const CyclicType>
149  (
150  this->boundaryMesh()[nbrPatchID_]
151  );
152  }
153 
154  //- Return faceCells
155  virtual const labelUList& faceCells() const
156  {
157  return faceCells_;
158  }
159 };
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 } // End namespace Foam
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 #define makeAssemblyFvPatch(Type) \
168  \
169  defineNamedTemplateTypeNameAndDebug(AssemblyFvPatch<Type>, 0); \
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 #endif
175 
176 // ************************************************************************* //
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:116
virtual ~AssemblyFvPatch()=default
Destructor.
AssemblyFvPatch(const polyPatch &patch, const fvBoundaryMesh &bm, const labelList &nrbFaceCells, const labelList &faceCells, const label nbrPatchID, const label nonOverPatchID=-1)
Construct from components.
virtual label nonOverlapPatchID() const
Return non-overlap patch ID for ACMI.
commsTypes
Communications types.
Definition: UPstream.H:72
const labelList & faceCells_
Local faceCells.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface...
Definition: boundaryMesh.H:58
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:52
label nbrPatchID_
Nbr patch ID.
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
const labelList & nrbFaceCells_
Nbr faceCell.
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:421
virtual const CyclicType & neighbPatch() const
Return nbr patch.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Definition: tmp.H:206
TypeName(CyclicType::typeName_())
Runtime type information.
virtual label neighbPatchID() const
Return neighbour.
virtual const fvPatch & nonOverlapPatch() const
Return non-overlapping fvPatch for ACMI.
Foam::fvBoundaryMesh.
An assembly of lduMatrix that is specific inter-region coupling through mapped patches.
virtual const labelUList & faceCells() const
Return faceCells.
const std::string patch
OpenFOAM patch number as a std::string.
label nonOverlapPatchID_
Non-overlap patch ID.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:69
Namespace for OpenFOAM.