1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
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 "gnuplotSetWriter.H"
31 #include "addToRunTimeSelectionTable.H"
34 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 Foam::gnuplotSetWriter<Type>::gnuplotSetWriter()
42 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
45 Foam::gnuplotSetWriter<Type>::~gnuplotSetWriter()
49 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
52 Foam::fileName Foam::gnuplotSetWriter<Type>::getFileName
54 const coordSet& points,
55 const wordList& valueSetNames
58 return this->getBaseName(points, valueSetNames) + ".gplt";
63 void Foam::gnuplotSetWriter<Type>::write
65 const coordSet& points,
66 const wordList& valueSetNames,
67 const List<const Field<Type>*>& valueSets,
71 os << "set term postscript color" << nl
72 << "set output \"" << points.name() << ".ps\"" << nl
82 os << " \"-\" title \"" << valueSetNames[i] << "\" with lines";
89 writeTable(points, *valueSets[i], os);
96 void Foam::gnuplotSetWriter<Type>::write
98 const bool writeTracks,
99 const PtrList<coordSet>& trackPoints,
100 const wordList& valueSetNames,
101 const List<List<Field<Type> > >& valueSets,
105 if (valueSets.size() != valueSetNames.size())
107 FatalErrorIn("gnuplotSetWriter<Type>::write(..)")
108 << "Number of variables:" << valueSetNames.size() << endl
109 << "Number of valueSets:" << valueSets.size()
112 if (trackPoints.size() > 0)
114 os << "set term postscript color" << nl
115 << "set output \"" << trackPoints[0].name() << ".ps\"" << nl;
117 forAll(trackPoints, trackI)
128 os << " \"-\" title \"" << valueSetNames[i] << "\" with lines";
134 writeTable(trackPoints[trackI], valueSets[i][trackI], os);
142 // ************************************************************************* //