|
[Sponsors] | |||||
|
|
|
#1 |
|
Member
Cem Albukrek
Join Date: Mar 2009
Posts: 49
Rep Power: 4 ![]() |
Hello all,
I am trying to obtain the processor id to perform a serial file writing in a parallel simulation. Essentially, I am using ofstream as it has the append feature that OFstream does not. OFstream seams to be "parallel aware" while ofstream is not. So I would like to execute a statement like if ( processor == 0 ) { "Perform ofstream based file writing" } So how does one obtain the processor id in the OpenFOAM environment? Thanks Cem |
|
|
|
|
|
|
|
|
#2 |
|
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: http://olesenm.github.com/
Posts: 745
Rep Power: 10 ![]() |
Did you check the Pstream documentation?
I think you'll find something useful there. BTW: assuming you don't care about processor == 0 per se, but if you are on the master process - that information is in the Pstream docs as well. |
|
|
|
|
|
|
|
|
#3 |
|
Senior Member
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 253
Rep Power: 6 ![]() |
Try this:
if (Pstream::master()) { // Do work here } Hope this helps.
__________________
Sandeep Menon University of Massachusetts Amherst http://www.ecs.umass.edu/~smenon |
|
|
|
|
|
|
|
|
#4 |
|
Member
Juho Peltola
Join Date: Mar 2009
Location: Finland
Posts: 80
Rep Power: 4 ![]() |
The Doxygen Pstream documentation will also be helpful, I'm sure:
http://foam.sourceforge.net/doc/Doxy..._1Pstream.html |
|
|
|
|
|
|
|
|
#5 |
|
Member
Cem Albukrek
Join Date: Mar 2009
Posts: 49
Rep Power: 4 ![]() |
The tips helped.
Thanks a lot! Cem |
|
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| IcoFoam parallel woes | msrinath80 | OpenFOAM Running, Solving & CFD | 9 | July 22, 2007 03:58 |
| Problems with MFIX code and Parallel Processing. | Fernando Pio | Main CFD Forum | 4 | August 29, 2006 15:33 |
| Design Integration with CFD? | John C. Chien | Main CFD Forum | 19 | May 17, 2001 16:56 |
| What is the Better Way to Do CFD? | John C. Chien | Main CFD Forum | 54 | April 23, 2001 09:10 |
| own Code vs. commercial code | Bernhard Mueck | Main CFD Forum | 10 | February 16, 2000 11:07 |