Mercurial > repos > public > sbplib_julia
diff src/SbpOperators/laplace/secondderivative.jl @ 356:0844069ab5ff refactor/remove_dynamic_size_tensormapping
Reinclude SbpOperators and fix most of the code and tests there.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sun, 27 Sep 2020 22:51:31 +0200 |
parents | 7fe43d902a27 |
children | e73af120ad38 |
line wrap: on
line diff
--- a/src/SbpOperators/laplace/secondderivative.jl Sun Sep 27 21:08:18 2020 +0200 +++ b/src/SbpOperators/laplace/secondderivative.jl Sun Sep 27 22:51:31 2020 +0200 @@ -9,11 +9,17 @@ innerStencil::Stencil{T,N} closureStencils::NTuple{M,Stencil{T,K}} parity::Parity - #TODO: Write a nice constructor + size::NTuple{1,Int} end export SecondDerivative -LazyTensors.domain_size(D2::SecondDerivative, range_size::NTuple{1,Integer}) = range_size +function SecondDerivative(grid::EquidistantGrid{1}, innerStencil, closureStencils) + h_inv = grid.inverse_spacing[1] + return SecondDerivative(h_inv, innerStencil, closureStencils, even, size(grid)) +end + +LazyTensors.range_size(D2::SecondDerivative) = D2.size +LazyTensors.domain_size(D2::SecondDerivative) = D2.size #TODO: The 1D tensor mappings should not have to dispatch on 1D tuples if we write LazyTensor.apply for vararg right?!?! # Currently have to index the Tuple{Index} in each method in order to call the stencil methods which is ugly.