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 "xmgraceSetWriter.H"
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35 Foam::xmgraceSetWriter<Type>::xmgraceSetWriter()
41 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
44 Foam::xmgraceSetWriter<Type>::~xmgraceSetWriter()
48 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
51 Foam::fileName Foam::xmgraceSetWriter<Type>::getFileName
53 const coordSet& points,
54 const wordList& valueSetNames
57 return this->getBaseName(points, valueSetNames) + ".agr";
62 void Foam::xmgraceSetWriter<Type>::write
64 const coordSet& points,
65 const wordList& valueSetNames,
66 const List<const Field<Type>*>& valueSets,
72 << "@ title \"" << points.name() << '"' << nl
73 << "@ xaxis label " << '"' << points.axis() << '"' << nl;
77 os << "@ s" << i << " legend " << '"'
78 << valueSetNames[i] << '"' << nl
79 << "@target G0.S" << i << nl;
81 writeTable(points, *valueSets[i], os);
89 void Foam::xmgraceSetWriter<Type>::write
91 const bool writeTracks,
92 const PtrList<coordSet>& trackPoints,
93 const wordList& valueSetNames,
94 const List<List<Field<Type> > >& valueSets,
98 if (valueSets.size() != valueSetNames.size())
100 FatalErrorIn("gnuplotSetWriter<Type>::write(..)")
101 << "Number of variables:" << valueSetNames.size() << endl
102 << "Number of valueSets:" << valueSets.size()
105 if (trackPoints.size() > 0)
109 << "@ title \"" << trackPoints[0].name() << '"' << nl
110 << "@ xaxis label " << '"' << trackPoints[0].axis() << '"' << nl;
115 forAll(trackPoints, trackI)
119 os << "@ s" << sI << " legend " << '"'
120 << valueSetNames[i] << "_track" << i << '"' << nl
121 << "@target G0.S" << sI << nl;
122 writeTable(trackPoints[trackI], valueSets[i][trackI], os);
131 // ************************************************************************* //