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 // ************************************************************************* //
Foam::AssemblyFvPatch::faceCells
virtual const labelUList & faceCells() const
Return faceCells.
Definition: AssemblyFvPatch.H:154
cyclicFvPatch.H
Foam::AssemblyFvPatch::faceCells_
const labelList & faceCells_
Local faceCells.
Definition: AssemblyFvPatch.H:66
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::AssemblyFvPatch::AssemblyFvPatch
AssemblyFvPatch(const polyPatch &patch, const fvBoundaryMesh &bm, const labelList &nrbFaceCells, const labelList &faceCells, const label nbrPatchID, const label nonOverPatchID=-1)
Construct from components.
Definition: AssemblyFvPatch.H:85
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::fvBoundaryMesh
Foam::fvBoundaryMesh.
Definition: fvBoundaryMesh.H:57
Foam::AssemblyFvPatch::~AssemblyFvPatch
virtual ~AssemblyFvPatch()=default
Destructor.
Foam::AssemblyFvPatch::nonOverlapPatch
virtual const fvPatch & nonOverlapPatch() const
Return non-overlapping fvPatch for ACMI.
Definition: AssemblyFvPatch.H:139
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::AssemblyFvPatch
An assembly of lduMatrix that is specific inter-region coupling through mapped patches.
Definition: AssemblyFvPatch.H:54
Foam::AssemblyFvPatch::internalFieldTransfer
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
Definition: AssemblyFvPatch.H:110
Foam::AssemblyFvPatch::nonOverlapPatchID_
label nonOverlapPatchID_
Non-overlap patch ID.
Definition: AssemblyFvPatch.H:72
Foam::AssemblyFvPatch::nrbFaceCells_
const labelList & nrbFaceCells_
Nbr faceCell.
Definition: AssemblyFvPatch.H:63
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::AssemblyFvPatch::TypeName
TypeName(CyclicType::typeName_())
Runtime type information.
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::AssemblyFvPatch::neighbPatch
virtual const CyclicType & neighbPatch() const
Return nbr patch.
Definition: AssemblyFvPatch.H:145
Foam::List< label >
Foam::UList< label >
Foam::tmp::New
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
Foam::boundaryMesh
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
Definition: boundaryMesh.H:62
Foam::AssemblyFvPatch::nonOverlapPatchID
virtual label nonOverlapPatchID() const
Return non-overlap patch ID for ACMI.
Definition: AssemblyFvPatch.H:133
Foam::AssemblyFvPatch::neighbPatchID
virtual label neighbPatchID() const
Return neighbour.
Definition: AssemblyFvPatch.H:127
Foam::faceCells
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:56
Foam::AssemblyFvPatch::nbrPatchID_
label nbrPatchID_
Nbr patch ID.
Definition: AssemblyFvPatch.H:69
cyclicAMIFvPatch.H