/* * atexit() function to close all remaining files. */ void t_fcloseall(void) { while (tflist) t_fclose(tflist); }
LONGMATRIX_VECTOR *read_fine_indices(char *filename,short print) { /*! * \author Emanuele Cordano * date May 2009 * * \param (char*) - name of filename *\param (short) - */ LONGMATRIX_VECTOR *lm; FILE *fd; long j,n_po; fd=t_fopen(filename,"r"); n_po=(long)read_index(fd,no_PRINT); lm=new_longmatrix_vector(n_po); for (j=lm->nl;j<=lm->nh;j++) { if (print==1) printf("Function read_fine_indices element %ld of %ld is being defined \n",j,lm->nh); lm->element[j]=read_longmatrix(fd,"a",no_PRINT); if (print==1) printf("Function read_fine_indices element %ld of %ld is read [%ld,%ld] f.e. %ld \n",j,lm->nh,lm->element[j]->nrh,lm->element[j]->nrh,lm->element[j]->element[1][1]); if (!lm->element[j]) t_error("lm->element[j] in read_fine_indices was not defined"); // if (polygons->element[j]->index!=j) printf ("Error in read_polygonvector (polygon %ld) inconstancy: %ld %ld \n",j,j,polygons->element[j]->index); } t_fclose(fd); if (print==1) printf("Function read_fine_indices was successfully executed! \n"); return lm; }
polygon_connection_attribute_array *read_connection_attribute_array(char *filename,short print) { /*! * * \author Emanuele Cordano * \author May 2008 * *\param (char*) - name of filename *\param (short) - * *\brief It creates and reads a polygonvector from the following options: */ polygon_connection_attribute_array *pca; FILE *fd; long j,n_po; fd=t_fopen(filename,"r"); n_po=(long)read_index(fd,no_PRINT); pca=new_connection_attributes(n_po); for (j=pca->nl;j<=pca->nh;j++) { pca->element[j]=read_connections(fd,print); // if (pca->element[j]->index!=j) printf ("Error in read_connection_attributes (polygon %ld) inconstancy: %ld %ld \n",j,j,pca->element[j]->index); } t_fclose(fd); if (print==1) printf("Function read_connection_attributes (number of polygons %ld) was successfully executed!!",pca->nh); return pca; }
LONGBIN *read_line_indices(char *filename,short print) { /* * * \author Emanuele Cordano * date May 2009 * * \param (char*) - name of filename *\param (short) - * */ LONGVECTOR **lv; LONGBIN *lb; LONGVECTOR *vi; FILE *fd; long j,n_l,c; fd=t_fopen(filename,"r"); n_l=(long)read_index(fd,print); // printf("n_l=%ld",n_l); lv=(LONGVECTOR **)malloc((size_t)(n_l*sizeof(LONGVECTOR *))); // stop_execution(); for (j=0;j<=n_l-1;j++) { lv[j]=read_longarray(fd,print); } vi=new_longvector(n_l); for (j=vi->nl;j<=vi->nh;j++) { vi->element[j]=lv[j-1]->nh; } lb=new_longbin(vi); for (j=lb->index->nl;j<=lb->index->nh;j++) { for(c=1;c<=lb->index->element[j];c++) { lb->element[j][c]=lv[j-1]->element[c]; } } free_longvector(vi); for (j=0;j<=n_l-1;j++) { free_longvector(lv[j]); } free(lv); t_fclose(fd); if (print==1) printf("Function read_line_indices was successfully executed! \n"); return lb; }