processorGAMGInterface.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-2014 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::processorGAMGInterface
29 
30 Description
31  GAMG agglomerated processor interface.
32 
33 SourceFiles
34  processorGAMGInterface.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef processorGAMGInterface_H
39 #define processorGAMGInterface_H
40 
41 #include "GAMGInterface.H"
42 #include "processorLduInterface.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class processorGAMGInterface Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 :
55  public GAMGInterface,
57 {
58  // Private data
59 
60  //- Communicator to use for parallel communication
61  const label comm_;
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 
76  // Private Member Functions
77 
78  //- No copy construct
80 
81  //- No copy assignment
82  void operator=(const processorGAMGInterface&) = delete;
83 
84 
85 public:
86 
87  //- Runtime type information
88  TypeName("processor");
89 
90  // Constructors
91 
92  //- Construct from fine-level interface,
93  //- local and neighbour restrict addressing
95  (
96  const label index,
98  const lduInterface& fineInterface,
99  const labelField& restrictAddressing,
100  const labelField& neighbourRestrictAddressing,
101  const label fineLevelIndex,
102  const label coarseComm
103  );
104 
105  //- Construct from components
107  (
108  const label index,
110  const labelUList& faceCells,
111  const labelUList& faceRestrictAddresssing,
112  const label coarseComm,
113  const label myProcNo,
114  const label neighbProcNo,
115  const tensorField& forwardT,
116  const int tag
117  );
118 
119  //- Construct from Istream
121  (
122  const label index,
124  Istream& is
125  );
126 
127 
128  //- Destructor
129  virtual ~processorGAMGInterface() = default;
130 
131 
132  // Member Functions
133 
134  // Interface transfer functions
135 
136  //- Initialise neighbour field transfer
137  virtual void initInternalFieldTransfer
138  (
139  const Pstream::commsTypes commsType,
140  const labelUList& iF
141  ) const;
142 
143 
144  //- Initialise neighbour field transfer using faceCells mapping
145  virtual void initInternalFieldTransfer
146  (
147  const Pstream::commsTypes commsType,
148  const labelUList& iF,
149  const labelUList& faceCells
150  ) const;
151 
152  //- Transfer and return internal field adjacent to the interface
154  (
155  const Pstream::commsTypes commsType,
156  const labelUList& iF
157  ) const;
158 
159 
160  //- Processor interface functions
161 
162  //- Return communicator used for sending
163  virtual label comm() const
164  {
165  return comm_;
166  }
167 
168  //- Return processor number (rank in communicator)
169  virtual int myProcNo() const
170  {
171  return myProcNo_;
172  }
173 
174  //- Return neighbour processor number (rank in communicator)
175  virtual int neighbProcNo() const
176  {
177  return neighbProcNo_;
178  }
179 
180  //- Return face transformation tensor
181  virtual const tensorField& forwardT() const
182  {
183  return forwardT_;
184  }
185 
186  //- Return message tag used for sending
187  virtual int tag() const
188  {
189  return tag_;
190  }
191 
193  // I/O
194 
195  //- Write to stream
196  virtual void write(Ostream& os) const;
197 };
198 
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 } // End namespace Foam
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #endif
207 
208 // ************************************************************************* //
virtual const tensorField & forwardT() const
Return face transformation tensor.
commsTypes
Communications types.
Definition: UPstream.H:72
virtual label index() const
virtual int tag() const
Return message tag used for sending.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
virtual int myProcNo() const
Return processor number (rank in communicator)
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:52
TypeName("processor")
Runtime type information.
virtual void write(Ostream &os) const
Write to stream.
virtual int neighbProcNo() const
Return neighbour processor number (rank in communicator)
virtual ~processorGAMGInterface()=default
Destructor.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
An abstract base class for processor coupled interfaces.
OBJstream os(runTime.globalPath()/outputName)
GAMG agglomerated processor interface.
virtual label comm() const
Processor interface functions.
Abstract base class for GAMG agglomerated interfaces.
Definition: GAMGInterface.H:50
virtual const lduInterfacePtrsList & coarseInterfaces() const
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches...
Definition: lduInterface.H:53
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Transfer and return internal field adjacent to the interface.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Initialise neighbour field transfer.
Namespace for OpenFOAM.