void ntGoldGl(char *cloneSizes, char *ntAgp, char *oogVersion, int ctgCount, char *ctgNames[])
/* ntGoldGl - Update gold.NN and gl.NN files to unpack NT contig info.. */
{
struct clone *cloneList = NULL, *clone;
struct ntContig *ntList = NULL, *nt;
struct hash *cloneHash = NULL, *ntHash = NULL;
char oldName[512], newName[512], *contig;
int i;

readCloneSizes(cloneSizes, &cloneList, &cloneHash);
printf("Read %d clones in %s\n", slCount(cloneList), cloneSizes);

readPatch(ntAgp, cloneHash, &ntList, &ntHash);
printf("Read %d nt contigs in %s\n", slCount(ntList), ntAgp);

printf("Working on %d contigs\n", ctgCount);
for (i=0; i<ctgCount; ++i)
    {
    contig = ctgNames[i];
    printf(" %s\n", contig);
    sprintf(oldName, "%s/gold.%s.noNt", contig, oogVersion);
    if (!fileExists(oldName))
        {
	warn("%s doesn't exist", oldName);
	continue;
	}
    sprintf(newName, "%s/gold.%s", contig, oogVersion);
    patchOneGold(oldName, ntHash, newName);
    sprintf(oldName, "%s/ooGreedy.%s.gl.noNt", contig, oogVersion);
    sprintf(newName, "%s/ooGreedy.%s.gl", contig, oogVersion);
    patchOneGl(oldName, ntHash, newName);
    }
}
Exemple #2
0
void Parse_Header(STREAMFILE* streamFile,EA_STRUCT* ea, off_t offset, int length) {

	uint8_t byteRead;
	off_t	begin_offset=offset;

	// default value ...
	ea->channels=1;
	ea->compression_type=0;
	ea->compression_version=0x01;
	ea->platform=EA_GC;

	if(read_32bitBE(offset, streamFile)==0x47535452) { // GSTR
		ea->compression_version=0x03;
		offset+=8;
		ea->platform=6;
	} else {
		if(read_16bitBE(offset,streamFile)!=0x5054)  // PT
			offset+=4;

		ea->platform=(uint8_t)read_16bitLE(offset+2,streamFile);
		offset+=4;
	}

	do {
		byteRead = read_8bit(offset++,streamFile);

		switch(byteRead) {
			case 0xFF:
			case 0xFE:
			case 0xFC:
			case 0xFD:
				break;
			case 0x80: // compression version
				ea->compression_version = (uint8_t)readPatch(streamFile, &offset);
				break;
			case 0x82: // channels count
				ea->channels = (uint8_t)readPatch(streamFile, &offset);
				break;
			case 0x83: // compression type
				ea->compression_type = (uint8_t)readPatch(streamFile, &offset);
				if(ea->compression_type==0x07) ea->compression_type=0x30;
				break;
			case 0x84: // sample frequency
				ea->sample_rate = readPatch(streamFile,&offset);
				break;
			case 0x85: // samples count
				ea->num_samples = readPatch(streamFile, &offset);
				break;
			case 0x8A:
				offset+=4;
				if(ea->compression_type==0) ea->compression_type=EA_PCM_LE;
				break;
			case 0x86:
			case 0x87:
			case 0x8C:
			case 0x92:
			case 0x9C:
			case 0x9D: // unknown patch
				readPatch(streamFile, &offset);
				break;
			case 0x88: // interleave
				ea->interleave = readPatch(streamFile, &offset);
				break;
			case 0xA0: // compression type
				ea->compression_type = (uint8_t)readPatch(streamFile, &offset);
				break;
		}
	} while(offset-begin_offset<length);

	if(ea->platform==EA_PSX)
		ea->compression_type=EA_VAG;
	if(ea->compression_type==0)
		ea->compression_type=EA_EAXA;
}
Exemple #3
0
int main(int argc, char **argv) 
{
   if( argc < 2 ){
      printf("Please specify the input file.\n");
      exit(1);
   }
   char filename[256];
   if( argv[1] ){
      strcpy( filename , argv[1] );
   }
   CommandMode=0;
   if( argc>2 ){ CommandMode=1; FullScreenMode=1; }
   char group1[256];
   char group2[256];
   strcpy( group1 , "Grid" );
   strcpy( group2 , "Data" );

   hsize_t dims[3];
   
   readSimple( filename , group1 , (char *)"T" , &t , H5T_NATIVE_DOUBLE );
   getH5dims( filename , group1 , (char *)"r_jph" , dims );
   Nr = dims[0]-1;
   getH5dims( filename , group1 , (char *)"z_kph" , dims );
   Nz = dims[0]-1;

   Np = (int *) malloc( Nr*sizeof(int) );
   r_jph = (double *) malloc( (Nr+1)*sizeof(double) );
   z_kph = (double *) malloc( (Nz+1)*sizeof(double) );
   int Tindex[Nr];
   
   printf("t = %.2f, Nr = %d Nz = %d\n",t,Nr,Nz);

   readSimple( filename , group1 , (char *)"r_jph" , r_jph , H5T_NATIVE_DOUBLE );
   readSimple( filename , group1 , (char *)"z_kph" , z_kph , H5T_NATIVE_DOUBLE );

   //midz = Nz/2;
   midz = Nz-1;

   int start[2]    = {0,0};
   int loc_size[2] = {Nr,Nz};
   int glo_size[2] = {Nr,Nz};

   int Np_All[Nr*Nz];
   int Tindex_All[Nr*Nz];
   int Id_phi0[Nr*Nz];

   readPatch( filename , group1 , (char *)"Np"      , Np_All     , H5T_NATIVE_INT , 2 , start , loc_size , glo_size);
   readPatch( filename , group1 , (char *)"Index"   , Tindex_All , H5T_NATIVE_INT , 2 , start , loc_size , glo_size);
   readPatch( filename , group1 , (char *)"Id_phi0" , Id_phi0    , H5T_NATIVE_INT , 2 , start , loc_size , glo_size);

   int i,j,k;
   for( j=0 ; j<Nr ; ++j ){
      k = midz;
      int jk = j*Nz+k;
      Np[j]     = Np_All[jk];
      Tindex[j] = Tindex_All[jk];
   }

   getH5dims( filename , group2 , (char *)"Cells" , dims );
   int Nc = dims[0];
   Nq = dims[1]-1;

   getH5dims( filename , group2 , (char *)"Planets" , dims );
   Npl = dims[0];
   int NpDat = dims[1];
   printf("Nc = %d Nr = %d Nq=%d Npl=%d NpDat=%d\n",Nc,Nr,Nq,Npl,NpDat);

   theZones = (double ***) malloc( Nr*sizeof(double **) );
   int q;
   for( j=0 ; j<Nr ; ++j ){
      theZones[j] = (double **) malloc( Np[j]*sizeof( double * ) );
      for( i=0 ; i<Np[j] ; ++i ){
         theZones[j][i] = (double *) malloc( Nq*sizeof( double ) );
      }
   }

   rzZones = (double **) malloc( Nr*Nz*sizeof(double *) );
   for( j=0 ; j<Nr*Nz ; ++j ){
      rzZones[j] = (double *) malloc( (Nq+1)*sizeof( double ) );
   }

   p_iph = (double **) malloc( Nr*sizeof( double * ) );
   for( j=0 ; j<Nr ; ++j ){
      p_iph[j] = (double *) malloc( Np[j]*sizeof( double ) );
   }
   thePlanets = (double **) malloc( Npl*sizeof(double *) );
   int p;
   for( p=0 ; p<Npl ; ++p ){ 
      thePlanets[p] = (double *) malloc( 2*sizeof(double) );
   }

   getH5dims( filename , group2 , (char *)"Radial_Diagnostics" , dims );
   N1d = dims[1];
   theRadialData = (double **) malloc( Nr*sizeof(double *) );
   for( j=0 ; j<Nr ; ++j ){
      theRadialData[j] = (double *) malloc( N1d*sizeof(double) );
   }

   printf("Zones Allocated\n");
   loc_size[1] = Nq+1;
   glo_size[0] = Nc;
   glo_size[1] = Nq+1;

   for( j=0 ; j<Nr ; ++j ){
      loc_size[0] = Np[j];
      start[0] = Tindex[j];
      double TrackData[Np[j]*(Nq+1)];
      readPatch( filename , group2 , (char *)"Cells" , TrackData , H5T_NATIVE_DOUBLE , 2 , start , loc_size , glo_size);
      for( i=0 ; i<Np[j] ; ++i ){
         p_iph[j][i] = TrackData[i*(Nq+1) + Nq];
         for( q=0 ; q<Nq ; ++q ){
            theZones[j][i][q] = TrackData[i*(Nq+1) + q];
         }
      }
   }
   printf("theZones built\n");

   loc_size[0] = 1;
   for( j=0 ; j<Nr ; ++j ){
      for( k=0 ; k<Nz ; ++k ){
         int jk = j*Nz+k;
         start[0] = Id_phi0[jk];
         readPatch( filename , group2 , (char *)"Cells" , rzZones[jk] , H5T_NATIVE_DOUBLE , 2 , start , loc_size , glo_size );
      }
   }
   printf("rzZones built\n");

   start[1] = 0;
   loc_size[0] = 1;
   glo_size[0] = Npl;
   loc_size[1] = NpDat;
   glo_size[1] = NpDat;
   for( p=0 ; p<Npl ; ++p ){
      start[0] = p;
      double thisPlanet[6];
      readPatch( filename , group2 , (char *)"Planets" , thisPlanet , H5T_NATIVE_DOUBLE , 2 , start , loc_size , glo_size );
      int dp;
      printf("Planet = ");
      for( dp=0 ; dp<NpDat ; ++dp ) printf("%e ",thisPlanet[dp]);
      printf("\n");
      thePlanets[p][0] = thisPlanet[3];
      thePlanets[p][1] = thisPlanet[4];
   }

   loc_size[0] = 1;
   glo_size[0] = Nr;
   loc_size[1] = N1d;
   glo_size[1] = N1d;
   start[1] = 0;
   for( j=0 ; j<Nr ; ++j ){
      start[0] = j;
      double thisQ[N1d];
      readPatch( filename , group2 , (char *)"Radial_Diagnostics" , thisQ , H5T_NATIVE_DOUBLE , 2 , start , loc_size , glo_size );
      int nq;
      for( nq = 0 ; nq < N1d ; ++nq ) theRadialData[j][nq] = thisQ[nq];
   }

   r_jph++;
   z_kph++;

   //double RR = r_iph[0][Nr[0]-1];
   //double r_max = .98*RR;
   //double r_min = 0.0;//r_iph[0][0];
   //double r_min = .82*RR;

   //printf("Rmin = %.2e Rmax = %.2e\n",r_min,r_max);
   //double thalf = .5*t_jph[Nt-1];
   rescale = 1.7*r_jph[Nr-1];  //(r_max-r_min);
   //offx = .5*(r_min+r_max)/rescale;
   //offy = 0.5;//.5*(r_min+r_max)*sin(thalf)/rescale;
   //offy = .5*(r_min+r_max)/rescale;
   //rescale *= .5;
   //rescale *= .4;
   rescale *= 1.2;
   //offy = 0.75/rescale;
   //offx = 0.6/rescale;//0.0;//1.0/rescale;
   offy = 0.0;
   offx = 0.0;//2.5/rescale;//0.0;//1.0/rescale;

//////////////////////////////
   glutInit(&argc, argv);  
   glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH);  
   glutInitWindowSize(WindowWidth, WindowHeight);
   glutInitWindowPosition(0, 0);
   window = glutCreateWindow("DISCO Viewer");
   glutDisplayFunc(&DrawGLScene);  
   if(FullScreenMode) glutFullScreen();
   glutIdleFunc(&DrawGLScene);
   glutReshapeFunc(&ReSizeGLScene);
   glutKeyboardFunc(&keyPressed);
   glutSpecialFunc(&specialKeyPressed);
   InitGL(WindowWidth, WindowHeight);
   glutMainLoop();  

   for( p=0 ; p<Npl ; ++p ){
      free(thePlanets[p]);
   }
   free(thePlanets);

   for( j=0 ; j<Nr ; ++j ){
      for( i=0 ; i<Np[j] ; ++i ){
         free( theZones[j][i] );
      }
      free( theZones[j] );
   }
   for( j=0 ; j<Nr*Nz ; ++j ){
      free( rzZones[j] );
   }
   free( rzZones );

   free( theZones );
   for( j=0 ; j<Nr ; ++j ){
      free( p_iph[j] );
      free( theRadialData[j] );
   }
   free( p_iph );
   free( theRadialData );
   free( Np );
   r_jph--;
   free( r_jph );
   z_kph--;
   free( z_kph );

   return (0);

}