Skip to content
Snippets Groups Projects
Commit 12e55d7d authored by andy's avatar andy
Browse files

ENH: Added helper function to create appropriate graph name from string

parent f84900fb
Branches
Tags
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
...@@ -41,6 +41,17 @@ namespace Foam ...@@ -41,6 +41,17 @@ namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * 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) void Foam::graph::readCurves(Istream& is)
{ {
List<xy> xyData(is); List<xy> xyData(is);
...@@ -54,7 +65,11 @@ void Foam::graph::readCurves(Istream& is) ...@@ -54,7 +65,11 @@ void Foam::graph::readCurves(Istream& is)
y[i] = xyData[i].y_; 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 ...@@ -89,7 +104,7 @@ Foam::graph::graph
yName_(yName), yName_(yName),
x_(x) x_(x)
{ {
insert(yName, new curve(yName, curve::curveStyle::CONTINUOUS, y)); insert(wordify(yName), new curve(yName, curve::curveStyle::CONTINUOUS, y));
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
...@@ -263,6 +263,9 @@ public: ...@@ -263,6 +263,9 @@ public:
const word& format const word& format
) const; ) const;
//- Helper function to convert string name into appropriate word
static word wordify(const string& sname);
// Friend operators // Friend operators
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment