diff src/SbpOperators/volumeops/volume_operator.jl @ 1073:5a3281429a48 feature/variable_derivatives

Merge feature/variable_derivatives
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 24 Mar 2022 12:35:14 +0100
parents 3bb94ce74697 14cb97284373
children 102ebdaf7c11
line wrap: on
line diff
--- a/src/SbpOperators/volumeops/volume_operator.jl	Wed Mar 23 13:32:51 2022 +0100
+++ b/src/SbpOperators/volumeops/volume_operator.jl	Thu Mar 24 12:35:14 2022 +0100
@@ -12,19 +12,13 @@
 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 IdentityTensors for each coordinate direction
-    one_d_grids = restrict.(Ref(grid), Tuple(1:dimension(grid)))
-    Is = IdentityTensor{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}
+    VolumeOperator{T,N,M,K} <: LazyTensor{T,1,1}
 Implements a one-dimensional constant coefficients volume operator
 """
 struct VolumeOperator{T,N,M,K} <: LazyTensor{T,1,1}
@@ -58,3 +52,4 @@
 function LazyTensors.apply(op::VolumeOperator, v::AbstractVector, i)
     return LazyTensors.apply_with_region(op, v, closure_size(op), op.size[1], i)
 end
+# TODO: Move this to LazyTensors when we have the region communication down.