void CBlockType2::reBuild() { for (int i = 0; i < getBlockNum(); i++) { delete getRectArr()[i]; } setBlockNum(rand() % 3 + 4); for (int i = 0; i < getBlockNum(); i++) { CRectangle *temp = new CRectangle(getX(), getY() + ((i * 2) * 16), 16); temp->setColor(getColor()); setRectArr(i, temp); } }
void CBlockType2::render(HDC hdc) { for (int i = 0; i < getBlockNum(); i++) { getRectArr()[i]->render(hdc); } }
void BlockExpandLayer::forward(PassType passType) { Layer::forward(passType); size_t batchSize = inputLayers_[0]->getOutputValue()->getHeight(); size_t blockNum = getBlockNum(); size_t blockSize = blockH_ * blockW_ * channels_; resetOutput(blockNum * batchSize, blockSize); // calculate output_.value inputShape_ = TensorShape({batchSize, channels_, imgSizeH_, imgSizeW_}); outputShape_ = TensorShape({batchSize, blockNum, blockSize}); BufferArgs inputs; BufferArgs outputs; inputs.addArg(*getInputValue(0), inputShape_); outputs.addArg(*getOutputValue(), outputShape_, ASSIGN_TO); forward_[0]->calc(inputs, outputs); // calculate output_.sequenceStartPositions and output_.cpuSequenceDims Argument& out = getOutput(); ICpuGpuVector::resizeOrCreate( out.sequenceStartPositions, batchSize + 1, false); IVector::resizeOrCreate(out.cpuSequenceDims, 2 * batchSize, false); int* start = out.sequenceStartPositions->getMutableData(false); int* dims = out.cpuSequenceDims->getData(); for (size_t i = 0; i < batchSize; i++) { start[i] = i * blockNum; dims[2 * i] = outputH_; dims[2 * i + 1] = outputW_; } start[batchSize] = batchSize * blockNum; }
CBlockType2::CBlockType2(const int &x, const int &y) :CBlock(x,y) { for (int i = 0; i < getBlockNum(); i++) { CRectangle *temp = new CRectangle(x, y + ((i * 2) * 16), 16); temp->setColor(getColor()); setRectArr(i, temp); } }
void abcDstat2::print(funkyPars *pars){ if(doAbbababa2==0) return; funkyAbbababa2 *abbababaStruct = (funkyAbbababa2 *) pars->extras[index];//new if(currentChr==-1){//if first chunk DENprint=0; // NUMprint=0; //numerator for current block Eprint = 0; for(int i=0;i<256;i++) COMBprint[i]=0; //start new block getBlockNum(pars->posi[0]); currentChr=0; } while(currentChr!=pars->refId){ //if new chr (not first) //start new block printAndEmpty(block*blockSize,currentChr); currentChr=pars->refId; getBlockNum(pars->posi[0]); } for(int i=0;i<256;i++) COMBprint[i] += abbababaStruct->COMB[i]; //????? for(int s=0;s<pars->numSites;s++){ int comp=0; if(pars->posi[s]>=block*blockSize+blockSize){ printAndEmpty(block*blockSize,pars->refId); getBlockNum(pars->posi[s]); } if(pars->keepSites[s]==0) continue; NUMprint+=abbababaStruct->NUM[s]; DENprint+=abbababaStruct->DEN[s]; NSITEprint++; if(abbababaStruct->NUM[s]>abbababaStruct->DEN[s]) Eprint += 1; } }//---end of abcDstat2::print(funkyPars *pars)
void put_inode(int devId, int ino, INODE *linode) { //Get block //Overwrite where inode should be //write back INODE backup = *linode; char buf[BLKSIZE]; char *cp; int blockNum = getBlockNum(ino, devId); int block = getBlock(ino, devId); get_block(devId, blockNum, buf); INODE *dInode = (INODE*)buf + block; //printf("Putting INODE: \n"); //printInode(&backup); *dInode = backup; //copy values over //printf("Updated INODE: \n"); //printInode(dInode); put_block(devId, blockNum, buf); }
/* used to look up the block via the inode */ INODE* get_inode(int devId, int ino) { char buf[BLKSIZE]; get_block(devId, getBlockNum(ino, devId), buf); return (INODE*)buf + getBlock(ino, devId);//Skip past the nodes we don't need }
T RoundUp(T size, T block) { return getBlockNum(size, block) * block; }
void abcDstat::print(funkyPars *pars){ // fprintf(stderr,"currentpos %lu %d\n",currentPos,header->l_ref[currentChr]); if(doAbbababa==0) return; funkyAbbababa *abbababaStruct = (funkyAbbababa *) pars->extras[index];//new if(currentChr==-1){//if first chunk //start new block for(int j=0;j<nComb;j++){ ABBA[j]=0; BABA[j]=0; } getBlockNum(pars->posi[0]); currentChr=0; } while(currentChr!=pars->refId){//if new chr (not first) //start new block printAndEmpty(); currentChr++; getBlockNum(pars->posi[0]); } for(int s=0;s<pars->numSites;s++){ int comp=0; if(pars->posi[s]>=block*blockSize+blockSize){ printAndEmpty(); getBlockNum(pars->posi[s]); } if(pars->keepSites[s]==0) continue; for(int h3=0; h3<(pars->nInd); h3++){ for(int h2=0; h2<(pars->nInd); h2++){ if(h2==h3) continue; for(int h1=0; h1<h2; h1++){ if(h1==h3) continue; if(abbababaStruct->ABCD[s][comp]==4) ABBA[comp]++; else if(abbababaStruct->ABCD[s][comp]==7){ BABA[comp]++; } comp++; } } } } /* for(int p=currentPos;p<abbababaStruct->start;p++){ if(p % NbasesPerLine == 0) fprintf(outfile,"\n"); fprintf(outfile,"N"); currentPos++; } int c=0; for(int p=currentPos;p<abbababaStruct->stop;p++){ if(p==pars->posi[c]){ if(p % NbasesPerLine == 0) fprintf(outfile,"\n"); fprintf(outfile,"%d",abbababaStruct->seq[c]); // fprintf(stdout,"%lu%d\t%c\n",currentPos+1,pars->posi[c],abbababaStruct->seq[c]); c++; } else{ if(p % NbasesPerLine == 0) fprintf(outfile,"\n"); fprintf(outfile,"N"); } currentPos++; } */ }