calculatedProcessorGAMGInterfaceField.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) 2019 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::calculatedProcessorGAMGInterfaceField
28 
29 Description
30  GAMG agglomerated processor interface field.
31 
32 SourceFiles
33  calculatedProcessorGAMGInterfaceField.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef calculatedProcessorGAMGInterfaceField_H
38 #define calculatedProcessorGAMGInterfaceField_H
39 
40 #include "GAMGInterfaceField.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class calculatedProcessorGAMGInterfaceField Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 :
55  public GAMGInterfaceField,
57 {
58  // Private data
59 
60  //- Local reference cast into the processor interface
61  const calculatedProcessorGAMGInterface& procInterface_;
62 
63  //- Is the transform required
64  bool doTransform_;
65 
66  //- Rank of component for transformation
67  int rank_;
68 
69 
70  // Sending and receiving
71 
72  //- Outstanding request
73  mutable label outstandingSendRequest_;
74 
75  //- Outstanding request
76  mutable label outstandingRecvRequest_;
77 
78  //- Scalar send buffer
79  mutable solveScalarField scalarSendBuf_;
80 
81  //- Scalar receive buffer
82  mutable solveScalarField scalarReceiveBuf_;
83 
84 
85 
86  // Private Member Functions
87 
88  //- No copy construct
90  (
92  ) = delete;
93 
94  //- No copy assignment
95  void operator=(const calculatedProcessorGAMGInterfaceField&) = delete;
96 
97 
98 public:
99 
100  //- Runtime type information
101  TypeName("calculatedProcessor");
102 
103 
104  // Constructors
105 
106  //- Construct from GAMG interface and fine level interface field
108  (
109  const GAMGInterface& GAMGCp,
110  const lduInterfaceField& fineInterface
111  );
112 
113  //- Construct from GAMG interface and fine level interface field
115  (
116  const GAMGInterface& GAMGCp,
117  const bool doTransform,
118  const int rank
119  );
120 
121 
122  //- Destructor
123  virtual ~calculatedProcessorGAMGInterfaceField() = default;
124 
125 
126  // Member Functions
127 
128  // Access
129 
130  //- Return size
131  label size() const
132  {
133  return procInterface_.size();
134  }
135 
136 
137  // Interface matrix update
138 
139  //- Initialise neighbour matrix update
140  virtual void initInterfaceMatrixUpdate
141  (
142  solveScalarField& result,
143  const bool add,
144  const lduAddressing& lduAddr,
145  const label patchId,
146  const solveScalarField& psiInternal,
147  const scalarField& coeffs,
148  const direction cmpt,
149  const Pstream::commsTypes commsType
150  ) const;
151 
152  //- Update result field based on interface functionality
153  virtual void updateInterfaceMatrix
154  (
155  solveScalarField& result,
156  const bool add,
157  const lduAddressing& lduAddr,
158  const label patchId,
159  const solveScalarField& psiInternal,
160  const scalarField& coeffs,
161  const direction cmpt,
162  const Pstream::commsTypes commsType
163  ) const;
164 
165 
166  //- Processor interface functions
167 
168  //- Return communicator used for comms
169  virtual label comm() const
170  {
171  return procInterface_.comm();
172  }
173 
174  //- Return processor number
175  virtual int myProcNo() const
176  {
177  return procInterface_.myProcNo();
178  }
179 
180  //- Return neighbour processor number
181  virtual int neighbProcNo() const
182  {
183  return procInterface_.neighbProcNo();
184  }
185 
186  //- Does the interface field perform the transformation
187  virtual bool doTransform() const
188  {
189  return doTransform_;
190  }
191 
192  //- Return face transformation tensor
193  virtual const tensorField& forwardT() const
194  {
195  return procInterface_.forwardT();
196  }
197 
198  //- Return rank of component for transform
199  virtual int rank() const
200  {
201  return rank_;
202  }
203 };
204 
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 } // End namespace Foam
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 #endif
213 
214 // ************************************************************************* //
Foam::calculatedProcessorGAMGInterface::comm
virtual label comm() const
Return communicator used for sending.
Definition: calculatedProcessorGAMGInterface.H:165
Foam::calculatedProcessorGAMGInterfaceField::doTransform
virtual bool doTransform() const
Does the interface field perform the transformation.
Definition: calculatedProcessorGAMGInterfaceField.H:186
Foam::lduAddressing
The class contains the addressing required by the lduMatrix: upper, lower and losort.
Definition: lduAddressing.H:114
Foam::calculatedProcessorGAMGInterfaceField::updateInterfaceMatrix
virtual void updateInterfaceMatrix(solveScalarField &result, const bool add, const lduAddressing &lduAddr, const label patchId, const solveScalarField &psiInternal, const scalarField &coeffs, const direction cmpt, const Pstream::commsTypes commsType) const
Update result field based on interface functionality.
Definition: calculatedProcessorGAMGInterfaceField.C:146
Foam::calculatedProcessorGAMGInterfaceField::forwardT
virtual const tensorField & forwardT() const
Return face transformation tensor.
Definition: calculatedProcessorGAMGInterfaceField.H:192
Foam::GAMGInterface::size
virtual label size() const
Return size.
Definition: GAMGInterface.H:205
Foam::calculatedProcessorGAMGInterfaceField::myProcNo
virtual int myProcNo() const
Return processor number.
Definition: calculatedProcessorGAMGInterfaceField.H:174
Foam::calculatedProcessorGAMGInterface
GAMG agglomerated processor interface.
Definition: calculatedProcessorGAMGInterface.H:51
Foam::calculatedProcessorGAMGInterfaceField::comm
virtual label comm() const
Processor interface functions.
Definition: calculatedProcessorGAMGInterfaceField.H:168
Foam::calculatedProcessorGAMGInterfaceField::initInterfaceMatrixUpdate
virtual void initInterfaceMatrixUpdate(solveScalarField &result, const bool add, const lduAddressing &lduAddr, const label patchId, const solveScalarField &psiInternal, const scalarField &coeffs, const direction cmpt, const Pstream::commsTypes commsType) const
Initialise neighbour matrix update.
Definition: calculatedProcessorGAMGInterfaceField.C:92
Foam::calculatedProcessorGAMGInterfaceField::rank
virtual int rank() const
Return rank of component for transform.
Definition: calculatedProcessorGAMGInterfaceField.H:198
processorLduInterfaceField.H
calculatedProcessorGAMGInterface.H
Foam::calculatedProcessorGAMGInterface::forwardT
virtual const tensorField & forwardT() const
Return face transformation tensor.
Definition: calculatedProcessorGAMGInterface.H:183
Foam::Field< solveScalar >
Foam::GAMGInterface
Abstract base class for GAMG agglomerated interfaces.
Definition: GAMGInterface.H:54
Foam::calculatedProcessorGAMGInterfaceField::~calculatedProcessorGAMGInterfaceField
virtual ~calculatedProcessorGAMGInterfaceField()=default
Destructor.
Foam::calculatedProcessorGAMGInterface::myProcNo
virtual int myProcNo() const
Return processor number (rank in communicator)
Definition: calculatedProcessorGAMGInterface.H:171
Foam::GAMGInterfaceField
Abstract base class for GAMG agglomerated interface fields.
Definition: GAMGInterfaceField.H:54
Foam::add
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Definition: FieldFieldFunctions.C:939
GAMGInterfaceField.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::calculatedProcessorGAMGInterfaceField::neighbProcNo
virtual int neighbProcNo() const
Return neighbour processor number.
Definition: calculatedProcessorGAMGInterfaceField.H:180
Foam::lduInterfaceField
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
Definition: lduInterfaceField.H:58
Foam::calculatedProcessorGAMGInterface::neighbProcNo
virtual int neighbProcNo() const
Return neighbour processor number (rank in communicator)
Definition: calculatedProcessorGAMGInterface.H:177
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::calculatedProcessorGAMGInterfaceField
GAMG agglomerated processor interface field.
Definition: calculatedProcessorGAMGInterfaceField.H:52
Foam::calculatedProcessorGAMGInterfaceField::size
label size() const
Return size.
Definition: calculatedProcessorGAMGInterfaceField.H:130
Foam::calculatedProcessorGAMGInterfaceField::TypeName
TypeName("calculatedProcessor")
Runtime type information.
Foam::direction
uint8_t direction
Definition: direction.H:52
patchId
label patchId(-1)
Foam::processorLduInterfaceField
Abstract base class for processor coupled interfaces.
Definition: processorLduInterfaceField.H:52