From 24ab7e5ff469f1cf3f92e83ae0a381ae6e709969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Sat, 25 Apr 2020 16:21:30 +0200 Subject: [PATCH] Wellgraph: Quote Names to Transparently Handle Dashes This way, the dot(1) program won't generate errors like Badly delimited number 1_ splits into two tokens when presented with a well name like 'INJE-1_N'. --- examples/wellgraph.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/wellgraph.cpp b/examples/wellgraph.cpp index 6d6227f0b..078901589 100644 --- a/examples/wellgraph.cpp +++ b/examples/wellgraph.cpp @@ -43,7 +43,7 @@ inline void createDot(const Opm::Schedule& schedule, const std::string& casename os << "// This file was written by the 'wellgraph' utility from OPM.\n"; os << "// Find the source code at github.com/OPM.\n"; os << "// Convert output to PDF with 'dot -Tpdf " << casename << ".gv > " << casename << ".pdf'\n"; - os << "strict digraph " << casename << "\n{\n"; + os << "strict digraph \"" << casename << "\"\n{\n"; const auto groupnames = schedule.groupNames(); const std::size_t last = schedule.getTimeMap().last(); // Group -> Group relations. @@ -51,9 +51,9 @@ inline void createDot(const Opm::Schedule& schedule, const std::string& casename const auto& g = schedule.getGroup(gn, last); const auto& children = g.groups(); if (!children.empty()) { - os << " " << gn << " -> {"; + os << " \"" << gn << "\" -> {"; for (const auto& child : children) { - os << ' ' << child; + os << " \"" << child << '"'; } os << " }\n"; } @@ -64,16 +64,16 @@ inline void createDot(const Opm::Schedule& schedule, const std::string& casename const auto& g = schedule.getGroup(gn, last); const auto& children = g.wells(); if (!children.empty()) { - os << " " << gn << " -> {"; + os << " \"" << gn << "\" -> {"; for (const auto& child : children) { - os << ' ' << child; + os << " \"" << child << '"'; } os << " }\n"; } } // Color wells by injector or producer. for (const auto& w : schedule.getWellsatEnd()) { - os << " " << w.name(); + os << " \"" << w.name() << '"'; if (w.isProducer() && w.isInjector()) { os << " [color=purple]\n"; } else if (w.isProducer()) {