#include #include #include #include "tools.h" #include "Parameters.h" int main(int argc, char* argv[]){ FILE *input; char filename[100]; particles = realloc(particles,sizeof(struct particle)*Ndata); sprintf(filename,"./DATA/0500.dat"); if ((input = fopen(filename, "r")) == NULL){ printf("No such file found. Stop calculation.\n"); exit(2); } char str[30]; double time; int N_num; fscanf(input,"%s",str); fscanf(input,"%lf",&time); fscanf(input,"%d",&N_num); np=0; double mtot=0; while( (fscanf(input,"%d %d %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf", &particles[np].pid, &particles[np].material, &particles[np].m, &particles[np].x, &particles[np].y, &particles[np].z, &particles[np].vx, &particles[np].vy, &particles[np].vz, &particles[np].h, &particles[np].d, &particles[np].p, &particles[np].e, &particles[np].temp, &particles[np].ppeak, &particles[np].tpeak) != EOF ) ){ mtot += particles[np].m; np++; } fclose(input); int count_c[NSIZEX]; double m_clump[NSIZEX]; int (*c_index)[NSIZEX] = malloc(sizeof(int)*np*NSIZEX); clump_finding(count_c, c_index, m_clump); output_clumps(count_c, c_index, m_clump); output_mass_of_clumps(count_c, c_index, m_clump); output_COM_of_clumps(count_c, c_index, m_clump); free(c_index); free(particles); return 0; }