From c88d417860e6e63d0bb981d56670fbb6fe9f0607 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 19 Jul 2018 10:44:38 +0200 Subject: [PATCH] added: -vtffile and file attribute to tag allows specifying the vtf file to use --- src/SIM/SIMoptions.C | 10 ++++++++++ src/SIM/SIMoptions.h | 1 + src/SIM/SIMoutput.C | 3 +++ 3 files changed, 14 insertions(+) diff --git a/src/SIM/SIMoptions.C b/src/SIM/SIMoptions.C index 2cd5bff9..a743b5bc 100644 --- a/src/SIM/SIMoptions.C +++ b/src/SIM/SIMoptions.C @@ -147,6 +147,11 @@ bool SIMoptions::parseOutputTag (const TiXmlElement* elem) else if (!strcasecmp(elem->FirstChild()->Value(),"binary")) format = 1; } + if (utl::getAttribute(elem,"file",vtf)) { + size_t pos = vtf.find_last_of('.'); + if (pos < vtf.size()) + vtf.erase(pos); + } if (utl::getAttribute(elem,"nviz",nViz[0])) nViz[2] = nViz[1] = nViz[0]; utl::getAttribute(elem,"nu",nViz[0]); @@ -308,6 +313,11 @@ bool SIMoptions::parseOldOptions (int argc, char** argv, int& i) else // use the default output file name hdf5 = "(default)"; } + else if (!strcmp(argv[i],"-vtffile")) + { + if (i < argc-1 && argv[i+1][0] != '-') + vtf = strtok(argv[++i],"."); + } else if (!strcmp(argv[i],"-saveInc") && i < argc-1) dtSave = atof(argv[++i]); else if (!strcmp(argv[i],"-restart") && i < argc-1) diff --git a/src/SIM/SIMoptions.h b/src/SIM/SIMoptions.h index 2961c64c..164e5069 100644 --- a/src/SIM/SIMoptions.h +++ b/src/SIM/SIMoptions.h @@ -91,6 +91,7 @@ public: bool saveNorms;//!< If \e true, save element norms std::string hdf5; //!< Prefix for HDF5-file + std::string vtf; //!< Prefix for VTF file // Restart options int restartInc; //!< Number of increments between each restart output diff --git a/src/SIM/SIMoutput.C b/src/SIM/SIMoutput.C index a43eae82..5cc27bbb 100644 --- a/src/SIM/SIMoutput.C +++ b/src/SIM/SIMoutput.C @@ -274,6 +274,9 @@ bool SIMoutput::writeGlvG (int& nBlock, const char* inpFile, bool doClear) { if (myVtf) return false; + if (!opt.vtf.empty()) + inpFile = opt.vtf.c_str(); + #if HAS_VTFAPI == 2 const char* ext = ".vtfx"; #else