procLduInterface.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "procLduInterface.H"
27 #include "lduInterfaceField.H"
28 #include "cyclicLduInterface.H"
29 #include "processorLduInterface.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 Foam::procLduInterface::procLduInterface
34 (
35  const lduInterfaceField& interface,
36  const scalarField& coeffs
37 )
38 :
39  faceCells_(interface.interface().faceCells()),
40  coeffs_(coeffs),
41  myProcNo_(-1),
42  neighbProcNo_(-1),
43  tag_(-1),
44  comm_(-1)
45 {
46  if (isA<processorLduInterface>(interface.interface()))
47  {
48  const processorLduInterface& pldui =
49  refCast<const processorLduInterface>(interface.interface());
50 
51  myProcNo_ = pldui.myProcNo();
52  neighbProcNo_ = pldui.neighbProcNo();
53  tag_ = pldui.tag();
54  comm_ = pldui.comm();
55  }
56  else if (isA<cyclicLduInterface>(interface.interface()))
57  {
58  }
59  else
60  {
62  << "Unknown lduInterface type "
63  << interface.interface().type()
64  << exit(FatalError);
65  }
66 }
67 
68 
69 Foam::procLduInterface::procLduInterface(Istream& is)
70 :
71  faceCells_(is),
72  coeffs_(is),
73  myProcNo_(readLabel(is)),
74  neighbProcNo_(readLabel(is)),
75  tag_(readLabel(is)),
76  comm_(readLabel(is))
77 {}
78 
79 
80 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
81 
83 {
84  os << cldui.faceCells_
85  << cldui.coeffs_
86  << cldui.myProcNo_
87  << cldui.neighbProcNo_
88  << cldui.tag_
89  << cldui.comm_;
90 
91  return os;
92 }
93 
94 
95 // ************************************************************************* //
IO interface for processorLduInterface.
virtual const labelUList & faceCells() const =0
Return faceCell addressing.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
const lduInterface & interface() const
Return the interface.
virtual label comm() const =0
Return communicator used for parallel communication.
virtual int tag() const =0
Return message tag used for sending.
label readLabel(Istream &is)
Definition: label.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
An abstract base class for processor coupled interfaces.
Ostream & operator<<(Ostream &, const ensightPart &)
virtual int neighbProcNo() const =0
Return neighbour processor number (rank in communicator)
virtual int myProcNo() const =0
Return processor number (rank in communicator)