|
[Sponsors] | |||||
|
|
|
#1 |
|
Member
Jian Zhong
Join Date: Feb 2012
Location: Birmingham
Posts: 91
Rep Power: 3 ![]() |
Dear foamers,
I am new to the openfoam programming. In the solve, I want to add a set of code to write out the binary format data? My current code is : ......... ofstream output_file; //(It should be ASCII format, but I want binary. Foam::string output_file_name; ........ output_file.open (output_file_name.c_str()); forAll(mesh.C(), pointI) { output_file << mesh.C()[pointI].x() << " " << mesh.C()[pointI].y() << " " << mesh.C()[pointI].z() << " " << U.internalField()[pointI].x() << " " << U.internalField()[pointI].y() << " " << U.internalField()[pointI].z() << "\n"; } output_file.close(); Many thanks, I just want to binary format data for post-processing. Best regards, Jian |
|
|
|
|
|
|
|
|
#2 |
|
Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 4,310
Blog Entries: 31
Rep Power: 45 ![]() ![]() |
Greetings Jian,
You'll need to open the file with the binary mode option: Code:
output_file.open (output_file_name.c_str(), ios::out | ios::binary); Best regards, Bruno
__________________
|
|
|
|
|
|
|
|
|
#3 |
|
Member
Jian Zhong
Join Date: Feb 2012
Location: Birmingham
Posts: 91
Rep Power: 3 ![]() |
It works. Many thanks.
|
|
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| fluentMeshToFoam multidomain mesh conversion problem | Attesz | OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... | 12 | May 2, 2013 10:52 |
| Format data in Fluent | phinix | FLUENT | 1 | February 11, 2013 08:17 |
| Generating a binary data file without using tecio | tom10 | Tecplot | 0 | June 18, 2012 19:16 |
| export data at nodes | Meenu | FLUENT | 1 | December 30, 2011 01:24 |
| Automatic Data Export (ascii format) | A Kourm | FLUENT | 3 | January 21, 2009 07:36 |