|
[Sponsors] |
July 12, 2013, 12:17 |
Dynamic Ofstream Filenames
|
#1 |
Senior Member
Canakkale Dardanelspor
Join Date: Aug 2012
Posts: 135
Rep Power: 13 |
Hi
== 1 == I would like to generate numerous Code:
const scalar e.g. radius1, radius2, radius3 ... . == 2 == To this end, I tried to use the standard library. Code:
#include <string> #include <sstream> ... string fileNAme( const string& prefix, int index) // In order to name the output files dynamically. { ostringstream finalName; finalName << prefix << index; return finalName.str(); } Code:
for (int i = 0; i < 100; i++) { fileNAme( "radius", i).c_str() } I would like to re-write such a code in the OpenFOAM context. Is there anyone can suggest where I can start or how I can do this? Many thanks in advance. |
|
July 12, 2013, 12:24 |
|
#2 |
Senior Member
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 403
Rep Power: 25 |
Simple.
Code:
word fileName = "radius" for (label i = 0; i < nRadius; ++i) { word newName = fileName + name(i); } |
|
July 12, 2013, 14:05 |
|
#3 |
Senior Member
Canakkale Dardanelspor
Join Date: Aug 2012
Posts: 135
Rep Power: 13 |
Many thanks!
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Dynamic Mesh Problem. | Tom Clark | FLUENT | 10 | June 21, 2021 04:27 |
Dynamic Mesh on Pintle type injector. | herntan | FLUENT | 16 | September 4, 2020 08:27 |
Regarding Negative volume detected in Dynamic mesh | Vinay Morabad | FLUENT | 10 | December 16, 2015 00:31 |
dynamic mesh or dynamic grid adaptation?? | IndrajitW | FLUENT | 3 | May 23, 2013 03:38 |
Dynamic Mesh moving interface help | akash.iitb | FLUENT | 0 | August 23, 2010 23:53 |