Mercurial > repos > public > sbplib_julia
comparison DiffOps/src/DiffOps.jl @ 291:0f94dc29c4bf
Merge in branch boundary_conditions
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 22 Jun 2020 21:43:05 +0200 |
parents | ce6a2f3f732a |
children | d5475ad78b28 |
comparison
equal
deleted
inserted
replaced
231:fbabfd4e8f20 | 291:0f94dc29c4bf |
---|---|
1 module DiffOps | 1 module DiffOps |
2 | 2 |
3 using RegionIndices | 3 using RegionIndices |
4 using SbpOperators | 4 using SbpOperators |
5 using Grids | 5 using Grids |
6 using LazyTensors | |
6 | 7 |
7 """ | 8 """ |
8 DiffOp | 9 DiffOp |
9 | 10 |
10 Supertype of differential operator discretisations. | 11 Supertype of differential operator discretisations. |
44 return nothing | 45 return nothing |
45 end | 46 end |
46 | 47 |
47 # Maybe this should be split according to b3fbef345810 after all?! Seems like it makes performance more predictable | 48 # Maybe this should be split according to b3fbef345810 after all?! Seems like it makes performance more predictable |
48 function apply_region!(D::DiffOpCartesian{2}, u::AbstractArray{T,2}, v::AbstractArray{T,2}, r1::Type{<:Region}, r2::Type{<:Region}) where T | 49 function apply_region!(D::DiffOpCartesian{2}, u::AbstractArray{T,2}, v::AbstractArray{T,2}, r1::Type{<:Region}, r2::Type{<:Region}) where T |
49 for I ∈ regionindices(D.grid.size, closureSize(D.op), (r1,r2)) | 50 for I ∈ regionindices(D.grid.size, closuresize(D.op), (r1,r2)) |
50 @inbounds indextuple = (Index{r1}(I[1]), Index{r2}(I[2])) | 51 @inbounds indextuple = (Index{r1}(I[1]), Index{r2}(I[2])) |
51 @inbounds u[I] = apply(D, v, indextuple) | 52 @inbounds u[I] = apply(D, v, indextuple) |
52 end | 53 end |
53 return nothing | 54 return nothing |
54 end | 55 end |
67 return nothing | 68 return nothing |
68 end | 69 end |
69 | 70 |
70 using TiledIteration | 71 using TiledIteration |
71 function apply_region_tiled!(D::DiffOpCartesian{2}, u::AbstractArray{T,2}, v::AbstractArray{T,2}, r1::Type{<:Region}, r2::Type{<:Region}) where T | 72 function apply_region_tiled!(D::DiffOpCartesian{2}, u::AbstractArray{T,2}, v::AbstractArray{T,2}, r1::Type{<:Region}, r2::Type{<:Region}) where T |
72 ri = regionindices(D.grid.size, closureSize(D.op), (r1,r2)) | 73 ri = regionindices(D.grid.size, closuresize(D.op), (r1,r2)) |
73 # TODO: Pass Tilesize to function | 74 # TODO: Pass Tilesize to function |
74 for tileaxs ∈ TileIterator(axes(ri), padded_tilesize(T, (5,5), 2)) | 75 for tileaxs ∈ TileIterator(axes(ri), padded_tilesize(T, (5,5), 2)) |
75 for j ∈ tileaxs[2], i ∈ tileaxs[1] | 76 for j ∈ tileaxs[2], i ∈ tileaxs[1] |
76 I = ri[i,j] | 77 I = ri[i,j] |
77 u[I] = apply(D, v, (Index{r1}(I[1]), Index{r2}(I[2]))) | 78 u[I] = apply(D, v, (Index{r1}(I[1]), Index{r2}(I[2]))) |
95 """ | 96 """ |
96 abstract type BoundaryCondition end | 97 abstract type BoundaryCondition end |
97 | 98 |
98 | 99 |
99 include("laplace.jl") | 100 include("laplace.jl") |
100 export Laplace | |
101 | |
102 | 101 |
103 end # module | 102 end # module |