Problem with CREAL, FFTW

Hello Everybody,

In a part of my code I'm defining limits over a variable which is in type of:

 
fftw_complex *i_phi


Then it is initialized as:

 
i_phi = (fftw_complex*) fftw_malloc(nx*ny* sizeof(fftw_complex));


The limits are defined as follows.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
     
        if ( creal(phi[i]) < 0.0 )   i_phi [i] = 0.0;
        
        if ( creal(phi[i]) > 1.0)   i_phi [i] = 1.0;
      }  

      for (int i=0 ; i < number_of_mesh_points ; ++i)
      {
	 double p = creal(i_phi[i]);
	 double h =(3.*p*p)-(2.*p*p*p);
	 double dh = (6.*p) - (6.*p*p);
	 
	 // *****D	E	B	u	g****** 
      if (n == 1 )
        if(p < 0.0 || p > 1.0)                

		cout << "______"<< p << "_____"<< dh << endl;


Printed numbers are showing a lot of fluctuation around limits eg, 1.00542, 1.0002 and -2.45829e-12.

I really have no idea why the limits are not applied for a lot of cells but my guess is that it's a problem from the CREAL function. Also I've changed the CREAL with __REAL__ but still the same problem shows up.

I would be thankful if anybody could help me with this issue.

Thanks.
Last edited on
You should ask this question in the FFTW mailing list.
Topic archived. No new replies allowed.