From 4555737c3006934ee37521939d80c0a128d0b5a1 Mon Sep 17 00:00:00 2001
From: DennisGlaeser <dennis.glaeser@iws.uni-stuttgart.de>
Date: Tue, 5 Dec 2017 13:12:29 +0100
Subject: [PATCH] [test][components] plot only if gnuplot was found

---
 dumux/io/gnuplotinterface.hh               | 9 ++++-----
 test/material/components/plotproperties.cc | 1 +
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/dumux/io/gnuplotinterface.hh b/dumux/io/gnuplotinterface.hh
index 9b97a2b90d..94bbefd34b 100644
--- a/dumux/io/gnuplotinterface.hh
+++ b/dumux/io/gnuplotinterface.hh
@@ -141,7 +141,7 @@ public:
         }
 
         // live plot of the results if gnuplot is installed
-#ifdef HAVE_GNUPLOT
+
         std::string interactivePlot = "reset\n";
 
         // set the terminal if the defaults were overwritten
@@ -151,7 +151,6 @@ public:
         interactivePlot += plot;
         if (openPlotWindow_)
             executeGnuplot(interactivePlot.c_str());
-#endif
 
         // create a gnuplot file if a filename is specified
         if (filename.compare("") != 0)
@@ -166,11 +165,9 @@ public:
             file << filePlot;
             file.close();
 
-          // live plot of the results if gnuplot is installed
-#ifdef HAVE_GNUPLOT
+          // live plot of the results
           if (createImage_)
               executeGnuplot(filePlot.c_str());
-#endif
         }
     }
 
@@ -412,8 +409,10 @@ private:
     // Give plot command to gnuplot
     void executeGnuplot(const std::string& plotCommand) const
     {
+#ifdef HAVE_GNUPLOT
         fputs((plotCommand + "\n").c_str(), pipe_);
         fflush(pipe_);
+#endif
     }
 
     // Check validity of number
diff --git a/test/material/components/plotproperties.cc b/test/material/components/plotproperties.cc
index 93f205041f..c761c9ea4a 100644
--- a/test/material/components/plotproperties.cc
+++ b/test/material/components/plotproperties.cc
@@ -166,4 +166,5 @@ int main(int argc, char *argv[])
             gnuplot.plot(Component::name() + "_" + phaseNames[phaseIdx] + "_" + propertyNames[propertyIdx]);
         }
     }
+
 }
-- 
GitLab