|
[Sponsors] |
October 24, 2008, 13:14 |
Hi,
Just came across an probl
|
#1 |
Senior Member
Xiaofeng Liu
Join Date: Mar 2009
Location: State College, PA, USA
Posts: 118
Rep Power: 17 |
Hi,
Just came across an problem related to IFStream. I have a data file: sample.xyz which has xyz data 384165.6 4762392.7 0 384204.5 4762602.3 0 Then I simply read the data and print them on the screen. They output is: 384166 4.76239e+06 0 384204 4.7626e+06 0 The float point data x becomes an integer and the y data also lost some precision. I believe it is related to the format. Could someone give me some hint? The test program is: #include "fvCFD.H" #include "OFstream.H" #include "IFstream.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) { //dem data const int nDEMPoints=2; scalar tmp; label tmpl; scalar x,y,z; //read in the dem data fileName dxDataFile("sample.xyz"); IFstream dataIn(dxDataFile); for (label i=0;i<nDEMPoints;i++) { dataIn >> x >> y >> z; Info << x << " " << y << " " << z << endl; } Info << "\nEnd\n" << endl; return 0; } IFTest.tgz
__________________
Xiaofeng Liu, Ph.D., P.E., Assistant Professor Department of Civil and Environmental Engineering Penn State University 223B Sackett Building University Park, PA 16802 Web: http://water.engr.psu.edu/liu/ |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
IFstream binary file read type conversion problem | card | OpenFOAM Bugs | 3 | October 30, 2008 15:18 |
How to read data into my UDF??? | Harshit Gupta | FLUENT | 3 | June 15, 2006 03:34 |
float point error | soundar | FLUENT | 0 | December 17, 2004 04:23 |
UDF to read and write data | Mcgregor | FLUENT | 4 | June 9, 2003 14:21 |
read in wall data | Ethan | Siemens | 0 | March 29, 2003 16:19 |