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 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  //- No copy construct
83  (
85  ) = delete;
86 
87  //- No copy assignment
88  void operator=(const lduPrimitiveProcessorInterface&) = delete;
89 
90 
91 public:
92 
93  //- Runtime type information
94  TypeName("calculatedProcessor");
95 
96 
97  // Constructors
98 
99  //- Construct from components
101  (
102  const labelUList& faceCells,
103  const label myProcNo,
104  const label neighbProcNo,
105  const tensorField& forwardT,
106  const int tag,
107  const label comm = UPstream::worldComm
108  );
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 
198 
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 #endif
216 
217 // ************************************************************************* //
Foam::lduPrimitiveProcessorInterface
Concrete implementation of processor interface. Used to temporarily store settings.
Definition: lduPrimitiveProcessorInterface.H:53
Foam::lduPrimitiveProcessorInterface::forwardT
virtual const tensorField & forwardT() const
Return face transformation tensor.
Definition: lduPrimitiveProcessorInterface.H:186
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::lduPrimitiveProcessorInterface::comm
virtual label comm() const
Return communicator used for sending.
Definition: lduPrimitiveProcessorInterface.H:168
Foam::lduPrimitiveProcessorInterface::interfaceInternalField
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Definition: lduPrimitiveProcessorInterface.C:64
Foam::lduInterface
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches.
Definition: lduInterface.H:54
Foam::processorLduInterface
An abstract base class for processor coupled interfaces.
Definition: processorLduInterface.H:53
Foam::lduPrimitiveProcessorInterface::neighbProcNo
virtual int neighbProcNo() const
Return neighbour processor number (rank in communicator)
Definition: lduPrimitiveProcessorInterface.H:180
Foam::lduPrimitiveProcessorInterface::internalFieldTransfer
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Transfer and return internal field adjacent to the interface.
Definition: lduPrimitiveProcessorInterface.C:117
Foam::lduPrimitiveProcessorInterface::initInternalFieldTransfer
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Initialise neighbour field transfer.
Definition: lduPrimitiveProcessorInterface.C:91
Foam::lduPrimitiveProcessorInterface::tag
int & tag()
Return message tag used for sending.
Definition: lduPrimitiveProcessorInterface.H:201
processorLduInterface.H
Foam::lduPrimitiveProcessorInterface::faceCells
virtual const labelUList & faceCells() const
Return faceCell addressing.
Definition: lduPrimitiveProcessorInterface.H:119
GAMGInterface.H
Foam::Field< tensor >
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::UPstream::worldComm
static label worldComm
Default communicator (all processors)
Definition: UPstream.H:293
Foam::List< label >
Foam::UList< label >
Foam::lduPrimitiveProcessorInterface::myProcNo
virtual int myProcNo() const
Return processor number (rank in communicator)
Definition: lduPrimitiveProcessorInterface.H:174
Foam::faceCells
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:56
Foam::lduPrimitiveProcessorInterface::~lduPrimitiveProcessorInterface
virtual ~lduPrimitiveProcessorInterface()=default
Destructor.
Foam::lduPrimitiveProcessorInterface::TypeName
TypeName("calculatedProcessor")
Runtime type information.
Foam::lduPrimitiveProcessorInterface::tag
virtual int tag() const
Return message tag used for sending.
Definition: lduPrimitiveProcessorInterface.H:192