lduPrimitiveProcessorInterface.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 OpenFOAM Foundation
9  Copyright (C) 2019-2022 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::lduPrimitiveProcessorInterface
29 
30 Description
31  Concrete implementation of processor interface. Used to temporarily store
32  settings.
33 
34 SourceFiles
35  lduPrimitiveProcessorInterface.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef Foam_lduPrimitiveProcessorInterface_H
40 #define Foam_lduPrimitiveProcessorInterface_H
41 
42 #include "GAMGInterface.H"
43 #include "processorLduInterface.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class lduPrimitiveProcessorInterface Declaration
52 \*---------------------------------------------------------------------------*/
53 
55 :
56  public lduInterface,
58 {
59  // Private Data
60 
61  //- Addressing
62  const labelList faceCells_;
63 
64  //- My processor rank in communicator
65  label myProcNo_;
66 
67  //- Neighbouring processor rank in communicator
68  label neighbProcNo_;
69 
70  //- Transformation tensor
71  tensorField forwardT_;
72 
73  //- Message tag used for sending
74  int tag_;
75 
76  //- Communicator to use for parallel communication
77  const label comm_;
78 
79 
80 public:
81 
82  //- Runtime type information
83  TypeNameNoDebug("processorInterface");
84 
85 
86  // Generated Methods
87 
88  //- No copy assignment
89  void operator=(const lduPrimitiveProcessorInterface&) = delete;
90 
91 
92  // Constructors
93 
94  //- Construct from components
96  (
97  const labelUList& faceCells,
98  const label myProcNo,
99  const label neighbProcNo,
100  const tensorField& forwardT,
101  const int tag,
102  const label comm = UPstream::worldComm
103  );
104 
105  //- Copy constructor
107  (
109  );
110 
111 
112  //- Destructor
113  virtual ~lduPrimitiveProcessorInterface() = default;
114 
115 
116  // Member Functions
117 
118  // Access
119 
120  //- Return faceCell addressing
121  virtual const labelUList& faceCells() const
122  {
123  return faceCells_;
124  }
125 
126 
127  // Interface transfer functions
128 
129  //- Return the values of the given internal data adjacent to
130  //- the interface as a field
132  (
133  const labelUList& internalData
134  ) const;
135 
136  //- Return the values of the given internal data adjacent to
137  //- the interface as a field using faceCells mapping
139  (
140  const labelUList& internalData,
141  const labelUList& faceCells
142  ) const;
143 
144  //- Initialise neighbour field transfer
145  virtual void initInternalFieldTransfer
146  (
147  const Pstream::commsTypes commsType,
148  const labelUList& iF
149  ) const;
150 
151  //- Initialise neighbour field transfer using faceCells
152  virtual void initInternalFieldTransfer
153  (
154  const Pstream::commsTypes commsType,
155  const labelUList& iF,
156  const labelUList& faceCells
157  ) const;
158 
159  //- Transfer and return internal field adjacent to the interface
161  (
162  const Pstream::commsTypes commsType,
163  const labelUList& iF
164  ) const;
165 
166 
167  // Processor interface functions
168 
169  //- Return communicator used for sending
170  virtual label comm() const
171  {
172  return comm_;
173  }
174 
175  //- Return processor number (rank in communicator)
176  virtual int myProcNo() const
177  {
178  return myProcNo_;
179  }
180 
181  //- Return neighbour processor number (rank in communicator)
182  virtual int neighbProcNo() const
183  {
184  return neighbProcNo_;
185  }
186 
187  //- Return face transformation tensor
188  virtual const tensorField& forwardT() const
189  {
190  return forwardT_;
191  }
192 
193  //- Return message tag used for sending
194  virtual int tag() const
195  {
196  return tag_;
197  }
198 
199 
200  // Edit
202  //- Message tag used for sending (modifiable)
203  int& tag()
204  {
205  return tag_;
206  }
207 };
208 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 } // End namespace Foam
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 #endif
218 // ************************************************************************* //
virtual label comm() const
Return communicator used for sending.
virtual int myProcNo() const
Return processor number (rank in communicator)
virtual const tensorField & forwardT() const
Return face transformation tensor.
virtual const labelUList & faceCells() const
Return faceCell addressing.
commsTypes
Communications types.
Definition: UPstream.H:72
virtual ~lduPrimitiveProcessorInterface()=default
Destructor.
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:52
static label worldComm
Communicator for all ranks. May differ from commGlobal() if local worlds are in use.
Definition: UPstream.H:409
virtual int neighbProcNo() const
Return neighbour processor number (rank in communicator)
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Return the values of the given internal data adjacent to the interface as a field.
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Initialise neighbour field transfer.
An abstract base class for processor coupled interfaces.
Concrete implementation of processor interface. Used to temporarily store settings.
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches...
Definition: lduInterface.H:53
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Transfer and return internal field adjacent to the interface.
void operator=(const lduPrimitiveProcessorInterface &)=delete
No copy assignment.
TypeNameNoDebug("processorInterface")
Runtime type information.
virtual int tag() const
Return message tag used for sending.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
lduPrimitiveProcessorInterface(const labelUList &faceCells, const label myProcNo, const label neighbProcNo, const tensorField &forwardT, const int tag, const label comm=UPstream::worldComm)
Construct from components.
Namespace for OpenFOAM.