gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz/lava/gfx rd1.cxx


From: Janne V. Kujala
Subject: [Gzz-commits] gzz/lava/gfx rd1.cxx
Date: Fri, 30 Aug 2002 09:18:22 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Janne V. Kujala <address@hidden>        02/08/30 09:18:22

Modified files:
        lava/gfx       : rd1.cxx 

Log message:
        better laplacian

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gfx/rd1.cxx.diff?tr1=1.6&tr2=1.7&r1=text&r2=text

Patches:
Index: gzz/lava/gfx/rd1.cxx
diff -c gzz/lava/gfx/rd1.cxx:1.6 gzz/lava/gfx/rd1.cxx:1.7
*** gzz/lava/gfx/rd1.cxx:1.6    Fri Aug 30 07:15:59 2002
--- gzz/lava/gfx/rd1.cxx        Fri Aug 30 09:18:22 2002
***************
*** 3,8 ****
--- 3,9 ----
  #include <math.h>
  #include <GL/glut.h>
  #include <iostream>
+ #include <unistd.h>
  
  using std::cout;
  using std::cerr;
***************
*** 19,29 ****
  #define Dv_f(x,y,z) 1E-5 / (eps*eps)
  //#define Dv_f(x,y,z) (( .75E-5 + .5E-5 * z ) / (eps*eps))
  
! #define F_f(x,y,z) 0.015
  //#define F_f(x,y,z) (.08 * y)
  //#define F_f(x,y,z) (.04 + .01 * y)
  
! #define k_f(x,y,z) 0.04
  //#define k_f(x,y,z) (.03 + .04 * x)
  //#define k_f(x,y,z) (.06 + .0075 * x)
  
--- 20,30 ----
  #define Dv_f(x,y,z) 1E-5 / (eps*eps)
  //#define Dv_f(x,y,z) (( .75E-5 + .5E-5 * z ) / (eps*eps))
  
! #define F_f(x,y,z) 0.05
  //#define F_f(x,y,z) (.08 * y)
  //#define F_f(x,y,z) (.04 + .01 * y)
  
! #define k_f(x,y,z) 0.065
  //#define k_f(x,y,z) (.03 + .04 * x)
  //#define k_f(x,y,z) (.06 + .0075 * x)
  
***************
*** 87,93 ****
      float zp = z + sin(x) - sin(2*y);
    
      U[i] = 0.5+0.5*sin(xp + yp + 3*zp);
!     V[i] = 0.5+0.5*sin(2 * yp - 2*zp*zp);
    }
  
    iter = 0;
--- 88,94 ----
      float zp = z + sin(x) - sin(2*y);
    
      U[i] = 0.5+0.5*sin(xp + yp + 3*zp);
!     V[i] = 0.5+0.5*sin(2 * yp - 2*zp);
    }
  
    iter = 0;
***************
*** 131,137 ****
  #endif
  
  #ifndef LAPLACIAN_2D
! #define laplacian(a) (a[i-e0]+a[i+e0]+a[i-e1]+a[i+e1]+a[i-e2]+a[i+e2]-6*a[i])
  #else
  #define laplacian(a) (a[i-e0]+a[i+e0]+a[i-e1]+a[i+e1]-4*a[i])
  #endif
--- 132,149 ----
  #endif
  
  #ifndef LAPLACIAN_2D
! #define laplacian6(a) (a[i-e0]+a[i+e0]+a[i-e1]+a[i+e1]+a[i-e2]+a[i+e2]-6*a[i])
! #define laplacian8(a) (a[i-e0-e1-e2]+\
!                     a[i-e0-e1+e2]+\
!                     a[i-e0+e1-e2]+\
!                     a[i-e0+e1+e2]+\
!                     a[i+e0-e1-e2]+\
!                     a[i+e0-e1+e2]+\
!                     a[i+e0+e1-e2]+\
!                     a[i+e0+e1+e2]-8*a[i])*(1./3)
! 
! #define laplacian(a) (.5*laplacian6(a)+.5*laplacian8(a))
! 
  #else
  #define laplacian(a) (a[i-e0]+a[i+e0]+a[i-e1]+a[i+e1]-4*a[i])
  #endif
***************
*** 179,189 ****
  }
  
  void writeout() {
!   const char *filenew = "map3d.dat.new";
!   char *file = "map3d.dat";
!   
  
!   FILE *f = fopen(filenew, "w");
    if (!f) {
      perror(file);
      exit(1);
--- 191,202 ----
  }
  
  void writeout() {
!   char file[1000];
  
!   sprintf(file, "map3d_F%G_k%G_eps%G_teps%G_iter%d.dat", 
!         F_f(0,0,0), k_f(0,0,0), eps, teps, iter);
! 
!   FILE *f = fopen(file, "w");
    if (!f) {
      perror(file);
      exit(1);
***************
*** 200,207 ****
        //fprintf(f, "%G %G\n", U[i], V[i]);
        }
    fclose(f);
!   rename(filenew, file);
! 
  }
  
  void stats() {
--- 213,220 ----
        //fprintf(f, "%G %G\n", U[i], V[i]);
        }
    fclose(f);
!   unlink("map3d.dat");
!   link(file, "map3d.dat");
  }
  
  void stats() {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]