Skip to content
Snippets Groups Projects
Select Git revision
  • 277c1f8026eb55c3b8133e81f2563d15529f205f
  • master default protected
  • parallelistation_of_subdomain_loop
  • parallelistation_test
  • nonzero_gli_term_for_nonwetting_in_TPR
  • testing_updating_pwi_as_pwiminus1_into_calculation_of_pnwi
  • v2.2
  • v2.1
  • v2.0
  • v1.0
10 results

TP-TP-2-patch-different-intrinsic-perm.py

Blame
  • image.jl 746 B
    eval_neumann(img, x) = img[clamp.(Tuple(x), axes(img))...]
    
    function interpolate_bilinear(img, x)
        x0 = floor.(Int, x)
        x1 = x0 .+ 1
    
        val = zero(eltype(img))
        for idx in CartesianIndices(ntuple(_->0:1, ndims(img)))
    	cornerbool = Bool.(Tuple(idx))
    	λ = ifelse.(cornerbool, x .- x0, x1 .- x)
    	corner = ifelse.(cornerbool, x1, x0)
    	val += prod(λ) * eval_neumann(img, CartesianIndex(corner))
        end
        return val
    end
    
    function warp_backwards(img, u)
        d = ndims(img)
        axes(img) == axes(u)[2:end] && d == size(u, 1) ||
    	throw(ArgumentError("invalid dimensions"))
    
        res = similar(img)
        for I in CartesianIndices(img)
    	x = Tuple(I) .+ ntuple(i -> u[i, I], d)
    	res[I] = interpolate_bilinear(img, x)
        end
        return res
    end