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