1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "ensightParticlePositions.H"
28 #include "passiveParticle.H"
29 #include "CloudTemplate.H"
36 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
38 void ensightParticlePositions
40 const Foam::fvMesh& mesh,
41 const Foam::fileName& postProcPath,
42 const Foam::word& timeFile,
43 const Foam::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 ios_base::out|ios_base::trunc,
63 runTime.writeFormat(),
64 runTime.writeVersion(),
65 runTime.writeCompression()
70 << cloudName.c_str() << nl
71 << "particle coordinates" << nl;
75 Cloud<passiveParticle> parcels(mesh, cloudName, false);
78 ensightFile.setf(ios_base::scientific, ios_base::floatfield);
79 ensightFile.precision(5);
81 ensightFile<< setw(8) << parcels.size() << nl;
86 forAllConstIter(Cloud<passiveParticle>, parcels, elmnt)
88 const vector& p = elmnt().position();
91 << setw(8) << ++nParcels
92 << setw(12) << p.x() << setw(12) << p.y() << setw(12) << p.z()
99 ensightFile<< setw(8) << nParcels << nl;
104 // ************************************************************************* //