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 "ensightCloudField.H"
34 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
37 void ensightCloudField
39 const Foam::IOobject& fieldObject,
40 const Foam::fileName& postProcPath,
41 const Foam::word& prepend,
42 const Foam::label timeIndex,
43 const Foam::word& cloudName,
44 Foam::Ostream& ensightCaseFile,
50 Info<< "Converting cloud " << cloudName
51 << " field " << fieldObject.name() << endl;
55 Info<< "Creating empty cloud " << cloudName
56 << " field " << fieldObject.name() << endl;
59 word timeFile = prepend + itoa(timeIndex);
61 const Time& runTime = fieldObject.time();
63 if (timeIndex == 0 && Pstream::master())
66 << pTraits<Type>::typeName << " per measured node: 1 ";
67 ensightCaseFile.width(15);
68 ensightCaseFile.setf(ios_base::left);
70 << ("c" + fieldObject.name()).c_str()
71 << (' ' + prepend + "***." + cloudName
72 + "." + fieldObject.name()).c_str()
76 fileName ensightFileName
78 timeFile + "." + cloudName +"." + fieldObject.name()
83 postProcPath/ensightFileName,
84 ios_base::out|ios_base::trunc,
85 runTime.writeFormat(),
86 runTime.writeVersion(),
87 runTime.writeCompression()
90 ensightFile<< pTraits<Type>::typeName << " values" << nl;
94 IOField<Type> vf(fieldObject);
96 ensightFile.setf(ios_base::scientific, ios_base::floatfield);
97 ensightFile.precision(5);
104 if (mag(v) < 1.0e-90)
106 v = pTraits<Type>::zero;
109 for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
111 ensightFile << setw(12) << component(v, cmpt);
112 if (++count % 6 == 0)
119 if ((count % 6 != 0) || (count==0))
127 // ************************************************************************* //