Mercurial > repos > public > sbplib_julia
changeset 834:a8d64785f51b operator_storage_array_of_table
Merge refactor/sbp_operators_method_signatures
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 13 Jan 2022 08:51:26 +0100 |
parents | 454ba1efa644 (current diff) 9b2910a6411d (diff) |
children | fc2ac236dd73 |
files | src/SbpOperators/boundaryops/boundary_operator.jl |
diffstat | 4 files changed, 10 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/SbpOperators/boundaryops/boundary_operator.jl Wed Jan 12 16:03:48 2022 +0100 +++ b/src/SbpOperators/boundaryops/boundary_operator.jl Thu Jan 13 08:51:26 2022 +0100 @@ -9,7 +9,7 @@ of `IdentityMappings` in orthogonal coordinate directions, e.g for `Dim=3`, the boundary restriction operator in the y-direction direction is `Ix⊗op⊗Iz`. """ -function boundary_operator(grid::EquidistantGrid{Dim,T}, closure_stencil, boundary::CartesianBoundary) where {Dim,T} +function boundary_operator(grid::EquidistantGrid, closure_stencil, boundary::CartesianBoundary) #TODO:Check that dim(boundary) <= Dim? # Create 1D boundary operator @@ -18,8 +18,8 @@ op = BoundaryOperator(restrict(grid, d), closure_stencil, r) # Create 1D IdentityMappings for each coordinate direction - one_d_grids = restrict.(Ref(grid), Tuple(1:Dim)) - Is = IdentityMapping{T}.(size.(one_d_grids)) + one_d_grids = restrict.(Ref(grid), Tuple(1:dimension(grid))) + Is = IdentityMapping{eltype(grid)}.(size.(one_d_grids)) # Formulate the correct outer product sequence of the identity mappings and # the boundary operator
--- a/src/SbpOperators/volumeops/derivatives/second_derivative.jl Wed Jan 12 16:03:48 2022 +0100 +++ b/src/SbpOperators/volumeops/derivatives/second_derivative.jl Thu Jan 13 08:51:26 2022 +0100 @@ -1,6 +1,5 @@ """ - second_derivative(grid::EquidistantGrid{Dim}, inner_stencil, closure_stencils, direction) - second_derivative(grid::EquidistantGrid{1}, inner_stencil, closure_stencils) + second_derivative(grid::EquidistantGrid, inner_stencil, closure_stencils, direction) Creates the second-derivative operator `D2` as a `TensorMapping` @@ -12,7 +11,7 @@ one-dimensional operator with the `IdentityMapping`s in orthogonal coordinate dirrections. Also see the documentation of `SbpOperators.volume_operator(...)` for more details. """ -function second_derivative(grid::EquidistantGrid{Dim}, inner_stencil, closure_stencils, direction) where Dim +function second_derivative(grid::EquidistantGrid, inner_stencil, closure_stencils, direction) h_inv = inverse_spacing(grid)[direction] return SbpOperators.volume_operator(grid, scale(inner_stencil,h_inv^2), scale.(closure_stencils,h_inv^2), even, direction) end
--- a/src/SbpOperators/volumeops/laplace/laplace.jl Wed Jan 12 16:03:48 2022 +0100 +++ b/src/SbpOperators/volumeops/laplace/laplace.jl Thu Jan 13 08:51:26 2022 +0100 @@ -11,9 +11,9 @@ multi-dimensional `grid`, `Δ` is the sum of multi-dimensional `second_derivative`s where the sum is carried out lazily. """ -function laplace(grid::EquidistantGrid{Dim}, inner_stencil, closure_stencils) where Dim +function laplace(grid::EquidistantGrid, inner_stencil, closure_stencils) Δ = second_derivative(grid, inner_stencil, closure_stencils, 1) - for d = 2:Dim + for d = 2:dimension(grid) Δ += second_derivative(grid, inner_stencil, closure_stencils, d) end return Δ
--- a/src/SbpOperators/volumeops/volume_operator.jl Wed Jan 12 16:03:48 2022 +0100 +++ b/src/SbpOperators/volumeops/volume_operator.jl Thu Jan 13 08:51:26 2022 +0100 @@ -9,14 +9,14 @@ operators and `IdentityMapping`s, e.g for `Dim=3` the volume operator in the y-direction is `I⊗op⊗I`. """ -function volume_operator(grid::EquidistantGrid{Dim,T}, inner_stencil, closure_stencils, parity, direction) where {Dim,T} +function volume_operator(grid::EquidistantGrid, inner_stencil, closure_stencils, parity, direction) #TODO: Check that direction <= Dim? # Create 1D volume operator in along coordinate direction op = VolumeOperator(restrict(grid, direction), inner_stencil, closure_stencils, parity) # Create 1D IdentityMappings for each coordinate direction - one_d_grids = restrict.(Ref(grid), Tuple(1:Dim)) - Is = IdentityMapping{T}.(size.(one_d_grids)) + one_d_grids = restrict.(Ref(grid), Tuple(1:dimension(grid))) + Is = IdentityMapping{eltype(grid)}.(size.(one_d_grids)) # Formulate the correct outer product sequence of the identity mappings and # the volume operator parts = Base.setindex(Is, op, direction)