set bounds for all arrays
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
e5ce16a734
commit
878f839f65
@ -5,6 +5,347 @@
|
|||||||
#include "fluid/env/utilities.h"
|
#include "fluid/env/utilities.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void fluid_solve_bounds_checker(float ** arrays){
|
||||||
|
int i, j;
|
||||||
|
int neighborIndex;
|
||||||
|
//x+ face
|
||||||
|
neighborIndex = CK(2,1,1);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
for(i = 1; i < DIM-1; i++){
|
||||||
|
for(j = 1; j < DIM-1; j++){
|
||||||
|
arrays[CENTER_LOC][IX(DIM-1, i, j)] = arrays[neighborIndex][IX( 1, i, j)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(i = 1; i < DIM; i++){
|
||||||
|
for(j = 1; j < DIM; j++){
|
||||||
|
arrays[CENTER_LOC][IX(DIM-1, i, j)] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//x- face
|
||||||
|
neighborIndex = CK(0,1,1);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
for(i = 1; i < DIM-1; i++){
|
||||||
|
for(j = 1; j < DIM-1; j++){
|
||||||
|
arrays[CENTER_LOC][IX(0, i, j)] = arrays[neighborIndex][IX(DIM-2, i, j)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(i = 1; i < DIM-1; i++){
|
||||||
|
for(j = 1; j < DIM-1; j++){
|
||||||
|
arrays[CENTER_LOC][IX(0, i, j)] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//y+ face
|
||||||
|
neighborIndex = CK(1,2,1);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
for(i = 1; i < DIM-1; i++){
|
||||||
|
for(j = 1; j < DIM-1; j++){
|
||||||
|
arrays[CENTER_LOC][IX( i, DIM-1, j)] = arrays[neighborIndex][IX( i, 1, j)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(i = 1; i < DIM-1; i++){
|
||||||
|
for(j = 1; j < DIM-1; j++){
|
||||||
|
arrays[CENTER_LOC][IX( i, DIM-1, j)] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//y- face
|
||||||
|
neighborIndex = CK(1,0,1);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
for(i = 1; i < DIM-1; i++){
|
||||||
|
for(j = 1; j < DIM-1; j++){
|
||||||
|
arrays[CENTER_LOC][IX(i, 0, j)] = arrays[neighborIndex][IX( i, DIM-2, j)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(i = 1; i < DIM-1; i++){
|
||||||
|
for(j = 1; j < DIM-1; j++){
|
||||||
|
arrays[CENTER_LOC][IX(i, 0, j)] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//z+ face
|
||||||
|
neighborIndex = CK(1,1,2);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
for(i = 1; i < DIM-1; i++){
|
||||||
|
for(j = 1; j < DIM-1; j++){
|
||||||
|
arrays[CENTER_LOC][IX( i, j, DIM-1)] = arrays[neighborIndex][IX( i, j, 1)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(i = 1; i < DIM-1; i++){
|
||||||
|
for(j = 1; j < DIM-1; j++){
|
||||||
|
arrays[CENTER_LOC][IX( i, j, DIM-1)] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//z- face
|
||||||
|
neighborIndex = CK(1,1,0);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
for(i = 1; i < DIM-1; i++){
|
||||||
|
for(j = 1; j < DIM-1; j++){
|
||||||
|
arrays[CENTER_LOC][IX(i, j, 0)] = arrays[neighborIndex][IX( i, j, DIM-2)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(i = 1; i < DIM-1; i++){
|
||||||
|
for(j = 1; j < DIM-1; j++){
|
||||||
|
arrays[CENTER_LOC][IX(i, j, 0)] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// edges
|
||||||
|
//
|
||||||
|
|
||||||
|
//x+ y+ edge
|
||||||
|
neighborIndex = CK(2,2,1);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
for(i = 1; i < DIM-1; i++){
|
||||||
|
arrays[CENTER_LOC][IX(DIM-1, DIM-1, i)] = arrays[neighborIndex][IX( 1, 1, i)];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(i = 1; i < DIM; i++){
|
||||||
|
arrays[CENTER_LOC][IX(DIM-1, DIM-1, i)] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//x+ y- edge
|
||||||
|
neighborIndex = CK(2,0,1);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
for(i = 1; i < DIM-1; i++){
|
||||||
|
arrays[CENTER_LOC][IX(DIM-1, 0, i)] = arrays[neighborIndex][IX( 1, DIM-2, i)];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(i = 1; i < DIM; i++){
|
||||||
|
arrays[CENTER_LOC][IX(DIM-1, 0, i)] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//x- y+ edge
|
||||||
|
neighborIndex = CK(0,2,1);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
for(i = 1; i < DIM-1; i++){
|
||||||
|
arrays[CENTER_LOC][IX( 0, DIM-1, i)] = arrays[neighborIndex][IX( DIM-2, 1, i)];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(i = 1; i < DIM; i++){
|
||||||
|
arrays[CENTER_LOC][IX( 0, DIM-1, i)] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//x- y- edge
|
||||||
|
neighborIndex = CK(0,0,1);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
for(i = 1; i < DIM-1; i++){
|
||||||
|
arrays[CENTER_LOC][IX( 0, 0, i)] = arrays[neighborIndex][IX( DIM-2, DIM-2, i)];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(i = 1; i < DIM; i++){
|
||||||
|
arrays[CENTER_LOC][IX( 0, 0, i)] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//x+ z+ edge
|
||||||
|
neighborIndex = CK(2,1,2);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
for(i = 1; i < DIM-1; i++){
|
||||||
|
arrays[CENTER_LOC][IX(DIM-1, i, DIM-1)] = arrays[neighborIndex][IX( 1, i, 1)];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(i = 1; i < DIM; i++){
|
||||||
|
arrays[CENTER_LOC][IX(DIM-1, i, DIM-1)] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//x+ z- edge
|
||||||
|
neighborIndex = CK(2,1,0);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
for(i = 1; i < DIM-1; i++){
|
||||||
|
arrays[CENTER_LOC][IX(DIM-1, i, 0)] = arrays[neighborIndex][IX( 1, i, DIM-2)];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(i = 1; i < DIM; i++){
|
||||||
|
arrays[CENTER_LOC][IX(DIM-1, i, 0)] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//x- z+ edge
|
||||||
|
neighborIndex = CK(0,1,2);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
for(i = 1; i < DIM-1; i++){
|
||||||
|
arrays[CENTER_LOC][IX( 0, i, DIM-1)] = arrays[neighborIndex][IX( DIM-2, i, 1)];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(i = 1; i < DIM; i++){
|
||||||
|
arrays[CENTER_LOC][IX( 0, i, DIM-1)] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//x- z- edge
|
||||||
|
neighborIndex = CK(0,1,0);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
for(i = 1; i < DIM-1; i++){
|
||||||
|
arrays[CENTER_LOC][IX( 0, i, 0)] = arrays[neighborIndex][IX( DIM-2, i, DIM-2)];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(i = 1; i < DIM; i++){
|
||||||
|
arrays[CENTER_LOC][IX( 0, i, 0)] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//y+ z+ edge
|
||||||
|
neighborIndex = CK(1,2,2);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
for(i = 1; i < DIM-1; i++){
|
||||||
|
arrays[CENTER_LOC][IX( i, DIM-1, DIM-1)] = arrays[neighborIndex][IX( i, 1, 1)];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(i = 1; i < DIM; i++){
|
||||||
|
arrays[CENTER_LOC][IX( i, DIM-1, DIM-1)] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//y+ z- edge
|
||||||
|
neighborIndex = CK(1,2,0);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
for(i = 1; i < DIM-1; i++){
|
||||||
|
arrays[CENTER_LOC][IX( i,DIM-1, 0)] = arrays[neighborIndex][IX( i, 1, DIM-2)];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(i = 1; i < DIM; i++){
|
||||||
|
arrays[CENTER_LOC][IX( i,DIM-1, 0)] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//y- z+ edge
|
||||||
|
neighborIndex = CK(1,0,2);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
for(i = 1; i < DIM-1; i++){
|
||||||
|
arrays[CENTER_LOC][IX( i, 0, DIM-1)] = arrays[neighborIndex][IX( i, DIM-2, 1)];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(i = 1; i < DIM; i++){
|
||||||
|
arrays[CENTER_LOC][IX( i, 0, DIM-1)] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//y- z- edge
|
||||||
|
neighborIndex = CK(1,0,0);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
for(i = 1; i < DIM-1; i++){
|
||||||
|
arrays[CENTER_LOC][IX( i, 0, 0)] = arrays[neighborIndex][IX( i, DIM-2, DIM-2)];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(i = 1; i < DIM; i++){
|
||||||
|
arrays[CENTER_LOC][IX( i, 0, 0)] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// CORNERS
|
||||||
|
//
|
||||||
|
|
||||||
|
//x+ y+ z+ corner
|
||||||
|
neighborIndex = CK(2,2,2);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
arrays[CENTER_LOC][IX(DIM-1, DIM-1, DIM-1)] = arrays[neighborIndex][IX( 1, 1, 1)];
|
||||||
|
} else {
|
||||||
|
arrays[CENTER_LOC][IX(DIM-1, DIM-1, DIM-1)] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//x+ y+ z- corner
|
||||||
|
neighborIndex = CK(2,2,0);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
arrays[CENTER_LOC][IX(DIM-1, DIM-1, 0)] = arrays[neighborIndex][IX( 1, 1, DIM-2)];
|
||||||
|
} else {
|
||||||
|
arrays[CENTER_LOC][IX(DIM-1, DIM-1, 0)] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//x+ y- z+ corner
|
||||||
|
neighborIndex = CK(2,0,2);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
arrays[CENTER_LOC][IX(DIM-1, 0, DIM-1)] = arrays[neighborIndex][IX( 1, DIM-2, 1)];
|
||||||
|
} else {
|
||||||
|
arrays[CENTER_LOC][IX(DIM-1, 0, DIM-1)] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//x+ y- z- corner
|
||||||
|
neighborIndex = CK(2,0,0);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
arrays[CENTER_LOC][IX(DIM-1, 0, 0)] = arrays[neighborIndex][IX( 1, DIM-2, DIM-2)];
|
||||||
|
} else {
|
||||||
|
arrays[CENTER_LOC][IX(DIM-1, 0, 0)] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//x- y+ z+ corner
|
||||||
|
neighborIndex = CK(0,2,2);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
arrays[CENTER_LOC][IX(0, DIM-1, DIM-1)] = arrays[neighborIndex][IX( DIM-2, 1, 1)];
|
||||||
|
} else {
|
||||||
|
arrays[CENTER_LOC][IX(0, DIM-1, DIM-1)] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//x- y+ z- corner
|
||||||
|
neighborIndex = CK(0,2,0);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
arrays[CENTER_LOC][IX(0, DIM-1, 0)] = arrays[neighborIndex][IX( DIM-2, 1, DIM-2)];
|
||||||
|
} else {
|
||||||
|
arrays[CENTER_LOC][IX(0, DIM-1, 0)] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//x- y- z+ corner
|
||||||
|
neighborIndex = CK(0,0,2);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
arrays[CENTER_LOC][IX(0, 0, DIM-1)] = arrays[neighborIndex][IX( DIM-2, DIM-2, 1)];
|
||||||
|
} else {
|
||||||
|
arrays[CENTER_LOC][IX(0, 0, DIM-1)] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//x- y- z- corner
|
||||||
|
neighborIndex = CK(0,0,0);
|
||||||
|
if(arrays[neighborIndex] != NULL){
|
||||||
|
arrays[CENTER_LOC][IX(0, 0, 0)] = arrays[neighborIndex][IX( DIM-2, DIM-2, DIM-2)];
|
||||||
|
} else {
|
||||||
|
arrays[CENTER_LOC][IX(0, 0, 0)] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the boundary values for each chunk
|
* Sets the boundary values for each chunk
|
||||||
* @param numReadIn The number of chunks
|
* @param numReadIn The number of chunks
|
||||||
@ -18,342 +359,15 @@ LIBRARY_API void fluid_solve_bounds(int numReadIn, Chunk ** chunkViewC, Environm
|
|||||||
int neighborIndex;
|
int neighborIndex;
|
||||||
for(chunkIndex = 0; chunkIndex < numReadIn; chunkIndex++){
|
for(chunkIndex = 0; chunkIndex < numReadIn; chunkIndex++){
|
||||||
Chunk * current = chunkViewC[chunkIndex];
|
Chunk * current = chunkViewC[chunkIndex];
|
||||||
|
fluid_solve_bounds_checker(current->d);
|
||||||
//x+ face
|
fluid_solve_bounds_checker(current->d0);
|
||||||
neighborIndex = CK(2,1,1);
|
fluid_solve_bounds_checker(current->u);
|
||||||
if(current->d[neighborIndex] != NULL){
|
fluid_solve_bounds_checker(current->v);
|
||||||
for(i = 1; i < DIM-1; i++){
|
fluid_solve_bounds_checker(current->w);
|
||||||
for(j = 1; j < DIM-1; j++){
|
fluid_solve_bounds_checker(current->u0);
|
||||||
current->d[CENTER_LOC][IX(DIM-1, i, j)] = current->d[neighborIndex][IX( 1, i, j)];
|
fluid_solve_bounds_checker(current->v0);
|
||||||
}
|
fluid_solve_bounds_checker(current->w0);
|
||||||
}
|
fluid_solve_bounds_checker(current->bounds);
|
||||||
} else {
|
|
||||||
for(i = 1; i < DIM; i++){
|
|
||||||
for(j = 1; j < DIM; j++){
|
|
||||||
current->d[CENTER_LOC][IX(DIM-1, i, j)] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//x- face
|
|
||||||
neighborIndex = CK(0,1,1);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
for(i = 1; i < DIM-1; i++){
|
|
||||||
for(j = 1; j < DIM-1; j++){
|
|
||||||
current->d[CENTER_LOC][IX(0, i, j)] = current->d[neighborIndex][IX(DIM-2, i, j)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for(i = 1; i < DIM-1; i++){
|
|
||||||
for(j = 1; j < DIM-1; j++){
|
|
||||||
current->d[CENTER_LOC][IX(0, i, j)] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//y+ face
|
|
||||||
neighborIndex = CK(1,2,1);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
for(i = 1; i < DIM-1; i++){
|
|
||||||
for(j = 1; j < DIM-1; j++){
|
|
||||||
current->d[CENTER_LOC][IX( i, DIM-1, j)] = current->d[neighborIndex][IX( i, 1, j)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for(i = 1; i < DIM-1; i++){
|
|
||||||
for(j = 1; j < DIM-1; j++){
|
|
||||||
current->d[CENTER_LOC][IX( i, DIM-1, j)] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//y- face
|
|
||||||
neighborIndex = CK(1,0,1);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
for(i = 1; i < DIM-1; i++){
|
|
||||||
for(j = 1; j < DIM-1; j++){
|
|
||||||
current->d[CENTER_LOC][IX(i, 0, j)] = current->d[neighborIndex][IX( i, DIM-2, j)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for(i = 1; i < DIM-1; i++){
|
|
||||||
for(j = 1; j < DIM-1; j++){
|
|
||||||
current->d[CENTER_LOC][IX(i, 0, j)] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//z+ face
|
|
||||||
neighborIndex = CK(1,1,2);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
for(i = 1; i < DIM-1; i++){
|
|
||||||
for(j = 1; j < DIM-1; j++){
|
|
||||||
current->d[CENTER_LOC][IX( i, j, DIM-1)] = current->d[neighborIndex][IX( i, j, 1)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for(i = 1; i < DIM-1; i++){
|
|
||||||
for(j = 1; j < DIM-1; j++){
|
|
||||||
current->d[CENTER_LOC][IX( i, j, DIM-1)] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//z- face
|
|
||||||
neighborIndex = CK(1,1,0);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
for(i = 1; i < DIM-1; i++){
|
|
||||||
for(j = 1; j < DIM-1; j++){
|
|
||||||
current->d[CENTER_LOC][IX(i, j, 0)] = current->d[neighborIndex][IX( i, j, DIM-2)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for(i = 1; i < DIM-1; i++){
|
|
||||||
for(j = 1; j < DIM-1; j++){
|
|
||||||
current->d[CENTER_LOC][IX(i, j, 0)] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// edges
|
|
||||||
//
|
|
||||||
|
|
||||||
//x+ y+ edge
|
|
||||||
neighborIndex = CK(2,2,1);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
for(i = 1; i < DIM-1; i++){
|
|
||||||
current->d[CENTER_LOC][IX(DIM-1, DIM-1, i)] = current->d[neighborIndex][IX( 1, 1, i)];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for(i = 1; i < DIM; i++){
|
|
||||||
current->d[CENTER_LOC][IX(DIM-1, DIM-1, i)] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//x+ y- edge
|
|
||||||
neighborIndex = CK(2,0,1);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
for(i = 1; i < DIM-1; i++){
|
|
||||||
current->d[CENTER_LOC][IX(DIM-1, 0, i)] = current->d[neighborIndex][IX( 1, DIM-2, i)];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for(i = 1; i < DIM; i++){
|
|
||||||
current->d[CENTER_LOC][IX(DIM-1, 0, i)] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//x- y+ edge
|
|
||||||
neighborIndex = CK(0,2,1);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
for(i = 1; i < DIM-1; i++){
|
|
||||||
current->d[CENTER_LOC][IX( 0, DIM-1, i)] = current->d[neighborIndex][IX( DIM-2, 1, i)];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for(i = 1; i < DIM; i++){
|
|
||||||
current->d[CENTER_LOC][IX( 0, DIM-1, i)] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//x- y- edge
|
|
||||||
neighborIndex = CK(0,0,1);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
for(i = 1; i < DIM-1; i++){
|
|
||||||
current->d[CENTER_LOC][IX( 0, 0, i)] = current->d[neighborIndex][IX( DIM-2, DIM-2, i)];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for(i = 1; i < DIM; i++){
|
|
||||||
current->d[CENTER_LOC][IX( 0, 0, i)] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//x+ z+ edge
|
|
||||||
neighborIndex = CK(2,1,2);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
for(i = 1; i < DIM-1; i++){
|
|
||||||
current->d[CENTER_LOC][IX(DIM-1, i, DIM-1)] = current->d[neighborIndex][IX( 1, i, 1)];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for(i = 1; i < DIM; i++){
|
|
||||||
current->d[CENTER_LOC][IX(DIM-1, i, DIM-1)] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//x+ z- edge
|
|
||||||
neighborIndex = CK(2,1,0);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
for(i = 1; i < DIM-1; i++){
|
|
||||||
current->d[CENTER_LOC][IX(DIM-1, i, 0)] = current->d[neighborIndex][IX( 1, i, DIM-2)];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for(i = 1; i < DIM; i++){
|
|
||||||
current->d[CENTER_LOC][IX(DIM-1, i, 0)] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//x- z+ edge
|
|
||||||
neighborIndex = CK(0,1,2);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
for(i = 1; i < DIM-1; i++){
|
|
||||||
current->d[CENTER_LOC][IX( 0, i, DIM-1)] = current->d[neighborIndex][IX( DIM-2, i, 1)];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for(i = 1; i < DIM; i++){
|
|
||||||
current->d[CENTER_LOC][IX( 0, i, DIM-1)] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//x- z- edge
|
|
||||||
neighborIndex = CK(0,1,0);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
for(i = 1; i < DIM-1; i++){
|
|
||||||
current->d[CENTER_LOC][IX( 0, i, 0)] = current->d[neighborIndex][IX( DIM-2, i, DIM-2)];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for(i = 1; i < DIM; i++){
|
|
||||||
current->d[CENTER_LOC][IX( 0, i, 0)] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//y+ z+ edge
|
|
||||||
neighborIndex = CK(1,2,2);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
for(i = 1; i < DIM-1; i++){
|
|
||||||
current->d[CENTER_LOC][IX( i, DIM-1, DIM-1)] = current->d[neighborIndex][IX( i, 1, 1)];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for(i = 1; i < DIM; i++){
|
|
||||||
current->d[CENTER_LOC][IX( i, DIM-1, DIM-1)] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//y+ z- edge
|
|
||||||
neighborIndex = CK(1,2,0);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
for(i = 1; i < DIM-1; i++){
|
|
||||||
current->d[CENTER_LOC][IX( i,DIM-1, 0)] = current->d[neighborIndex][IX( i, 1, DIM-2)];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for(i = 1; i < DIM; i++){
|
|
||||||
current->d[CENTER_LOC][IX( i,DIM-1, 0)] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//y- z+ edge
|
|
||||||
neighborIndex = CK(1,0,2);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
for(i = 1; i < DIM-1; i++){
|
|
||||||
current->d[CENTER_LOC][IX( i, 0, DIM-1)] = current->d[neighborIndex][IX( i, DIM-2, 1)];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for(i = 1; i < DIM; i++){
|
|
||||||
current->d[CENTER_LOC][IX( i, 0, DIM-1)] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//y- z- edge
|
|
||||||
neighborIndex = CK(1,0,0);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
for(i = 1; i < DIM-1; i++){
|
|
||||||
current->d[CENTER_LOC][IX( i, 0, 0)] = current->d[neighborIndex][IX( i, DIM-2, DIM-2)];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for(i = 1; i < DIM; i++){
|
|
||||||
current->d[CENTER_LOC][IX( i, 0, 0)] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// CORNERS
|
|
||||||
//
|
|
||||||
|
|
||||||
//x+ y+ z+ corner
|
|
||||||
neighborIndex = CK(2,2,2);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
current->d[CENTER_LOC][IX(DIM-1, DIM-1, DIM-1)] = current->d[neighborIndex][IX( 1, 1, 1)];
|
|
||||||
} else {
|
|
||||||
current->d[CENTER_LOC][IX(DIM-1, DIM-1, DIM-1)] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//x+ y+ z- corner
|
|
||||||
neighborIndex = CK(2,2,0);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
current->d[CENTER_LOC][IX(DIM-1, DIM-1, 0)] = current->d[neighborIndex][IX( 1, 1, DIM-2)];
|
|
||||||
} else {
|
|
||||||
current->d[CENTER_LOC][IX(DIM-1, DIM-1, 0)] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//x+ y- z+ corner
|
|
||||||
neighborIndex = CK(2,0,2);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
current->d[CENTER_LOC][IX(DIM-1, 0, DIM-1)] = current->d[neighborIndex][IX( 1, DIM-2, 1)];
|
|
||||||
} else {
|
|
||||||
current->d[CENTER_LOC][IX(DIM-1, 0, DIM-1)] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//x+ y- z- corner
|
|
||||||
neighborIndex = CK(2,0,0);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
current->d[CENTER_LOC][IX(DIM-1, 0, 0)] = current->d[neighborIndex][IX( 1, DIM-2, DIM-2)];
|
|
||||||
} else {
|
|
||||||
current->d[CENTER_LOC][IX(DIM-1, 0, 0)] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//x- y+ z+ corner
|
|
||||||
neighborIndex = CK(0,2,2);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
current->d[CENTER_LOC][IX(0, DIM-1, DIM-1)] = current->d[neighborIndex][IX( DIM-2, 1, 1)];
|
|
||||||
} else {
|
|
||||||
current->d[CENTER_LOC][IX(0, DIM-1, DIM-1)] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//x- y+ z- corner
|
|
||||||
neighborIndex = CK(0,2,0);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
current->d[CENTER_LOC][IX(0, DIM-1, 0)] = current->d[neighborIndex][IX( DIM-2, 1, DIM-2)];
|
|
||||||
} else {
|
|
||||||
current->d[CENTER_LOC][IX(0, DIM-1, 0)] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//x- y- z+ corner
|
|
||||||
neighborIndex = CK(0,0,2);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
current->d[CENTER_LOC][IX(0, 0, DIM-1)] = current->d[neighborIndex][IX( DIM-2, DIM-2, 1)];
|
|
||||||
} else {
|
|
||||||
current->d[CENTER_LOC][IX(0, 0, DIM-1)] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//x- y- z- corner
|
|
||||||
neighborIndex = CK(0,0,0);
|
|
||||||
if(current->d[neighborIndex] != NULL){
|
|
||||||
current->d[CENTER_LOC][IX(0, 0, 0)] = current->d[neighborIndex][IX( DIM-2, DIM-2, DIM-2)];
|
|
||||||
} else {
|
|
||||||
current->d[CENTER_LOC][IX(0, 0, 0)] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user