void CellsStatsData::printPolyCountToFile(std::string fileName, double divThreshold) { //std::remove(fileName.c_str()); std::map<uint, uint> countBdry, countNormal, countDiv; for (uint i = 0; i < cellsStats.size(); i++) { if (cellsStats[i].isBdryCell == true) { insertCount(cellsStats[i].numNeighbors, countBdry); } else { if (cellsStats[i].cellGrowthProgress <= divThreshold) { insertCount(cellsStats[i].numNeighbors, countNormal); } else { insertCount(cellsStats[i].numNeighbors, countDiv); } } } printCountsToFile(fileName, countNormal, countDiv, countBdry); }
void output(FILE* fp1) { /*loop through all letters, A-Z*/ int i; /*loop though all asterixs*/ int j; char* temp; temp=NULL; insertAlpha(mindex); insertCount(mindex); insertLength(mindex); fprintf(stderr,"SKIPME This is a naive implementation of skipping overlapping\n"); fprintf(stderr,"SKIPME strings. It misses the problem of the skipped string\n"); fprintf(stderr,"SKIPME possibly matching somewhere down the road.\n"); if(fp1==NULL) { printf("Length Count Word Location (distance)\n"); printf("====== ===== ==== ========\n"); } else { fprintf(fp1,"Length Count Word Location (distance)\n"); fprintf(fp1,"====== ===== ==== ========\n"); } if(fp1==NULL) { for(i=0;i<mindex;i++) { if(mword[i].count>0) { temp=htable[mword[i].index1][mword[i].index2]; /*count is incremented for nico output as he counts original find*/ mword[i].count++; printf("%6d%7d ",mword[i].length, mword[i].count); printf("%*s ",mword[0].length+1,temp); printf("%-d",mword[i].loc[0]); for(j=1;j<mword[i].count;j++) { printf(" %d",mword[i].loc[j]); printf(" (%d)",mword[i].apart[j]); } //free(mword[i].apart); //problem here //free(mword[i].loc); //free(mword[i].str); printf("\n"); } //free(mword[i]); } //free(mword); } else { for(i=0;i<mindex;i++) { if(mword[i].count>0) { temp=htable[mword[i].index1][mword[i].index2]; /*count is incremented for nico output as he counts original find*/ mword[i].count++; fprintf(fp1,"%6d%8d ",mword[i].length, mword[i].count); fprintf(fp1,"%*s %-d",mword[0].length+1,temp,mword[i].loc[0]); } } } }