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  }
194 
195 
196  // I/O
197 
198  //- Write to stream
199  virtual void write(Ostream& os) const;
200 };
201 
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 } // End namespace Foam
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 #endif
210 
211 // ************************************************************************* //
Foam::calculatedProcessorGAMGInterface::comm
virtual label comm() const
Return communicator used for sending.
Definition: calculatedProcessorGAMGInterface.H:165
Foam::calculatedProcessorGAMGInterface::initInternalFieldTransfer
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Initialise neighbour field transfer.
Definition: calculatedProcessorGAMGInterface.C:184
Foam::calculatedProcessorGAMGInterface
GAMG agglomerated processor interface.
Definition: calculatedProcessorGAMGInterface.H:51
Foam::calculatedProcessorGAMGInterface::write
virtual void write(Ostream &os) const
Write to stream.
Definition: calculatedProcessorGAMGInterface.C:220
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::lduInterface
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches.
Definition: lduInterface.H:54
Foam::calculatedProcessorGAMGInterface::tag
virtual int tag() const
Return message tag used for sending.
Definition: calculatedProcessorGAMGInterface.H:189
Foam::processorLduInterface
An abstract base class for processor coupled interfaces.
Definition: processorLduInterface.H:53
Foam::calculatedProcessorGAMGInterface::forwardT
virtual const tensorField & forwardT() const
Return face transformation tensor.
Definition: calculatedProcessorGAMGInterface.H:183
processorLduInterface.H
GAMGInterface.H
Foam::Field< tensor >
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::GAMGInterface
Abstract base class for GAMG agglomerated interfaces.
Definition: GAMGInterface.H:54
Foam::calculatedProcessorGAMGInterface::myProcNo
virtual int myProcNo() const
Return processor number (rank in communicator)
Definition: calculatedProcessorGAMGInterface.H:171
Foam::UPtrList< const lduInterface >
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::GAMGInterface::index
virtual label index() const
Definition: GAMGInterface.H:210
Foam::calculatedProcessorGAMGInterface::neighbProcNo
virtual int neighbProcNo() const
Return neighbour processor number (rank in communicator)
Definition: calculatedProcessorGAMGInterface.H:177
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::calculatedProcessorGAMGInterface::internalFieldTransfer
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Transfer and return internal field adjacent to the interface.
Definition: calculatedProcessorGAMGInterface.C:195
Foam::calculatedProcessorGAMGInterface::~calculatedProcessorGAMGInterface
virtual ~calculatedProcessorGAMGInterface()=default
Destructor.
Foam::UList< label >
Foam::GAMGInterface::coarseInterfaces
virtual const lduInterfacePtrsList & coarseInterfaces() const
Definition: GAMGInterface.H:215
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::faceCells
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:56
Foam::calculatedProcessorGAMGInterface::TypeName
TypeName("calculatedProcessor")
Runtime type information.