|
[Sponsors] |
September 20, 2002, 15:19 |
Reading table file
|
#1 |
Guest
Posts: n/a
|
Hi Shital
First, i write a program on C++(((EssaiC.cpp))using some standard C-language attributes(fscan...).this program can read the data from table_file to an array called table[i] [j]. this program run and can read the array table[i][j] ********* ********* /********EssaiC.cpp*****/ #include<iostream.h> #include<fstream.h> #include<stdio.h> main(void) { int i,j; float table[10][20]; FILE *fichier; float temp; fichier = fopen("Meteo.txt","r"); for (i=0;i<3 ;i++) { for (j=0;j<1;j++) { fscanf(fichier,"%f", &temp); table[i][j] =temp; cout << "\nla valeur de i\t" << i; cout << "\nle valeur j\t" << j; cout << "\n\nla valeur de table est:\t" << table[i][j]; } } fclose(fichier); return 0; ******* ******* Where Meteo.txt is the data file **** **** **** "Meteo.txt"( array [3,3]) 1 2 3 4 5 6 7 8 9 ***** ***** i complie the EssaiC an i can read the values of the arrayarray [3,3]: ***** ***** I write a UDF (UDf profille)(((EssaiFluent.cpp)))using the same standard C-language attributes as EssaiC.i can compile with success but i can't read the array: ***** ***** Essai Fluent #include"udf.h" DEFINE_PROFILE(PERTE_ATM,thread,position) { face_t f; FILE *fichier; real x[ND_ND]; int i,j; float table[10][20]; fichier = fopen("Meteo.txt","r"); for (i = 0 ; i<1 ;i++) { for (j = 0;j<2;j++) { fscanf(fichier,"%f \t",&table[i][j]); printf("\\n\n %f \n",table[i][j]); fclose(fichier); begin_f_loop (f,thread) { F_PROFILE (f,thread,position)=100*table[i][j]+table[i+1][j]+;; } } } end_f_loop(f,thread) } i compile the UDF witout error but when i will print the value of the array .(look the UDF Define profile)but the UDF (Define profile ) can't read correctly the value from data file(Meteo.txt). What the error in my own UDF? Thanks in advance. Ridha |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenFOAM Install Script | ljsh | OpenFOAM Installation | 82 | October 12, 2009 12:47 |
[OpenFOAM] Paraview command not found | hardy | ParaView | 7 | September 18, 2008 05:59 |
Compiling OpenFOAM13 on AMD64 with Redhat Enterprise | mbeaudoin | OpenFOAM Installation | 20 | June 17, 2008 07:43 |
DecomposePar links against liblamso0 with OpenMPI | jens_klostermann | OpenFOAM Bugs | 11 | June 28, 2007 18:51 |
Results saving in CFD | hawk | Main CFD Forum | 16 | July 21, 2005 21:51 |