Mercurial > repos > public > sbplib_julia
diff src/SbpOperators/volumeops/volume_operator.jl @ 1022:bbbc31953367 refactor/sbpoperators/inflation
Introduce an inflate function in lazy tensors and use it in volume_operator and boundary_operator
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 18 Mar 2022 16:57:00 +0100 |
parents | 469ed954b493 |
children | 52f07c77299d |
line wrap: on
line diff
--- a/src/SbpOperators/volumeops/volume_operator.jl Wed Mar 16 18:39:00 2022 +0100 +++ b/src/SbpOperators/volumeops/volume_operator.jl Fri Mar 18 16:57:00 2022 +0100 @@ -12,16 +12,10 @@ 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: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) - return foldl(⊗, parts) + return LazyTensors.inflate(op, size(grid), direction) end +# TBD: Should the inflation happen here or should we remove this method and do it at the caller instead? """ VolumeOperator{T,N,M,K} <: TensorOperator{T,1} @@ -59,3 +53,4 @@ r = getregion(i, closure_size(op), op.size[1]) return LazyTensors.apply(op, v, Index(i, r)) end +# TODO: Move this to LazyTensors when we have the region communication down.