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 lduPrimitiveProcessorInterface_H
40 #define 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  const labelList faceCells_;
62 
63  //- My processor rank in communicator
64  label myProcNo_;
65 
66  //- Neighbouring processor rank in communicator
67  label neighbProcNo_;
68 
69  //- Transformation tensor
70  tensorField forwardT_;
71 
72  //- Message tag used for sending
73  int tag_;
74 
75  //- Communicator to use for parallel communication
76  const label comm_;
77 
78 
79  // Private Member Functions
80 
81 
82  //- No copy assignment
83  void operator=(const lduPrimitiveProcessorInterface&) = delete;
84 
85 
86 public:
87 
88  //- Runtime type information
89  TypeName("calculatedProcessor");
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  //- Destructor
112  virtual ~lduPrimitiveProcessorInterface() = default;
113 
114 
115  // Member Functions
116 
117  // Access
118 
119  //- Return faceCell addressing
120  virtual const labelUList& faceCells() const
121  {
122  return faceCells_;
123  }
124 
125 
126  // Interface transfer functions
127 
128  //- Return the values of the given internal data adjacent to
129  //- the interface as a field
131  (
132  const labelUList& internalData
133  ) const;
134 
135  //- Return the values of the given internal data adjacent to
136  //- the interface as a field using faceCells mapping
138  (
139  const labelUList& internalData,
140  const labelUList& faceCells
141  ) const;
142 
143  //- Initialise neighbour field transfer
144  virtual void initInternalFieldTransfer
145  (
146  const Pstream::commsTypes commsType,
147  const labelUList& iF
148  ) const;
149 
150  //- Initialise neighbour field transfer using faceCells
151  virtual void initInternalFieldTransfer
152  (
153  const Pstream::commsTypes commsType,
154  const labelUList& iF,
155  const labelUList& faceCells
156  ) const;
157 
158  //- Transfer and return internal field adjacent to the interface
160  (
161  const Pstream::commsTypes commsType,
162  const labelUList& iF
163  ) const;
164 
165 
166  // Processor interface functions
167 
168  //- Return communicator used for sending
169  virtual label comm() const
170  {
171  return comm_;
172  }
173 
174  //- Return processor number (rank in communicator)
175  virtual int myProcNo() const
176  {
177  return myProcNo_;
178  }
179 
180  //- Return neighbour processor number (rank in communicator)
181  virtual int neighbProcNo() const
182  {
183  return neighbProcNo_;
184  }
185 
186  //- Return face transformation tensor
187  virtual const tensorField& forwardT() const
188  {
189  return forwardT_;
190  }
191 
192  //- Return message tag used for sending
193  virtual int tag() const
194  {
195  return tag_;
196  }
197 
199  // Edit
200 
201  //- Return message tag used for sending
202  int& tag()
203  {
204  return tag_;
205  }
206 };
207 
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 } // End namespace Foam
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 #endif
216 
217 // ************************************************************************* //
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
Types of communications.
Definition: UPstream.H:66
virtual ~lduPrimitiveProcessorInterface()=default
Destructor.
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:52
static label worldComm
Default world communicator (all processors). May differ from globalComm if local worlds are in use...
Definition: UPstream.H:361
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.
TypeName("calculatedProcessor")
Runtime type information.
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.
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.