diff --git a/src/OpenFOAM/graph/graph.C b/src/OpenFOAM/graph/graph.C index 7c59cfc2f692ce68dccd07bab5b4cfd75f51c827..0ec122dcc320c76966d7a0de5cec406ad9655231 100644 --- a/src/OpenFOAM/graph/graph.C +++ b/src/OpenFOAM/graph/graph.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,6 +41,17 @@ namespace Foam // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +Foam::word Foam::graph::wordify(const Foam::string& sname) +{ + string wname = sname; + wname.replace(' ', '_'); + wname.replace('(', '_'); + wname.replace(')', ""); + + return word(wname); +} + + void Foam::graph::readCurves(Istream& is) { List<xy> xyData(is); @@ -54,7 +65,11 @@ void Foam::graph::readCurves(Istream& is) y[i] = xyData[i].y_; } - insert(yName_, new curve(yName_, curve::curveStyle::CONTINUOUS, y)); + insert + ( + wordify(yName_), + new curve(wordify(yName_), curve::curveStyle::CONTINUOUS, y) + ); } @@ -89,7 +104,7 @@ Foam::graph::graph yName_(yName), x_(x) { - insert(yName, new curve(yName, curve::curveStyle::CONTINUOUS, y)); + insert(wordify(yName), new curve(yName, curve::curveStyle::CONTINUOUS, y)); } diff --git a/src/OpenFOAM/graph/graph.H b/src/OpenFOAM/graph/graph.H index 2a414980618710a4722f4b1683c4416b044fc5d7..b3ff00c37d5938a826bc3cc889d88622fc78ba8f 100644 --- a/src/OpenFOAM/graph/graph.H +++ b/src/OpenFOAM/graph/graph.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -263,6 +263,9 @@ public: const word& format ) const; + //- Helper function to convert string name into appropriate word + static word wordify(const string& sname); + // Friend operators