Mercurial > repos > public > sbplib_julia
annotate src/SbpOperators/volumeops/volume_operator.jl @ 1155:716e721ce3eb refactor/sbpoperators/inflation
Fix formatting in a few docstrings
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 01 Nov 2022 22:15:47 +0100 |
parents | 5ddf5ae48391 |
children | f1c2a4fa0ee1 356ec6a72974 102ebdaf7c11 |
rev | line source |
---|---|
611
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
1 """ |
1070
2b6298905692
Fix typo in doc string for VolumeOperator
Jonatan Werpers <jonatan@werpers.com>
parents:
995
diff
changeset
|
2 VolumeOperator{T,N,M,K} <: LazyTensor{T,1,1} |
1155
716e721ce3eb
Fix formatting in a few docstrings
Jonatan Werpers <jonatan@werpers.com>
parents:
1149
diff
changeset
|
3 |
611
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
4 Implements a one-dimensional constant coefficients volume operator |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
5 """ |
995 | 6 struct VolumeOperator{T,N,M,K} <: LazyTensor{T,1,1} |
611
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
7 inner_stencil::Stencil{T,N} |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
8 closure_stencils::NTuple{M,Stencil{T,K}} |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
9 size::NTuple{1,Int} |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
10 parity::Parity |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
11 end |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
12 |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
13 function VolumeOperator(grid::EquidistantGrid{1}, inner_stencil, closure_stencils, parity) |
773
86bb3606b215
Make volume_operators() less restrictive in the type of collection of closure_stencils
Jonatan Werpers <jonatan@werpers.com>
parents:
627
diff
changeset
|
14 return VolumeOperator(inner_stencil, Tuple(closure_stencils), size(grid), parity) |
611
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
15 end |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
16 |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
17 closure_size(::VolumeOperator{T,N,M}) where {T,N,M} = M |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
18 |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
19 LazyTensors.range_size(op::VolumeOperator) = op.size |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
20 LazyTensors.domain_size(op::VolumeOperator) = op.size |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
21 |
946
469ed954b493
Allow volume_operator, boundary_operator, and constant_interior_scaling_operator to act on arbitrary arrays
Jonatan Werpers <jonatan@werpers.com>
parents:
818
diff
changeset
|
22 function LazyTensors.apply(op::VolumeOperator, v::AbstractVector, i::Index{Lower}) |
611
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
23 return @inbounds apply_stencil(op.closure_stencils[Int(i)], v, Int(i)) |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
24 end |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
25 |
946
469ed954b493
Allow volume_operator, boundary_operator, and constant_interior_scaling_operator to act on arbitrary arrays
Jonatan Werpers <jonatan@werpers.com>
parents:
818
diff
changeset
|
26 function LazyTensors.apply(op::VolumeOperator, v::AbstractVector, i::Index{Interior}) |
611
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
27 return apply_stencil(op.inner_stencil, v, Int(i)) |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
28 end |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
29 |
946
469ed954b493
Allow volume_operator, boundary_operator, and constant_interior_scaling_operator to act on arbitrary arrays
Jonatan Werpers <jonatan@werpers.com>
parents:
818
diff
changeset
|
30 function LazyTensors.apply(op::VolumeOperator, v::AbstractVector, i::Index{Upper}) |
611
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
31 return @inbounds Int(op.parity)*apply_stencil_backwards(op.closure_stencils[op.size[1]-Int(i)+1], v, Int(i)) |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
32 end |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
33 |
946
469ed954b493
Allow volume_operator, boundary_operator, and constant_interior_scaling_operator to act on arbitrary arrays
Jonatan Werpers <jonatan@werpers.com>
parents:
818
diff
changeset
|
34 function LazyTensors.apply(op::VolumeOperator, v::AbstractVector, i) |
611
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
35 r = getregion(i, closure_size(op), op.size[1]) |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
36 return LazyTensors.apply(op, v, Index(i, r)) |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
37 end |
1022
bbbc31953367
Introduce an inflate function in lazy tensors and use it in volume_operator and boundary_operator
Jonatan Werpers <jonatan@werpers.com>
parents:
946
diff
changeset
|
38 # TODO: Move this to LazyTensors when we have the region communication down. |