Ejemplo n.º 1
0
/* [0:left,1:rigth,2:top,3:bottom,4:front,5:back] */
void findNeighborCells(const int rank, int *neighbor_cells, const int x_proc) {
    neighbor_cells[0] = rank%x_proc ? rank-1: MPI_PROC_NULL;
    neighbor_cells[1] = (rank+1)%x_proc ? rank+1: MPI_PROC_NULL;
    neighbor_cells[2] = (getRankY(rank,x_proc)+1)%x_proc ? rank+x_proc : MPI_PROC_NULL;
    neighbor_cells[3] = (getRankY(rank,x_proc))%x_proc ? rank-x_proc : MPI_PROC_NULL;
    neighbor_cells[4] = (getRankZ(rank,x_proc)+1)%x_proc ? rank+x_proc*x_proc : MPI_PROC_NULL;
    neighbor_cells[5] = (getRankZ(rank,x_proc))%x_proc ? rank-x_proc*x_proc : MPI_PROC_NULL;
}
Ejemplo n.º 2
0
void write_vtkPointCoordinates( FILE *fp, int xlength, int rank, int x_proc) {
    double origin_x=getRankX(rank,x_proc)*(xlength-1.0)/xlength,
            origin_y=getRankY(rank,x_proc)*(xlength-1.0)/xlength,
            origin_z=getRankZ(rank,x_proc)*(xlength-1.0)/xlength;
    int i=0, j=0, k=0;
    
    for(k = 0; k<xlength; k++){
        for(j = 0; j<xlength; j++){
            for(i = 0; i<xlength; i++){
                fprintf(fp, "%f %f %f\n", origin_x+(i*1.0/xlength), origin_y+(j*1.0/xlength), origin_z+(k*1.0/xlength));
            }
        }
    }
}
Ejemplo n.º 3
0
void egHWU::sgLocusRank()
{
	transX();
	prepareY();
	stdW();

	if(par::multi_core){
		D2F();
		getRankZfltMp();
	}else{
		if(!par::hwu_flt){
			getRankZ();
		}else{
			D2F();
			getRankZfloat();
		}
	}
	
	

	vector<double> x;

	cout<<"\nP-value for ranked:\n";
	double pvalue;
	for(int i_=0; i_<_idx.size(); i_++){
		int i=_idx[i_];
		cout<<i_+1<<"th SNP";
		x.clear();
		//cout<<":"<<(_datafile->getLocus(i))->name;
		prepareX(i,x);

		pvalue=hwu_liu(x);
		_vec_pvalue.push_back(pvalue);
		cout<<"\r";
		cout.flush();
	}

}
Ejemplo n.º 4
0
void initialiseFields(double *collideField, double *streamField, int *flagField, int xlength, const int rank, const int number_of_ranks, const int x_proc){
    int x,y,z,i,step=xlength+2;
    
    /* NOTE: We use z=xlength+1 as the moving wall */
    for(x=0;x<step;x++){
        for(y=0;y<step;y++){
            for(z=0;z<step;z++){
                /* Initializing flags */
                if(y == xlength+1 && getRankY(rank,x_proc)==x_proc-1)
                    flagField[x+y*step+z*step*step]=MOVING_WALL;
                else if((x == 0 && getRankX(rank,x_proc)==0) || (x == xlength+1 && getRankX(rank,x_proc)==x_proc-1)
                    || (y == 0 && getRankY(rank,x_proc)==0)
                    || (z == xlength+1 && getRankZ(rank,x_proc)==x_proc-1) || (z == 0  && getRankZ(rank,x_proc)==0))
                    flagField[x+y*step+z*step*step]=NO_SLIP;
                else if(x == 0 || x == xlength+1 || y == 0 || y == xlength+1 || z == 0 || z == xlength+1)
                    flagField[x+y*step+z*step*step]=PARALLEL_BOUNDARY;
                else
                    flagField[x+y*step+z*step*step]=FLUID;
                
                /* Initializing distributions for stream and collide fields */
                for(i=0;i<Q_LBM;i++){
                    /* NOTE:Stream field is initilized to 0s because that helps to 
                     * track down mistakes and has no impact whatsoever to on the 
                     * computation further on.
                     */
                    if(flagField[x+y*step+z*step*step] !=PARALLEL_BOUNDARY) {
                        streamField[Q_LBM*(x+y*step+z*step*step)+i]=0;
                        collideField[Q_LBM*(x+y*step+z*step*step)+i]=LATTICEWEIGHTS[i];
                    } else {
                        collideField[Q_LBM*(x+y*step+z*step*step)+i]=0;
                    }
                }
            }
        }
    }
}