| | |
| | | #include "io.h" |
| | | #include <string.h> |
| | | |
| | | |
| | | /* do not use!!! */ |
| | | ts_spharm *sph_init(ts_vertex_list *vlist, ts_uint l){ |
| | | ts_uint j,i; |
| | | ts_spharm *sph=(ts_spharm *)malloc(sizeof(ts_spharm)); |
| | |
| | | for(i=0;i<sph->l;i++){ |
| | | for(j=0;j<2*i+1;j++){ |
| | | /* DEBUG fprintf(stderr,"sph->sumUlm2[%d][%d]=%e\n",i,j,sph->ulm[i][j]* sph->ulm[i][j]); */ |
| | | sph->sumUlm2[i][j]+=sph->ulm[i][j]* sph->ulm[i][j]; |
| | | sph->sumUlm2Old[i][j]+=sph->ulm[i][j]* sph->ulm[i][j]; |
| | | } |
| | | } |
| | | sph->N++; |
| | |
| | | FILE *fh; |
| | | char filename[10000]; |
| | | strcpy(filename, command_line_args.path); |
| | | strcat(filename, "sph2out.dat"); |
| | | strcat(filename, "sph2outOld.dat"); |
| | | fh=fopen(filename, "w"); |
| | | if(fh==NULL){ |
| | | err("Cannot open file %s for writing"); |
| | |
| | | fprintf(fh,"l,\tm,\tulm^2avg\n"); |
| | | for(i=0;i<sph->l;i++){ |
| | | for(j=0;j<2*i+1;j++){ |
| | | fprintf(fh,"%d,\t%d,\t%e\n", i, j-i, sph->sumUlm2[i][j]/(ts_double)sph->N); |
| | | fprintf(fh,"%d,\t%d,\t%e\n", i, j-i, sph->sumUlm2Old[i][j]/(ts_double)sph->N); |
| | | |
| | | } |
| | | fprintf(fh,"\n"); |