OpenMPCD
Graph.cpp
1 #include <OpenMPCD/Graph.hpp>
2 
4 
5 #include <fstream>
6 #include <limits>
7 
8 void OpenMPCD::Graph::save(const std::string& path, const bool prependGnuplotCommands) const
9 {
11 
12  std::ofstream file(path.c_str(), std::ios::trunc);
13  file.precision(std::numeric_limits<FP>::digits10 + 2);
14 
15  if(prependGnuplotCommands)
16  file<<"set terminal wxt persist\nplot '-' with linespoints notitle\n";
17 
18  for(Container::size_type i=0; i<points.size(); ++i)
19  file<<points[i].first<<"\t"<<points[i].second<<"\n";
20 }
OpenMPCD::Graph::save
void save(const std::string &path, const bool prependGnuplotCommands) const
Saves the graph data to the given file path.
Definition: Graph.cpp:8
FilesystemUtilities.hpp
OpenMPCD::FilesystemUtilities::ensureParentDirectory
static void ensureParentDirectory(const std::string &path)
Ensures that the parent directory of the path given exists.
Definition: FilesystemUtilities.cpp:18
Graph.hpp