|
[Sponsors] |
February 4, 2009, 06:08 |
UDF_For_Storage
|
#1 |
Guest
Posts: n/a
|
I have written this simple code above for storaging the elements of the array PRE_EXP[], that I read from a file, in a C_UDMI.
I loop over all threads and then all cells and i store the value 10. Then I pick the thread i need (Lookup_Thread(d, ID) and store there the elements of PRE_EXP in the particular cells. Unfortunately it puts everywhere 10, even in the thread that i want to put the elements of PRE_EXP. Thanks in advance. My code is: #include <stdio.h> #include "udf.h" FILE* Point; FILE* Point2; DEFINE_ADJUST(Exp_Pre,d) { float PRE_EXP[58]; cell_t c; Thread *t; face_t f; Thread *f_thread; int ID=8; int i=0; Thread *c_thread; cell_t c0; Thread *p; Point = fopen("Initial_Solution","r"); Point2 = fopen("I","w"); p = Lookup_Thread(d, ID); for (i=0; i<58; i++) { fscanf(Point,"%f\n",&PRE_EXP[i]); } thread_loop_c(t,d) { begin_c_loop_all(c,t) { C_UDMI(c,t,0) = 10.0; } end_c_loop_all(c,t) } c_thread = Lookup_Thread(d, ID); begin_c_loop(c,c_thread) { C_UDMI(c,c_thread,0) = PRE_EXP[c]; } end_c_loop(c,c_thread) thread_loop_c(t,d) { /* loop over all cells */ begin_c_loop_all(c,t) { fprintf(Point2,"%f\n",C_UDMI(c,t,0)); } end_c_loop_all(c,t) } fclose(Point); fclose(Point2); } |
|
February 4, 2009, 12:09 |
Re: UDF_For_Storage
|
#2 |
Guest
Posts: n/a
|
Did it!
|
|
Thread Tools | Search this Thread |
Display Modes | |
|
|