Cleaning up Color.cu/.cpp

This commit is contained in:
James E McClure 2015-06-30 15:12:56 -04:00
parent b4f1c45d46
commit 08e14cc261
2 changed files with 8 additions and 31 deletions

View File

@ -1416,31 +1416,7 @@ extern "C" void DensityStreamD3Q7(char *ID, double *Den, double *Copy, double *P
}
}
}
/*
extern "C" void ComputePhi(char *ID, double *Phi, double *Copy, double *Den, int N, int S)
{
int n;
double Na,Nb;
//...................................................................
// Update Phi
for (n=0; n<N; n++){
if (ID[n] > 0 && n<N){
// Get the density value (Streaming already performed)
Na = Den[2*n];
Nb = Den[2*n+1];
Phi[n] = (Na-Nb)/(Na+Nb);
// Store the copy of the current density
Copy[2*n] = Na;
Copy[2*n+1] = Nb;
// Zero the Density value to get ready for the next streaming
Den[2*n] = 0.0;
Den[2*n+1] = 0.0;
}
}
//...................................................................
}
*/
extern "C" void ComputePhi(char *ID, double *Phi, double *Den, int N)
{
int n;
@ -1449,7 +1425,7 @@ extern "C" void ComputePhi(char *ID, double *Phi, double *Den, int N)
// Update Phi
for (n=0; n<N; n++){
if (ID[n] > 0 && n<N){
if (ID[n] > 0 ){
// Get the density value (Streaming already performed)
Na = Den[n];
Nb = Den[N+n];

View File

@ -7,7 +7,7 @@ __global__ void dvc_InitDenColor(char *ID, double *Den, double *Phi, double das
{
//int i,j,k;
int n,N;
char id;
N = Nx*Ny*Nz;
int S = N/NBLOCKS/NTHREADS + 1;
@ -15,18 +15,19 @@ __global__ void dvc_InitDenColor(char *ID, double *Den, double *Phi, double das
//........Get 1-D index for this thread....................
n = S*blockIdx.x*blockDim.x + s*blockDim.x + threadIdx.x;
if (n<N){
id=ID[n];
//.......Back out the 3-D indices for node n..............
//k = n/(Nx*Ny);
//j = (n-Nx*Ny*k)/Nx;
//i = n-Nx*Ny*k-Nx*j;
if ( ID[n] == 1){
if ( id == 1){
Den[n] = 1.0;
Den[N+n] = 0.0;
Phi[n] = 1.0;
}
else if ( ID[n] == 2){
else if ( id == 2){
Den[n] = 0.0;
Den[N+n] = 1.0;
Phi[n] = -1.0;
@ -706,7 +707,7 @@ __global__ void dvc_ColorCollideOpt( char *ID, double *disteven, double *distod
n = S*blockIdx.x*blockDim.x + s*blockDim.x + threadIdx.x;
if (n<N) {
id = ID[n];
if ( id != 0){
if ( id > 0){
//.......Back out the 3-D indices for node n..............
k = n/(Nx*Ny);
@ -1388,7 +1389,7 @@ __global__ void dvc_ComputePhi(char *ID, double *Phi, double *Den, int N)
n = S*blockIdx.x*blockDim.x + s*blockDim.x + threadIdx.x;
if (n<N){
id=ID[n];
if (id != 0){
if (id > 0){
// Get the density value (Streaming already performed)
Na = Den[n];
Nb = Den[N+n];