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 "ensightCloudField.H"
34 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
37 void ensightCloudField
39 const IOobject& fieldObject,
40 const fileName& postProcPath,
42 const label timeIndex,
43 const word& cloudName,
44 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 runTime.writeFormat(),
85 runTime.writeVersion(),
86 runTime.writeCompression()
89 ensightFile<< pTraits<Type>::typeName << " values" << nl;
93 IOField<Type> vf(fieldObject);
95 ensightFile.setf(ios_base::scientific, ios_base::floatfield);
96 ensightFile.precision(5);
103 if (mag(v) < 1.0e-90)
105 v = pTraits<Type>::zero;
108 for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
110 ensightFile << setw(12) << component(v, cmpt);
111 if (++count % 6 == 0)
118 if ((count % 6 != 0) || (count==0))
126 // ************************************************************************* //