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