Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dumux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dumux-repositories
dumux
Commits
ed7024a2
Commit
ed7024a2
authored
7 years ago
by
Timo Koch
Browse files
Options
Downloads
Plain Diff
Merge branch 'cherry-pick-
035da38c
' into 'next'
Merge branch 'fix/gnuplotinterface' into 'master' See merge request
!481
parents
57025701
aa5adb16
No related branches found
No related tags found
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dumux/io/gnuplotinterface.hh
+36
-19
36 additions, 19 deletions
dumux/io/gnuplotinterface.hh
with
36 additions
and
19 deletions
dumux/io/gnuplotinterface.hh
+
36
−
19
View file @
ed7024a2
...
@@ -56,10 +56,9 @@ class GnuplotInterface
...
@@ -56,10 +56,9 @@ class GnuplotInterface
{
{
public:
public:
typedef
std
::
vector
<
std
::
string
>
StringVector
;
typedef
std
::
vector
<
std
::
string
>
StringVector
;
enum
PlotStyle
enum
class
CurveType
{
{
function
,
file
,
data
};
lines
,
points
,
linesPoints
,
impulses
,
dots
typedef
std
::
vector
<
CurveType
>
CurveTypeVector
;
};
//! \brief The constructor
//! \brief The constructor
GnuplotInterface
(
bool
persist
=
true
)
:
GnuplotInterface
(
bool
persist
=
true
)
:
...
@@ -122,13 +121,27 @@ public:
...
@@ -122,13 +121,27 @@ public:
// plot curves
// plot curves
plot
+=
"plot"
;
plot
+=
"plot"
;
for
(
unsigned
int
i
=
0
;
i
<
curveFile_
.
size
();
++
i
)
std
::
string
plotCommandForFile
(
plot
);
for
(
unsigned
int
i
=
0
;
i
<
curve_
.
size
();
++
i
)
{
{
plot
+=
+
" "
+
curveFile_
[
i
]
if
(
curveType_
[
i
]
==
CurveType
::
function
)
+
" "
+
curveOptions_
[
i
];
{
if
(
i
<
curveFile_
.
size
()
-
1
)
plot
+=
+
" "
+
curve_
[
i
]
+
" "
+
curveOptions_
[
i
];
plotCommandForFile
+=
+
" "
+
curve_
[
i
]
+
" "
+
curveOptions_
[
i
];
}
else
{
plot
+=
+
" '"
+
outputDirectory_
+
curve_
[
i
]
+
"' "
+
curveOptions_
[
i
];
plotCommandForFile
+=
+
" '"
+
curve_
[
i
]
+
"' "
+
curveOptions_
[
i
];
}
if
(
i
<
curve_
.
size
()
-
1
)
{
plot
+=
",
\\
"
;
plot
+=
",
\\
"
;
plotCommandForFile
+=
",
\\
"
;
}
plot
+=
"
\n
"
;
plot
+=
"
\n
"
;
plotCommandForFile
+=
"
\n
"
;
}
}
// live plot of the results if gnuplot is installed
// live plot of the results if gnuplot is installed
...
@@ -140,14 +153,14 @@ public:
...
@@ -140,14 +153,14 @@ public:
// create a gnuplot file if a filename is specified
// create a gnuplot file if a filename is specified
if
(
filename
.
compare
(
""
)
!=
0
)
if
(
filename
.
compare
(
""
)
!=
0
)
{
{
plot
+=
"
\n
"
;
plot
CommandForFile
+=
"
\n
"
;
plot
+=
"set term pngcairo size 800,600 "
+
linetype_
+
"
\n
"
;
plot
CommandForFile
+=
"set term pngcairo size 800,600 "
+
linetype_
+
"
\n
"
;
plot
+=
"set output
\"
"
+
filename
+
".png
\"\n
"
;
plot
CommandForFile
+=
"set output
\"
"
+
filename
+
".png
\"\n
"
;
plot
+=
"replot
\n
"
;
plot
CommandForFile
+=
"replot
\n
"
;
std
::
string
gnuplotFileName
=
outputDirectory_
+
filename
+
".gp"
;
std
::
string
gnuplotFileName
=
outputDirectory_
+
filename
+
".gp"
;
std
::
ofstream
file
;
std
::
ofstream
file
;
file
.
open
(
gnuplotFileName
);
file
.
open
(
gnuplotFileName
);
file
<<
plot
;
file
<<
plot
CommandForFile
;
file
.
close
();
file
.
close
();
}
}
}
}
...
@@ -167,13 +180,13 @@ public:
...
@@ -167,13 +180,13 @@ public:
*/
*/
void
resetPlot
()
void
resetPlot
()
{
{
curve
File
_
.
clear
();
curve_
.
clear
();
curveOptions_
.
clear
();
curveOptions_
.
clear
();
plotOptions_
=
""
;
plotOptions_
=
""
;
}
}
/*!
/*!
* \brief
Close
s gnuplot
* \brief
Open
s gnuplot
*/
*/
void
open
(
const
bool
persist
=
true
)
void
open
(
const
bool
persist
=
true
)
{
{
...
@@ -209,8 +222,9 @@ public:
...
@@ -209,8 +222,9 @@ public:
void
addFunctionToPlot
(
const
std
::
string
function
,
void
addFunctionToPlot
(
const
std
::
string
function
,
const
std
::
string
options
=
"with lines"
)
const
std
::
string
options
=
"with lines"
)
{
{
curve
File
_
.
push_back
(
function
);
curve_
.
push_back
(
function
);
curveOptions_
.
push_back
(
options
);
curveOptions_
.
push_back
(
options
);
curveType_
.
push_back
(
CurveType
::
function
);
}
}
DUNE_DEPRECATED_MSG
(
"The signature of addFileToPlot(string, string, string) has been changed to addFileToPlot(string, string)."
)
DUNE_DEPRECATED_MSG
(
"The signature of addFileToPlot(string, string, string) has been changed to addFileToPlot(string, string)."
)
...
@@ -230,8 +244,9 @@ public:
...
@@ -230,8 +244,9 @@ public:
void
addFileToPlot
(
const
std
::
string
fileName
,
void
addFileToPlot
(
const
std
::
string
fileName
,
const
std
::
string
options
=
"with lines"
)
const
std
::
string
options
=
"with lines"
)
{
{
curve
File
_
.
push_back
(
"'"
+
fileName
+
"'"
);
curve_
.
push_back
(
fileName
);
curveOptions_
.
push_back
(
options
);
curveOptions_
.
push_back
(
options
);
curveType_
.
push_back
(
CurveType
::
file
);
}
}
/*!
/*!
...
@@ -263,8 +278,9 @@ public:
...
@@ -263,8 +278,9 @@ public:
file
.
close
();
file
.
close
();
// adding file to list of plotted lines
// adding file to list of plotted lines
curve
File
_
.
push_back
(
"'"
+
fileName
+
"'"
);
curve_
.
push_back
(
fileName
);
curveOptions_
.
push_back
(
options
);
curveOptions_
.
push_back
(
options
);
curveType_
.
push_back
(
CurveType
::
data
);
}
}
/*!
/*!
...
@@ -399,8 +415,9 @@ private:
...
@@ -399,8 +415,9 @@ private:
std
::
string
outputDirectory_
;
std
::
string
outputDirectory_
;
char
datafileSeparator_
;
char
datafileSeparator_
;
std
::
string
linetype_
;
std
::
string
linetype_
;
StringVector
curve
File
_
;
StringVector
curve_
;
StringVector
curveOptions_
;
StringVector
curveOptions_
;
CurveTypeVector
curveType_
;
bool
interaction_
;
bool
interaction_
;
Scalar
xRangeMin_
;
Scalar
xRangeMin_
;
Scalar
xRangeMax_
;
Scalar
xRangeMax_
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment