int setTextureB(char *map_Kd){ GLuint texName11; //LOGE("Could not link program:\n%d\n", 155); char folder[]="./sdcard/textureFiles/\n"; char *filePath=combineChars(folder,map_Kd); char * chars=getCharsofFile(filePath); texName11=setTexture(&chars); return texName11; }
GLuint Graph::setTextureB(char *map_Kd){ GLuint texName11; // LOGI("setTextureB:%d", 155); char folder[]="./sdcard/textureFiles/"; char *filgpath=combineChars(folder,map_Kd); char * chars=getCharsofFile(filgpath); texName11=setTexture(&chars); return texName11; }
void loadModel2(EntityData *ep,char * fileName){ //jiliye3_1.ly//"my_scene1_7.ly" char folder[]="./sdcard/lyfile/\n"; char * filePath=combineChars(folder,fileName); ep->fileData=getCharsofFile(filePath); //ep->fileData=chars; if(*(ep->fileData)++!=76) return; getMtls2(&(ep->fileData),ep); }
void Graph::loadModel(GraphData *gp,char * fileNamei) { // LOGI("Graph1"); //jiliye3_1.ly//"my_scene1_7.ly" char folder[]="./sdcard/lyfile/"; char * filgpath=combineChars(folder,fileName); LOGI("Graph2:%s",filgpath); gp->fileData=getCharsofFile(filgpath); //gp->fileData=chars; if(*(gp->fileData)++!=76) return; getMtls(&(gp->fileData),gp); }
void loadAnimation(EntityData *ep,char * fileName){ // LOGI("loadAnimation\n"); char folder[]="./sdcard/animationFile/\n"; char * filePath=combineChars(folder,fileName); char * chars=getCharsofFile(filePath); ep->animations=(Animation*)malloc(sizeof(*(ep->animations))); ep->animations->frameNum=(int*)chars; // LOGI("frameNum %d\n", *(ep->animations->frameNum)); chars+=4; ep->animations->frameTime=(float*)chars; // LOGI("frameTime %f\n", *(ep->animations->frameTime)); chars+=4*(*(ep->animations->frameNum)); ep->animations->jointNum=(int*)chars; // LOGI("jointNum %d\n", *(ep->animations->jointNum)); chars+=4; ep->animations->joints=(Joint*)malloc(sizeof(Joint)*(*(ep->animations->jointNum))); for(int i=0;i<*(ep->animations->jointNum);i++){ ep->animations->joints[i].sn=i; ep->animations->joints[i].posf[0]=(*((float*)chars)); chars+=4; ep->animations->joints[i].posf[1]=(*((float*)chars)); chars+=4; ep->animations->joints[i].posf[2]=(*((float*)chars)); chars+=4; // LOGI("posf[0] %f\n", ep->animations->joints[i].posf[0]); // LOGI("posf[1] %f\n", ep->animations->joints[i].posf[1]); // LOGI("posf[2] %f\n", ep->animations->joints[i].posf[2]); ep->animations->joints[i].Matrix=(float*)chars; chars+=16*4*(*(ep->animations->frameNum)); } //ep->animations->jointMatrixs=(float*)chars; ep->animations->frame=1; ep->animations->direction=1; ep->animations->change_stay=1; }
int main(int argc, char* argv[]) { FILE *stream, *logStream; char s[500]; int nrow=10, ncol=10; int i,j; double** data; double* weight; int** mask; char** sampleName; char** geneID; char** annotation; int* clusterid; double** cdata; int** cmask; double error; //int ifound; int min_k=120, max_k=125; int resampNum=5, topNum=7, seqNum=2, npass=1, seed=12345, targetClustNum=3; double alpha=0.1, beta=0.6, subSampPercnt=0.7, remainGenePercnt=0.1; char workingDir[200]; char dataFile[200]; char fullDataFileName[400]; char outputFileName[400]; char buffer[10]; char fullLogFileName[400]; char fullTempClustFileName[400]; char fullTempDataFileName[400]; //this is used for users to confirm that their data are read in correctly char tempString[200]; //temp variables //short** aveComemMatrix; int nclusters; int** clustIndex; int* clustSize; assignChars(workingDir, argv[1]); assignChars(dataFile, argv[2]); targetClustNum=atoi(argv[3]); min_k=atoi(argv[4]); max_k=atoi(argv[5]); alpha=atof(argv[6]); beta=atof(argv[7]); topNum=atoi(argv[8]); seqNum=atoi(argv[9]); resampNum=atoi(argv[10]); subSampPercnt=atof(argv[11]); npass=atoi(argv[12]); combineChars(workingDir, dataFile, fullDataFileName); //06-03-05 modify the names of these outputfile combineChars(fullDataFileName, ".confirmData", fullTempDataFileName); combineChars(fullDataFileName, ".clust.stdout", fullTempClustFileName); //outputFileName combineChars(fullDataFileName, ".tightClust", outputFileName); //Note: _itoa and _gcvt only works in Visual C++ in Windows /* combineChars(outputFileName, argv[3], outputFileName); combineChars(outputFileName, "_", outputFileName); combineChars(outputFileName, argv[4], outputFileName); combineChars(outputFileName, "_", outputFileName); combineChars(outputFileName, argv[5], outputFileName); combineChars(outputFileName, "_", outputFileName); combineChars(outputFileName, argv[6], outputFileName); combineChars(outputFileName, "_", outputFileName); combineChars(outputFileName, argv[7], outputFileName); combineChars(outputFileName, "_", outputFileName); combineChars(outputFileName, argv[8], outputFileName); combineChars(outputFileName, "_", outputFileName); combineChars(outputFileName, argv[9], outputFileName); combineChars(outputFileName, "_", outputFileName); combineChars(outputFileName, argv[10], outputFileName); combineChars(outputFileName, "_", outputFileName); combineChars(outputFileName, argv[11], outputFileName); combineChars(outputFileName, "_", outputFileName); combineChars(outputFileName, argv[12], outputFileName); combineChars(outputFileName, ".txt", outputFileName); */ //06-03-05 simplify outputFileName combineChars(fullDataFileName, ".temp_log_", fullLogFileName); combineChars(fullLogFileName, argv[3], fullLogFileName); combineChars(fullLogFileName, "_", fullLogFileName); combineChars(fullLogFileName, argv[4], fullLogFileName); combineChars(fullLogFileName, "_", fullLogFileName); combineChars(fullLogFileName, argv[5], fullLogFileName); combineChars(fullLogFileName, "_", fullLogFileName); combineChars(fullLogFileName, argv[6], fullLogFileName); combineChars(fullLogFileName, "_", fullLogFileName); combineChars(fullLogFileName, argv[7], fullLogFileName); combineChars(fullLogFileName, "_", fullLogFileName); combineChars(fullLogFileName, argv[8], fullLogFileName); combineChars(fullLogFileName, "_", fullLogFileName); combineChars(fullLogFileName, argv[9], fullLogFileName); combineChars(fullLogFileName, "_", fullLogFileName); combineChars(fullLogFileName, argv[10], fullLogFileName); combineChars(fullLogFileName, "_", fullLogFileName); combineChars(fullLogFileName, argv[11], fullLogFileName); combineChars(fullLogFileName, "_", fullLogFileName); combineChars(fullLogFileName, argv[12], fullLogFileName); combineChars(fullLogFileName, ".txt", fullLogFileName); //fseek( stream, 0L, SEEK_SET ); if( (stream = fopen( fullDataFileName, "r" )) == NULL ) printf( "The data file was not opened\n" ); tab_fscanf( stream, "%s", s ); nrow=atoi(s); tab_fscanf( stream, "%s", s ); ncol=atoi(s); if( (logStream = fopen( fullLogFileName, "w" )) == NULL ) printf( "The log file was not opened\n" ); printf("read in %d genes and %d samples\n\n", nrow, ncol); fprintf(logStream, "read in %d genes and %d samples\n\n", nrow, ncol); fclose(logStream); //temp //aveComemMatrix = (short**)malloc((size_t)nrow*sizeof(short*)); //for(i=0; i<nrow; i++) // aveComemMatrix[i] = (short*)malloc((size_t)nrow*sizeof(short)); clustIndex = (int**)malloc((size_t)nrow*sizeof(int*)); for(i=0; i<nrow; i++) clustIndex[i] = (int*)malloc((size_t)nrow*sizeof(int)); clustSize= (int*)malloc((size_t)nrow*sizeof(int)); //arrange memory for sampleName, geneID and annotation data = (double**)malloc((size_t)nrow*sizeof(double*)); for(i=0; i<nrow; i++) data[i] = (double*)malloc((size_t)ncol*sizeof(double)); mask = (int**)malloc((size_t)nrow*sizeof(int*)); for(i=0; i<nrow; i++) mask[i] = (int*)malloc((size_t)ncol*sizeof(int)); weight = (double*)malloc((size_t)ncol*sizeof(double)); sampleName = (char**)malloc((size_t)ncol*sizeof(char*)); for(i=0; i<ncol; i++) sampleName[i] = (char*)malloc((size_t)maxStringLength*sizeof(char)); geneID = (char**)malloc((size_t)nrow*sizeof(char*)); for(i=0; i<nrow; i++) geneID[i] = (char*)malloc((size_t)maxStringLength*sizeof(char)); annotation = (char**)malloc((size_t)nrow*sizeof(char*)); for(i=0; i<nrow; i++) annotation[i] = (char*)malloc((size_t)maxStringLength*sizeof(char)); clusterid = (int*)malloc((size_t)nrow*sizeof(int)); cdata = (double**)malloc((size_t)400*sizeof(double*)); for(i=0; i<400; i++) cdata[i] = (double*)malloc((size_t)ncol*sizeof(double)); cmask = (int**)malloc((size_t)400*sizeof(int*)); for(i=0; i<400; i++) cmask[i] = (int*)malloc((size_t)ncol*sizeof(int)); ///////////////////////////////////////////////////// for(i=0; i<ncol; i++) weight[i]=1; tab_fscanf( stream, "%s", s ); //read in string "geneID" tab_fscanf( stream, "%s", s ); //read in string "annotation" for(i=0; i<ncol; i++) tab_fscanf(stream, "%s", sampleName[i]); //read in sampleName for(i=0; i<nrow; i++) { tab_fscanf(stream, "%s", geneID[i]); tab_fscanf(stream, "%s", annotation[i]); for(j=0; j<ncol; j++) { tab_fscanf(stream, "%s", s); if(s[0]=='\0') mask[i][j]=0; //missing value else { data[i][j]=atof(s); mask[i][j]=1; } } } fclose(stream); write_double_matrix(nrow, ncol, data, fullTempDataFileName); //select_candidateClust_alpha(3, nrow, ncol, data, mask, weight, 2, 10, // 0.7, 7, 0, clustIndex, clustSize); tightClust(targetClustNum, nrow, ncol, data, sampleName, geneID, annotation, min_k, max_k, resampNum, topNum, seqNum, alpha, beta, &seed, subSampPercnt, remainGenePercnt, clusterid, cdata, mask, weight, npass, fullLogFileName, fullTempClustFileName); //kcluster(25, nrow, ncol, data, mask, weight, 0, 1, 'a', 'e', clusterid, cdata, cmask, &error, &ifound); //printf("help\n"); //06-03-05 targetClustNum+1 is discarded, the last one is not the one we want. write_cluster_treeview(nrow, ncol, data, sampleName, geneID, annotation, targetClustNum, clusterid, outputFileName, 3, dataFile); /*calcAveComemMatrix(25, nrow, ncol, data, mask, weight, 3, 5, 0.7, aveComemMatrix); printf("help\n"); write_double_matrix(nrow, nrow, aveComemMatrix, "c:\\temp_aveComemMatrix.txt"); selectClust_One(aveComemMatrix, nrow, clustIndex, &nclusters, clustSize); write_int_matrix(nclusters, nrow, clustIndex, "c:\\temp_clustIndex.txt"); printf("nclusters: %d\n", nclusters); for(i=0; i<nclusters; i++) printf("%d\n", clustSize[i]); for(i=0; i<nrow; i++) clusterid[i]=100; for(i=0; i<100; i++) { for(j=0; j<clustSize[i]; j++) { clusterid[clustIndex[i][j]]=i; } } write_cluster_treeview(nrow, ncol, data, sampleName, geneID, annotation, 101, clusterid, "c:\\temp_clusteredData.txt", 3);*/ //scanf("%d", &i); return 0; }
void loadIniFile(moveMents *mMentsp,char * iniFilep){ char folder[]="./sdcard/\n"; char * filePath=combineChars(folder,iniFilep); char * chars=getCharsofFile(filePath); }