cyclicAMIGAMGInterfaceField.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) 2011-2013 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::cyclicAMIGAMGInterfaceField
29 
30 Description
31  GAMG agglomerated cyclic interface field.
32 
33 SourceFiles
34  cyclicAMIGAMGInterfaceField.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef cyclicAMIGAMGInterfaceField_H
39 #define cyclicAMIGAMGInterfaceField_H
40 
41 #include "GAMGInterfaceField.H"
42 #include "cyclicAMIGAMGInterface.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class cyclicAMIGAMGInterfaceField Declaration
52 \*---------------------------------------------------------------------------*/
53 
55 :
56  public GAMGInterfaceField,
57  virtual public cyclicAMILduInterfaceField
58 {
59  // Private data
60 
61  //- Local reference cast into the cyclic interface
62  const cyclicAMIGAMGInterface& cyclicAMIInterface_;
63 
64  //- Is the transform required
65  bool doTransform_;
66 
67  //- Rank of component for transformation
68  int rank_;
69 
70 
71  // Sending and receiving (distributed AMI)
72 
73  //- Current range of send requests (non-blocking)
74  mutable labelRange sendRequests_;
75 
76  //- Current range of recv requests (non-blocking)
77  mutable labelRange recvRequests_;
78 
79  //- Scalar send buffers
80  mutable PtrList<List<solveScalar>> scalarSendBufs_;
81 
82  //- Scalar receive buffers
83  mutable PtrList<List<solveScalar>> scalarRecvBufs_;
84 
85 
86  // Private Member Functions
87 
88  //- No copy construct
90  (
92  ) = delete;
93 
94  //- No copy assignment
95  void operator=(const cyclicAMIGAMGInterfaceField&) = delete;
96 
97 
98 public:
99 
100  //- Runtime type information
101  TypeName("cyclicAMI");
102 
103 
104  // Constructors
105 
106  //- Construct from GAMG interface and fine level interface field
108  (
109  const GAMGInterface& GAMGCp,
110  const lduInterfaceField& fineInterfaceField
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  //- Construct from GAMG interface and Istream
123  (
124  const GAMGInterface& GAMGCp,
125  Istream& is
126  );
127 
128  //- Construct from GAMG interface and local and remote fields
130  (
131  const GAMGInterface& GAMGCp,
132  const lduInterfaceField& local,
133  const UPtrList<lduInterfaceField>& other
134  );
135 
136  //- Construct by assembling and return a clone.
138  (
139  const GAMGInterface& GAMGCp,
140  const UPtrList<lduInterfaceField>& other
141  ) const
142  {
144  (
146  (
147  GAMGCp,
148  *this, // local field
149  other // other fields
150  )
151  );
152  }
153 
154 
155  //- Destructor
156  virtual ~cyclicAMIGAMGInterfaceField() = default;
157 
158 
159  // Member Functions
160 
161  // Access
162 
163  //- Return size
164  label size() const
165  {
166  return cyclicAMIInterface_.size();
167  }
168 
169 
170  // Interface matrix update
171 
172  //- Are all (receive) data available?
173  virtual bool ready() const;
174 
175  //- Initialise neighbour matrix update
176  virtual void initInterfaceMatrixUpdate
177  (
178  solveScalarField& result,
179  const bool add,
180  const lduAddressing& lduAddr,
181  const label patchId,
182  const solveScalarField& psiInternal,
183  const scalarField& coeffs,
184  const direction cmpt,
185  const Pstream::commsTypes commsType
186  ) const;
187 
188  //- Update result field based on interface functionality
189  virtual void updateInterfaceMatrix
190  (
191  solveScalarField& result,
192  const bool add,
193  const lduAddressing& lduAddr,
194  const label patchId,
195  const solveScalarField& psiInternal,
196  const scalarField& coeffs,
197  const direction cmpt,
198  const Pstream::commsTypes commsType
199  ) const;
200 
201 
202  //- Cyclic interface functions
203 
204  //- Does the interface field perform the transformation
205  virtual bool doTransform() const
206  {
207  return doTransform_;
208  }
209 
210  //- Return face transformation tensor
211  virtual const tensorField& forwardT() const
212  {
213  return cyclicAMIInterface_.forwardT();
214  }
215 
216  //- Return neighbour-cell transformation tensor
217  virtual const tensorField& reverseT() const
218  {
219  return cyclicAMIInterface_.reverseT();
220  }
221 
222  //- Return rank of component for transform
223  virtual int rank() const
224  {
225  return rank_;
226  }
227 
228 
229  // I/O
230 
231  //- Write to stream
232  virtual void write(Ostream&) const;
233 };
234 
235 
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 
238 } // End namespace Foam
239 
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 
242 #endif
243 
244 // ************************************************************************* //
virtual label size() const
Return size.
label patchId(-1)
GAMG agglomerated cyclic interface field.
uint8_t direction
Definition: direction.H:46
GAMG agglomerated cyclic AMI interface.
commsTypes
Communications types.
Definition: UPstream.H:72
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
A range or interval of labels defined by a start and a size.
Definition: labelRange.H:52
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
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.
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
TypeName("cyclicAMI")
Runtime type information.
virtual int rank() const
Return rank of component for transform.
Abstract base class for cyclic AMI coupled interfaces.
virtual autoPtr< GAMGInterfaceField > clone(const GAMGInterface &GAMGCp, const UPtrList< lduInterfaceField > &other) const
Construct by assembling and return a clone.
bool local
Definition: EEqn.H:20
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition: HashTable.H:106
virtual bool ready() const
Are all (receive) data available?
virtual const tensorField & forwardT() const
Return face transformation tensor.
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
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.
Abstract base class for GAMG agglomerated interfaces.
Definition: GAMGInterface.H:50
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Definition: List.H:55
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
Abstract base class for GAMG agglomerated interface fields.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
The class contains the addressing required by the lduMatrix: upper, lower and losort.
virtual const tensorField & forwardT() const
Return face transformation tensor.
virtual bool doTransform() const
Cyclic interface functions.
virtual void write(Ostream &) const
Write to stream.
virtual ~cyclicAMIGAMGInterfaceField()=default
Destructor.
Namespace for OpenFOAM.