Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "xmgraceSetWriter.H"
00027 #include <sampling/coordSet.H>
00028 #include <OpenFOAM/fileName.H>
00029 #include <OpenFOAM/OFstream.H>
00030
00031
00032
00033
00034 template<class Type>
00035 Foam::xmgraceSetWriter<Type>::xmgraceSetWriter()
00036 :
00037 writer<Type>()
00038 {}
00039
00040
00041
00042
00043 template<class Type>
00044 Foam::xmgraceSetWriter<Type>::~xmgraceSetWriter()
00045 {}
00046
00047
00048
00049
00050 template<class Type>
00051 Foam::fileName Foam::xmgraceSetWriter<Type>::getFileName
00052 (
00053 const coordSet& points,
00054 const wordList& valueSetNames
00055 ) const
00056 {
00057 return this->getBaseName(points, valueSetNames) + ".agr";
00058 }
00059
00060
00061 template<class Type>
00062 void Foam::xmgraceSetWriter<Type>::write
00063 (
00064 const coordSet& points,
00065 const wordList& valueSetNames,
00066 const List<const Field<Type>*>& valueSets,
00067 Ostream& os
00068 ) const
00069 {
00070 os << "@g0 on" << nl
00071 << "@with g0" << nl
00072 << "@ title \"" << points.name() << '"' << nl
00073 << "@ xaxis label " << '"' << points.axis() << '"' << nl;
00074
00075 forAll(valueSets, i)
00076 {
00077 os << "@ s" << i << " legend " << '"'
00078 << valueSetNames[i] << '"' << nl
00079 << "@target G0.S" << i << nl;
00080
00081 this->writeTable(points, *valueSets[i], os);
00082
00083 os << '&' << nl;
00084 }
00085 }
00086
00087
00088 template<class Type>
00089 void Foam::xmgraceSetWriter<Type>::write
00090 (
00091 const bool writeTracks,
00092 const PtrList<coordSet>& trackPoints,
00093 const wordList& valueSetNames,
00094 const List<List<Field<Type> > >& valueSets,
00095 Ostream& os
00096 ) const
00097 {
00098 if (valueSets.size() != valueSetNames.size())
00099 {
00100 FatalErrorIn("gnuplotSetWriter<Type>::write(..)")
00101 << "Number of variables:" << valueSetNames.size() << endl
00102 << "Number of valueSets:" << valueSets.size()
00103 << exit(FatalError);
00104 }
00105 if (trackPoints.size() > 0)
00106 {
00107 os << "@g0 on" << nl
00108 << "@with g0" << nl
00109 << "@ title \"" << trackPoints[0].name() << '"' << nl
00110 << "@ xaxis label " << '"' << trackPoints[0].axis() << '"' << nl;
00111
00112
00113 label sI = 0;
00114
00115 forAll(trackPoints, trackI)
00116 {
00117 forAll(valueSets, i)
00118 {
00119 os << "@ s" << sI << " legend " << '"'
00120 << valueSetNames[i] << "_track" << i << '"' << nl
00121 << "@target G0.S" << sI << nl;
00122 this->writeTable
00123 (
00124 trackPoints[trackI],
00125 valueSets[i][trackI],
00126 os
00127 );
00128 os << '&' << nl;
00129
00130 sI++;
00131 }
00132 }
00133 }
00134 }
00135
00136