| | |
| | | #include<gsl/gsl_linalg.h> |
| | | #include "general.h" |
| | | #include "sh.h" |
| | | #include "shreal.h" |
| | | #include "shcomplex.h" |
| | | |
| | | #include "string.h" |
| | | #include "io.h" |
| | | |
| | | ts_spharm *complex_sph_init(ts_vertex_list *vlist, ts_uint l){ |
| | | ts_uint j,i; |
| | |
| | | |
| | | /* Calculate coefficients that will remain constant during all the simulation */ |
| | | precomputeShCoeff(sph); |
| | | |
| | | shreal_init(sph,l); //this is for TESTING only! |
| | | return sph; |
| | | } |
| | | |
| | | ts_bool complex_sph_free(ts_spharm *sph){ |
| | | int i,j; |
| | | if(sph==NULL) return TS_FAIL; |
| | | shreal_free(sph); //this is for TESTING only! |
| | | for(i=0;i<sph->l;i++){ |
| | | if(sph->ulm[i]!=NULL) free(sph->ulm[i]); |
| | | if(sph->ulmComplex[i]!=NULL) free(sph->ulmComplex[i]); |
| | |
| | | |
| | | return retval; |
| | | } |
| | | |
| | | |
| | | ts_bool saveAvgUlm2Complex(ts_vesicle *vesicle){ |
| | | |
| | | FILE *fh; |
| | | char filename[10000]; |
| | | strcpy(filename, command_line_args.path); |
| | | strcat(filename, "sph2out.dat"); |
| | | fh=fopen(filename, "w"); |
| | | if(fh==NULL){ |
| | | err("Cannot open file %s for writing"); |
| | | return TS_FAIL; |
| | | } |
| | | |
| | | ts_spharm *sph=vesicle->sphHarmonics; |
| | | ts_int i,j; |
| | | 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,"\n"); |
| | | } |
| | | fclose(fh); |
| | | return TS_SUCCESS; |
| | | } |