Trisurf Monte Carlo simulator
Samo Penic
2019-10-17 692fb5ed82bb9b6ee4be4d5463323585d142c0ea
Solved some, still missing some
2 files modified
16 ■■■■ changed files
src/io.c 4 ●●●● patch | view | raw | blame | history
src/snapshot.c 12 ●●●● patch | view | raw | blame | history
src/io.c
@@ -255,7 +255,7 @@
    fprintf(fh, " <UnstructuredGrid>\n");
    fprintf(fh, "<Piece NumberOfPoints=\"%u\" NumberOfCells=\"%u\">\n",vlist->n+monono*polyno+fonono*filno, blist->n+monono*polyno+filno*(fonono-1)+vesicle->tlist->n);
    fprintf(fh,"<PointData Scalars=\"vertices_idx\">\n<DataArray type=\"Int64\" Name=\"vertices_idx\" format=\"binary\">");
    int *int_vector=(int *)malloc(vlist->n+monono*polyno+fonono*filno*sizeof(ts_uint));
    int *int_vector=(int *)malloc((vlist->n+monono*polyno+fonono*filno)*sizeof(ts_uint));
    int offset=0;
       for(i=0;i<vlist->n;i++){
    //    fprintf(fh,"%u ",vtx[i]->idx);
@@ -285,7 +285,7 @@
            offset=offset+j;
        }
    }
    char *printout=ts_compress_intlist(int_vector,vlist->n+monono*polyno+fonono*filno*sizeof(ts_uint));
    char *printout=ts_compress_intlist(int_vector,(vlist->n+monono*polyno+fonono*filno)*sizeof(ts_uint));
    fprintf(fh,"%s",printout);
    free(printout);
src/snapshot.c
@@ -153,7 +153,6 @@
    defstream.opaque = Z_NULL;
    defstream.avail_in = data_len+1;
    defstream.next_in = (unsigned char *)data;    
    fprintf(stderr,"WAS HERE %d\n", data_len);
    char *compr=(char *)malloc(data_len*sizeof(char));
    defstream.avail_out = data_len+1;
    defstream.next_out = (unsigned char *)compr;
@@ -174,15 +173,16 @@
}
char *ts_compress_intlist(int *data, ts_uint data_len){
    size_t nbase;
    size_t nbase1, nbase2;
    char *compr;
    size_t number_of_compressed_bytes=ts_compress_data((char *)data, data_len*sizeof(int), &compr);
    char *encoded_compressed=base64_encode((unsigned char *)compr,number_of_compressed_bytes,&nbase);
    char *encoded_compressed=base64_encode((unsigned char *)compr,number_of_compressed_bytes,&nbase1);
    free(compr);
    ts_uint header[4]={1, data_len, data_len, nbase};
    char *encoded_header=(char *)base64_encode((unsigned char *)header, 4*sizeof(ts_uint), &nbase);
    encoded_header=realloc(encoded_header, 4*sizeof(ts_uint)+strlen(encoded_compressed));
    ts_uint header[4]={1, data_len, data_len, nbase1};
    char *encoded_header=(char *)base64_encode((unsigned char *)header, 4*sizeof(ts_uint), &nbase2);
    encoded_header=realloc(encoded_header, nbase1+nbase2);
    encoded_header=strcat(encoded_header,encoded_compressed);
    fprintf(stderr,"WAS HERE %d\n", data_len);
    free(encoded_compressed);
    return encoded_header;
}