[CSC 435] Diffusion and the Mask Boundaries

Andrew Pounds pounds_aj at mercer.edu
Sun May 1 20:24:39 EDT 2016


I know that a couple of weeks ago you guys were wondering how to modify 
the jacobi tile algorithm so that it worked nicely at the boundaries and 
around the mask.  Here is something that I found that I wrote years 
ago.    I changed the variable names so that they matched what I sent 
out earlier.  Feel free to try this one too.

I seem to remember that you all were having problems with the first 
elements not updating.  This should fix those problems.

tempbox(k,j,i) = box(k,j,i) +  &
                             (  (  box(k,j,i-1) * mask(k,j,i-1) +  
box(k,j,i+1) * mask(k,j,i+1) - &
                                ( 
mask(k,j,i-1)                                 + mask(k,j,i+1) ) &
                                *  box(k,j,i)) + &
                                (  box(k,j-1,i) * mask(k,j-1,i) +  
box(k,j+1,i) * mask(k,j+1,i) - &
                                ( 
mask(k,j-1,i)                                 + mask(k,j+1,i) ) &
                                *  box(k,j,i)) + &
                                (  box(k-1,j,i) * mask(k-1,j,i) +  
box(k+1,j,i) * mask(k+1,j,i) - &
                                ( 
mask(k-1,j,i)                                 + mask(k+1,j,i) ) &
                                *  box(k,j,i)) ) &
                                * scalar

Forgive the "old maid" code lining up -- but that is the only way I have 
ever been successful lining up all of the parenthesis.

By the way -- there are lots of ways to make this faster.


More information about the csc435 mailing list