//======================================= // Binary output of scalar field data // Latest update: 2014.1.10 //======================================= #include #include #include int main(int argc,char* argv[]) { double** point_coord; // three-dimensional coordinate (x,y,z) double* field_data; // scalar function f(x,y,z) double Lx,Ly,Lz; double cx,cy,cz; double dx,dy,dz; int nx,ny,nz; double x,y,z,r; int dim; // the number of spatial dimension int size; // the number of data points int i,j,k,d,count; FILE *fp; // ---------- Initialization ---------- dim = 3; Lx = 5.0; Ly = Lx; Lz = Lx; cx = Lx/2.0; cy = Ly/2.0; cz = Lz/2.0; nx = 51; ny = nx; nz = nx; dx = Lx/(nx-1); dy = Ly/(ny-1); dz = Lz/(nz-1); size = nx*ny*nz; point_coord = (double **)malloc(size*sizeof(double*)); for(i=0;i