ENH: patchCloud: return pTraits<Type>::max for unfound points
[OpenFOAM-1.7.x.git] / applications / test / parallel / parallelTest.C
blobae960f6110c7eae79207033e1d0fdd5e73ad0e8c
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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.
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.
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/>.
24 Application
25     icoFoam
27 Description
28     Incompressible laminar CFD code.
30 \*---------------------------------------------------------------------------*/
32 #include "argList.H"
33 #include "Time.H"
34 #include "IPstream.H"
35 #include "OPstream.H"
36 #include "vector.H"
37 #include "IOstreams.H"
39 using namespace Foam;
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 int main(int argc, char *argv[])
46 #   include "setRootCase.H"
47 #   include "createTime.H"
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51     Perr<< "\nStarting transfers\n" << endl;
53     vector data(0, 1, 2);
55     if (Pstream::parRun())
56     {
57         if (Pstream::myProcNo() != Pstream::masterNo())
58         {
59             {
60                 Perr<< "slave sending to master "
61                     << Pstream::masterNo() << endl;
62                 OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
63                 toMaster << data;
64             }
66             Perr<< "slave receiving from master "
67                 << Pstream::masterNo() << endl;
68             IPstream fromMaster(Pstream::scheduled, Pstream::masterNo());
69             fromMaster >> data;
71             Perr<< data << endl;
72         }
73         else
74         {
75             for
76             (
77                 int slave=Pstream::firstSlave();
78                 slave<=Pstream::lastSlave();
79                 slave++
80             )
81             {
82                 Perr << "master receiving from slave " << slave << endl;
83                 IPstream fromSlave(Pstream::scheduled, slave);
84                 fromSlave >> data;
86                 Perr<< data << endl;
87             }
89             for
90             (
91                 int slave=Pstream::firstSlave();
92                 slave<=Pstream::lastSlave();
93                 slave++
94             )
95             {
96                 Perr << "master sending to slave " << slave << endl;
97                 OPstream toSlave(Pstream::scheduled, slave);
98                 toSlave << data;
99             }
100         }
101     }
103     Info<< "End\n" << endl;
105     return 0;
109 // ************************************************************************* //