annotate SbpOperators/src/constantstenciloperator.jl @ 306:f8a4850caed2

Move BoundaryValue from Laplace to separate file. Currently WIP
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Wed, 09 Sep 2020 21:06:27 +0200
parents fe9e8737ddfa
children 36206445018b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
249
7cb4492ccd60 Refactor package SbpOperators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
1 abstract type ConstantStencilOperator end
7cb4492ccd60 Refactor package SbpOperators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
2
7cb4492ccd60 Refactor package SbpOperators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
3 # Apply for different regions Lower/Interior/Upper or Unknown region
269
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
4 @inline function apply_2nd_derivative(op::ConstantStencilOperator, h_inv::Real, v::AbstractVector, i::Index{Lower})
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
5 return @inbounds h_inv*h_inv*apply_stencil(op.closureStencils[Int(i)], v, Int(i))
249
7cb4492ccd60 Refactor package SbpOperators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
6 end
7cb4492ccd60 Refactor package SbpOperators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
7
269
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
8 @inline function apply_2nd_derivative(op::ConstantStencilOperator, h_inv::Real, v::AbstractVector, i::Index{Interior})
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
9 return @inbounds h_inv*h_inv*apply_stencil(op.innerStencil, v, Int(i))
249
7cb4492ccd60 Refactor package SbpOperators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
10 end
7cb4492ccd60 Refactor package SbpOperators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
11
269
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
12 @inline function apply_2nd_derivative(op::ConstantStencilOperator, h_inv::Real, v::AbstractVector, i::Index{Upper})
249
7cb4492ccd60 Refactor package SbpOperators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
13 N = length(v)
269
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
14 return @inbounds h_inv*h_inv*Int(op.parity)*apply_stencil_backwards(op.closureStencils[N-Int(i)+1], v, Int(i))
249
7cb4492ccd60 Refactor package SbpOperators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
15 end
7cb4492ccd60 Refactor package SbpOperators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
16
269
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
17 @inline function apply_2nd_derivative(op::ConstantStencilOperator, h_inv::Real, v::AbstractVector, index::Index{Unknown})
249
7cb4492ccd60 Refactor package SbpOperators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
18 N = length(v)
271
ecd49ffe0bc8 Dispatch apply_quadrature and apply_inverse_quadrature on Index-type. Add convenience functions dispatching on integer-indices
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 269
diff changeset
19 r = getregion(Int(index), closuresize(op), N)
ecd49ffe0bc8 Dispatch apply_quadrature and apply_inverse_quadrature on Index-type. Add convenience functions dispatching on integer-indices
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 269
diff changeset
20 i = Index(Int(index), r)
ecd49ffe0bc8 Dispatch apply_quadrature and apply_inverse_quadrature on Index-type. Add convenience functions dispatching on integer-indices
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 269
diff changeset
21 return apply_2nd_derivative(op, h_inv, v, i)
249
7cb4492ccd60 Refactor package SbpOperators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
22 end
269
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
23 export apply_2nd_derivative
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
24
271
ecd49ffe0bc8 Dispatch apply_quadrature and apply_inverse_quadrature on Index-type. Add convenience functions dispatching on integer-indices
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 269
diff changeset
25 apply_quadrature(op::ConstantStencilOperator, h::Real, v::T, i::Index{Lower}, N::Integer) where T = v*h*op.quadratureClosure[Int(i)]
ecd49ffe0bc8 Dispatch apply_quadrature and apply_inverse_quadrature on Index-type. Add convenience functions dispatching on integer-indices
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 269
diff changeset
26 apply_quadrature(op::ConstantStencilOperator, h::Real, v::T, i::Index{Upper}, N::Integer) where T = v*h*op.quadratureClosure[N-Int(i)+1]
ecd49ffe0bc8 Dispatch apply_quadrature and apply_inverse_quadrature on Index-type. Add convenience functions dispatching on integer-indices
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 269
diff changeset
27 apply_quadrature(op::ConstantStencilOperator, h::Real, v::T, i::Index{Interior}, N::Integer) where T = v*h
269
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
28
271
ecd49ffe0bc8 Dispatch apply_quadrature and apply_inverse_quadrature on Index-type. Add convenience functions dispatching on integer-indices
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 269
diff changeset
29 function apply_quadrature(op::ConstantStencilOperator, h::Real, v::T, index::Index{Unknown}, N::Integer) where T
ecd49ffe0bc8 Dispatch apply_quadrature and apply_inverse_quadrature on Index-type. Add convenience functions dispatching on integer-indices
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 269
diff changeset
30 r = getregion(Int(index), closuresize(op), N)
ecd49ffe0bc8 Dispatch apply_quadrature and apply_inverse_quadrature on Index-type. Add convenience functions dispatching on integer-indices
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 269
diff changeset
31 i = Index(Int(index), r)
ecd49ffe0bc8 Dispatch apply_quadrature and apply_inverse_quadrature on Index-type. Add convenience functions dispatching on integer-indices
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 269
diff changeset
32 return apply_quadrature(op, h, v, i, N)
ecd49ffe0bc8 Dispatch apply_quadrature and apply_inverse_quadrature on Index-type. Add convenience functions dispatching on integer-indices
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 269
diff changeset
33 end
269
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
34 export apply_quadrature
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
35
271
ecd49ffe0bc8 Dispatch apply_quadrature and apply_inverse_quadrature on Index-type. Add convenience functions dispatching on integer-indices
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 269
diff changeset
36 # TODO: Evaluate if divisions affect performance
ecd49ffe0bc8 Dispatch apply_quadrature and apply_inverse_quadrature on Index-type. Add convenience functions dispatching on integer-indices
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 269
diff changeset
37 apply_inverse_quadrature(op::ConstantStencilOperator, h_inv::Real, v::T, i::Index{Lower}, N::Integer) where T = h_inv*v/op.quadratureClosure[Int(i)]
ecd49ffe0bc8 Dispatch apply_quadrature and apply_inverse_quadrature on Index-type. Add convenience functions dispatching on integer-indices
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 269
diff changeset
38 apply_inverse_quadrature(op::ConstantStencilOperator, h_inv::Real, v::T, i::Index{Upper}, N::Integer) where T = h_inv*v/op.quadratureClosure[N-Int(i)+1]
ecd49ffe0bc8 Dispatch apply_quadrature and apply_inverse_quadrature on Index-type. Add convenience functions dispatching on integer-indices
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 269
diff changeset
39 apply_inverse_quadrature(op::ConstantStencilOperator, h_inv::Real, v::T, i::Index{Interior}, N::Integer) where T = v*h_inv
269
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
40
271
ecd49ffe0bc8 Dispatch apply_quadrature and apply_inverse_quadrature on Index-type. Add convenience functions dispatching on integer-indices
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 269
diff changeset
41 function apply_inverse_quadrature(op::ConstantStencilOperator, h_inv::Real, v::T, index::Index{Unknown}, N::Integer) where T
ecd49ffe0bc8 Dispatch apply_quadrature and apply_inverse_quadrature on Index-type. Add convenience functions dispatching on integer-indices
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 269
diff changeset
42 r = getregion(Int(index), closuresize(op), N)
ecd49ffe0bc8 Dispatch apply_quadrature and apply_inverse_quadrature on Index-type. Add convenience functions dispatching on integer-indices
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 269
diff changeset
43 i = Index(Int(index), r)
ecd49ffe0bc8 Dispatch apply_quadrature and apply_inverse_quadrature on Index-type. Add convenience functions dispatching on integer-indices
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 269
diff changeset
44 return apply_inverse_quadrature(op, h_inv, v, i, N)
ecd49ffe0bc8 Dispatch apply_quadrature and apply_inverse_quadrature on Index-type. Add convenience functions dispatching on integer-indices
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 269
diff changeset
45 end
ecd49ffe0bc8 Dispatch apply_quadrature and apply_inverse_quadrature on Index-type. Add convenience functions dispatching on integer-indices
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 269
diff changeset
46
269
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
47 export apply_inverse_quadrature
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
48
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
49 function apply_boundary_value_transpose(op::ConstantStencilOperator, v::AbstractVector, ::Type{Lower})
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
50 @boundscheck if length(v) < closuresize(op)
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
51 throw(BoundsError())
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
52 end
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
53 apply_stencil(op.eClosure,v,1)
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
54 end
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
55
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
56 function apply_boundary_value_transpose(op::ConstantStencilOperator, v::AbstractVector, ::Type{Upper})
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
57 @boundscheck if length(v) < closuresize(op)
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
58 throw(BoundsError())
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
59 end
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
60 apply_stencil_backwards(op.eClosure,v,length(v))
249
7cb4492ccd60 Refactor package SbpOperators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
61 end
269
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
62 export apply_boundary_value_transpose
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
63
280
fe9e8737ddfa Change to using region indices in apply of BoundaryValue, NormalDerivative and BoundaryQuadrature
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 271
diff changeset
64 function apply_boundary_value(op::ConstantStencilOperator, v::Number, i::Index, N::Integer, ::Type{Lower})
fe9e8737ddfa Change to using region indices in apply of BoundaryValue, NormalDerivative and BoundaryQuadrature
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 271
diff changeset
65 @boundscheck if !(0<length(Int(i)) <= N)
269
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
66 throw(BoundsError())
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
67 end
280
fe9e8737ddfa Change to using region indices in apply of BoundaryValue, NormalDerivative and BoundaryQuadrature
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 271
diff changeset
68 op.eClosure[Int(i)-1]*v
269
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
69 end
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
70
280
fe9e8737ddfa Change to using region indices in apply of BoundaryValue, NormalDerivative and BoundaryQuadrature
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 271
diff changeset
71 function apply_boundary_value(op::ConstantStencilOperator, v::Number, i::Index, N::Integer, ::Type{Upper})
fe9e8737ddfa Change to using region indices in apply of BoundaryValue, NormalDerivative and BoundaryQuadrature
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 271
diff changeset
72 @boundscheck if !(0<length(Int(i)) <= N)
269
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
73 throw(BoundsError())
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
74 end
280
fe9e8737ddfa Change to using region indices in apply of BoundaryValue, NormalDerivative and BoundaryQuadrature
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 271
diff changeset
75 op.eClosure[N-Int(i)]*v
269
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
76 end
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
77 export apply_boundary_value
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
78
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
79 function apply_normal_derivative_transpose(op::ConstantStencilOperator, h_inv::Real, v::AbstractVector, ::Type{Lower})
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
80 @boundscheck if length(v) < closuresize(op)
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
81 throw(BoundsError())
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
82 end
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
83 h_inv*apply_stencil(op.dClosure,v,1)
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
84 end
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
85
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
86 function apply_normal_derivative_transpose(op::ConstantStencilOperator, h_inv::Real, v::AbstractVector, ::Type{Upper})
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
87 @boundscheck if length(v) < closuresize(op)
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
88 throw(BoundsError())
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
89 end
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
90 -h_inv*apply_stencil_backwards(op.dClosure,v,length(v))
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
91 end
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
92
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
93 export apply_normal_derivative_transpose
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
94
280
fe9e8737ddfa Change to using region indices in apply of BoundaryValue, NormalDerivative and BoundaryQuadrature
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 271
diff changeset
95 function apply_normal_derivative(op::ConstantStencilOperator, h_inv::Real, v::Number, i::Index, N::Integer, ::Type{Lower})
fe9e8737ddfa Change to using region indices in apply of BoundaryValue, NormalDerivative and BoundaryQuadrature
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 271
diff changeset
96 @boundscheck if !(0<length(Int(i)) <= N)
269
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
97 throw(BoundsError())
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
98 end
280
fe9e8737ddfa Change to using region indices in apply of BoundaryValue, NormalDerivative and BoundaryQuadrature
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 271
diff changeset
99 h_inv*op.dClosure[Int(i)-1]*v
269
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
100 end
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
101
280
fe9e8737ddfa Change to using region indices in apply of BoundaryValue, NormalDerivative and BoundaryQuadrature
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 271
diff changeset
102 function apply_normal_derivative(op::ConstantStencilOperator, h_inv::Real, v::Number, i::Index, N::Integer, ::Type{Upper})
fe9e8737ddfa Change to using region indices in apply of BoundaryValue, NormalDerivative and BoundaryQuadrature
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 271
diff changeset
103 @boundscheck if !(0<length(Int(i)) <= N)
269
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
104 throw(BoundsError())
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
105 end
280
fe9e8737ddfa Change to using region indices in apply of BoundaryValue, NormalDerivative and BoundaryQuadrature
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 271
diff changeset
106 -h_inv*op.dClosure[N-Int(i)]*v
269
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
107 end
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
108
ccef055233a2 Move general methods for D2 to ConstantStencilOperator and increase verbosity of method names for clarity
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 253
diff changeset
109 export apply_normal_derivative