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 solveScalarField& psiInternal,
145  const scalarField& coeffs,
146  const direction cmpt,
147  const Pstream::commsTypes commsType
148  ) const;
149 
150  //- Update result field based on interface functionality
151  virtual void updateInterfaceMatrix
152  (
153  solveScalarField& result,
154  const bool add,
155  const solveScalarField& psiInternal,
156  const scalarField& coeffs,
157  const direction cmpt,
158  const Pstream::commsTypes commsType
159  ) const;
160 
161 
162  //- Processor interface functions
163 
164  //- Return communicator used for comms
165  virtual label comm() const
166  {
167  return procInterface_.comm();
168  }
169 
170  //- Return processor number
171  virtual int myProcNo() const
172  {
173  return procInterface_.myProcNo();
174  }
175 
176  //- Return neighbour processor number
177  virtual int neighbProcNo() const
178  {
179  return procInterface_.neighbProcNo();
180  }
181 
182  //- Does the interface field perform the transformation
183  virtual bool doTransform() const
184  {
185  return doTransform_;
186  }
187 
188  //- Return face transformation tensor
189  virtual const tensorField& forwardT() const
190  {
191  return procInterface_.forwardT();
192  }
193 
194  //- Return rank of component for transform
195  virtual int rank() const
196  {
197  return rank_;
198  }
199 };
200 
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 } // End namespace Foam
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 #endif
209 
210 // ************************************************************************* //
Foam::calculatedProcessorGAMGInterface::comm
virtual label comm() const
Processor interface functions.
Definition: calculatedProcessorGAMGInterface.H:155
Foam::calculatedProcessorGAMGInterfaceField::doTransform
virtual bool doTransform() const
Does the interface field perform the transformation.
Definition: calculatedProcessorGAMGInterfaceField.H:182
Foam::calculatedProcessorGAMGInterfaceField::forwardT
virtual const tensorField & forwardT() const
Return face transformation tensor.
Definition: calculatedProcessorGAMGInterfaceField.H:188
Foam::GAMGInterface::size
virtual label size() const
Return size.
Definition: GAMGInterface.H:207
Foam::calculatedProcessorGAMGInterfaceField::myProcNo
virtual int myProcNo() const
Return processor number.
Definition: calculatedProcessorGAMGInterfaceField.H:170
Foam::calculatedProcessorGAMGInterface
GAMG agglomerated processor interface.
Definition: calculatedProcessorGAMGInterface.H:51
Foam::calculatedProcessorGAMGInterfaceField::comm
virtual label comm() const
Processor interface functions.
Definition: calculatedProcessorGAMGInterfaceField.H:164
Foam::calculatedProcessorGAMGInterfaceField::rank
virtual int rank() const
Return rank of component for transform.
Definition: calculatedProcessorGAMGInterfaceField.H:194
processorLduInterfaceField.H
calculatedProcessorGAMGInterface.H
Foam::calculatedProcessorGAMGInterface::forwardT
virtual const tensorField & forwardT() const
Return face transformation tensor.
Definition: calculatedProcessorGAMGInterface.H:173
Foam::Field< solveScalar >
Foam::GAMGInterface
Abstract base class for GAMG agglomerated interfaces.
Definition: GAMGInterface.H:53
Foam::calculatedProcessorGAMGInterfaceField::~calculatedProcessorGAMGInterfaceField
virtual ~calculatedProcessorGAMGInterfaceField()=default
Destructor.
Foam::calculatedProcessorGAMGInterface::myProcNo
virtual int myProcNo() const
Return processor number (rank in communicator)
Definition: calculatedProcessorGAMGInterface.H:161
Foam::GAMGInterfaceField
Abstract base class for GAMG agglomerated interface fields.
Definition: GAMGInterfaceField.H:53
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:176
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:167
Foam::calculatedProcessorGAMGInterfaceField
GAMG agglomerated processor interface field.
Definition: calculatedProcessorGAMGInterfaceField.H:52
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::calculatedProcessorGAMGInterfaceField::updateInterfaceMatrix
virtual void updateInterfaceMatrix(solveScalarField &result, const bool add, const solveScalarField &psiInternal, const scalarField &coeffs, const direction cmpt, const Pstream::commsTypes commsType) const
Update result field based on interface functionality.
Definition: calculatedProcessorGAMGInterfaceField.C:144
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
Foam::processorLduInterfaceField
Abstract base class for processor coupled interfaces.
Definition: processorLduInterfaceField.H:52
Foam::calculatedProcessorGAMGInterfaceField::initInterfaceMatrixUpdate
virtual void initInterfaceMatrixUpdate(solveScalarField &result, const bool add, const solveScalarField &psiInternal, const scalarField &coeffs, const direction cmpt, const Pstream::commsTypes commsType) const
Initialise neighbour matrix update.
Definition: calculatedProcessorGAMGInterfaceField.C:92