have some kind of memory allocation error :(
| | |
| | | xml_trisurf_data(fh,vesicle); |
| | | 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=\"ascii\">"); |
| | | 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 offset=0; |
| | | for(i=0;i<vlist->n;i++){ |
| | | fprintf(fh,"%u ",vtx[i]->idx); |
| | | // fprintf(fh,"%u ",vtx[i]->idx); |
| | | int_vector[i+offset]=vtx[i]->idx; |
| | | } |
| | | //polymeres |
| | | if(poly){ |
| | | poly_idx=vlist->n; |
| | | offset=offset+i; |
| | | for(i=0;i<vesicle->poly_list->n;i++){ |
| | | for(j=0;j<vesicle->poly_list->poly[i]->vlist->n;j++,poly_idx++){ |
| | | fprintf(fh,"%u ", poly_idx); |
| | | //fprintf(fh,"%u ", poly_idx); |
| | | int_vector[j+offset]=poly_idx; |
| | | } |
| | | offset=offset+j; |
| | | } |
| | | } |
| | | //filaments |
| | |
| | | for(i=0;i<vesicle->filament_list->n;i++){ |
| | | for(j=0;j<vesicle->filament_list->poly[i]->vlist->n;j++,poly_idx++){ |
| | | // fprintf(stderr,"was here\n"); |
| | | fprintf(fh,"%u ", poly_idx); |
| | | //fprintf(fh,"%u ", poly_idx); |
| | | int_vector[j+offset]=poly_idx; |
| | | } |
| | | offset=offset+j; |
| | | } |
| | | } |
| | | char *printout=ts_compress_intlist(int_vector,vlist->n+monono*polyno+fonono*filno*sizeof(ts_uint)); |
| | | fprintf(fh,"%s",printout); |
| | | free(printout); |
| | | |
| | | fprintf(fh,"</DataArray>\n"); |
| | | if(cstlist!=NULL){ |
| | |
| | | defstream.opaque = Z_NULL; |
| | | defstream.avail_in = data_len+1; |
| | | defstream.next_in = (unsigned char *)data; |
| | | char *compr=(char *)malloc(data_len*sizeof(char *)); |
| | | fprintf(stderr,"WAS HERE %d\n", data_len); |
| | | *compressed=(char *)malloc(data_len*sizeof(char *)); |
| | | defstream.avail_out = data_len+1; |
| | | defstream.next_out = (unsigned char *)compr; |
| | | defstream.next_out = (unsigned char *)*compressed; |
| | | deflateInit(&defstream, Z_BEST_COMPRESSION); |
| | | deflate(&defstream, Z_FINISH); |
| | | deflateEnd(&defstream); |
| | | *compressed=compr; |
| | | // *compressed=base64_encode((unsigned char *)compr,(size_t)defstream.total_out,&nbase); |
| | | //fwrite(base64, sizeof(unsigned char), nbase, fh); |
| | | // free(compr); |
| | | return defstream.total_out; |
| | | } |
| | | |