1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
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
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 \*---------------------------------------------------------------------------*/
26 #include "ensightParticlePositions.H"
28 #include "passiveParticle.H"
36 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
38 void ensightParticlePositions
41 const fileName& postProcPath,
43 const word& cloudName,
49 Info<< "Converting cloud " << cloudName << " positions" << endl;
53 Info<< "Creating empty cloud " << cloudName << " positions" << endl;
56 const Time& runTime = mesh.time();
58 fileName ensightFileName(timeFile + "." + cloudName);
61 postProcPath/ensightFileName,
62 runTime.writeFormat(),
63 runTime.writeVersion(),
64 runTime.writeCompression()
69 << cloudName.c_str() << nl
70 << "particle coordinates" << nl;
74 Cloud<passiveParticle> parcels(mesh, cloudName, false);
77 ensightFile.setf(ios_base::scientific, ios_base::floatfield);
78 ensightFile.precision(5);
80 ensightFile<< setw(8) << parcels.size() << nl;
85 forAllConstIter(Cloud<passiveParticle>, parcels, elmnt)
87 const vector& p = elmnt().position();
90 << setw(8) << ++nParcels
91 << setw(12) << p.x() << setw(12) << p.y() << setw(12) << p.z()
98 ensightFile<< setw(8) << nParcels << nl;
103 // ************************************************************************* //