procLduInterface.C
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-2015 OpenFOAM Foundation
9  Copyright (C) 2024 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 \*---------------------------------------------------------------------------*/
28 
29 #include "procLduInterface.H"
31 #include "cyclicLduInterface.H"
32 #include "processorLduInterface.H"
33 
34 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35 
37 (
39  const scalarField& coeffs
40 )
41 :
42  faceCells_(interface.interface().faceCells()),
43  coeffs_(coeffs),
44  myProcNo_(-1),
45  neighbProcNo_(-1),
46  tag_(-1),
47  comm_(-1)
48 {
49  if (isA<processorLduInterface>(interface.interface()))
50  {
51  const processorLduInterface& pldui =
52  refCast<const processorLduInterface>(interface.interface());
53 
54  myProcNo_ = pldui.myProcNo();
55  neighbProcNo_ = pldui.neighbProcNo();
56  tag_ = pldui.tag();
57  comm_ = pldui.comm();
58  }
59  else if (isA<cyclicLduInterface>(interface.interface()))
60  {
61  }
62  else
63  {
65  << "Unknown lduInterface type "
66  << interface.interface().type()
67  << exit(FatalError);
68  }
69 }
70 
71 
73 {
74  read(is);
75 }
76 
77 
78 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
79 
81 {
82  is >> faceCells_
83  >> coeffs_
84  >> myProcNo_
85  >> neighbProcNo_
86  >> tag_
87  >> comm_;
88 }
89 
90 
92 {
93  os << faceCells_
94  << coeffs_
95  << myProcNo_
96  << neighbProcNo_
97  << tag_
98  << comm_;
99 }
100 
101 
102 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
103 
105 {
106  intf.read(is);
107  return is;
108 }
109 
110 
111 Foam::Ostream& Foam::operator<<(Ostream& os, const procLduInterface& intf)
112 {
113  intf.write(os);
114  return os;
115 }
116 
117 
118 // ************************************************************************* //
IO interface for processorLduInterface.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
error FatalError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL ERROR&#39; header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:608
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
interfaceProperties interface(alpha1, U, thermo->transportPropertiesDict())
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:52
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
bool read(const char *buf, int32_t &val)
Same as readInt32.
Definition: int32.H:127
Istream & operator>>(Istream &, directionInfo &)
void write(Ostream &os) const
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
virtual label comm() const =0
Return communicator used for parallel communication.
virtual int tag() const =0
Return message tag used for sending.
procLduInterface(const procLduInterface &)=delete
No copy construct.
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)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:77
virtual int neighbProcNo() const =0
Return neighbour processor number (rank in communicator)
virtual int myProcNo() const =0
Return processor number (rank in communicator)
void read(Istream &is)