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 -------------------------------------------------------------------------------
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 \*---------------------------------------------------------------------------*/
27 
28 #include "procLduInterface.H"
29 #include "lduInterfaceField.H"
30 #include "cyclicLduInterface.H"
31 #include "processorLduInterface.H"
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
35 Foam::procLduInterface::procLduInterface
36 (
38  const scalarField& coeffs
39 )
40 :
41  faceCells_(interface.interface().faceCells()),
42  coeffs_(coeffs),
43  myProcNo_(-1),
44  neighbProcNo_(-1),
45  tag_(-1),
46  comm_(-1)
47 {
48  if (isA<processorLduInterface>(interface.interface()))
49  {
50  const processorLduInterface& pldui =
51  refCast<const processorLduInterface>(interface.interface());
52 
53  myProcNo_ = pldui.myProcNo();
54  neighbProcNo_ = pldui.neighbProcNo();
55  tag_ = pldui.tag();
56  comm_ = pldui.comm();
57  }
58  else if (isA<cyclicLduInterface>(interface.interface()))
59  {
60  }
61  else
62  {
64  << "Unknown lduInterface type "
65  << interface.interface().type()
66  << exit(FatalError);
67  }
68 }
69 
70 
71 Foam::procLduInterface::procLduInterface(Istream& is)
72 :
73  faceCells_(is),
74  coeffs_(is),
75  myProcNo_(readLabel(is)),
76  neighbProcNo_(readLabel(is)),
77  tag_(readLabel(is)),
78  comm_(readLabel(is))
79 {}
80 
81 
82 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
83 
85 {
86  os << cldui.faceCells_
87  << cldui.coeffs_
88  << cldui.myProcNo_
89  << cldui.neighbProcNo_
90  << cldui.tag_
91  << cldui.comm_;
92 
93  return os;
94 }
95 
96 
97 // ************************************************************************* //
interface
interfaceProperties interface(alpha1, U, thermo->transportPropertiesDict())
Foam::processorLduInterface
An abstract base class for processor coupled interfaces.
Definition: processorLduInterface.H:53
cyclicLduInterface.H
processorLduInterface.H
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::processorLduInterface::tag
virtual int tag() const =0
Return message tag used for sending.
Foam::Field< scalar >
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::procLduInterface
IO interface for processorLduInterface.
Definition: procLduInterface.H:61
Foam::processorLduInterface::neighbProcNo
virtual int neighbProcNo() const =0
Return neighbour processor number (rank in communicator)
Foam::FatalError
error FatalError
os
OBJstream os(runTime.globalPath()/outputName)
Foam::lduInterfaceField
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
Definition: lduInterfaceField.H:58
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
procLduInterface.H
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::processorLduInterface::myProcNo
virtual int myProcNo() const =0
Return processor number (rank in communicator)
Foam::readLabel
label readLabel(const char *buf)
Parse entire buffer as a label, skipping leading/trailing whitespace.
Definition: label.H:66
lduInterfaceField.H
Foam::processorLduInterface::comm
virtual label comm() const =0
Return communicator used for parallel communication.
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56