annotate SbpOperators/src/BoundaryValue.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
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
306
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
1 """
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
2 BoundaryValue{T,N,M,K} <: TensorMapping{T,2,1}
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
3
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
4 Implements the boundary operator `e` as a TensorMapping
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
5 """
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
6 struct BoundaryValue{T,N,M,K} <: TensorMapping{T,2,1}
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
7 eClosure::Stencil{T,M}
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
8 bId::CartesianBoundary
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
9 end
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
10 export BoundaryValue
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
11
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
12 # TODO: This is obviouly strange. Is domain_size just discarded? Is there a way to avoid storing grid in BoundaryValue?
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
13 # Can we give special treatment to TensorMappings that go to a higher dim?
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
14 function LazyTensors.range_size(e::BoundaryValue{T}, domain_size::NTuple{1,Integer}) where T
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
15 if dim(e.bId) == 1
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
16 return (UnknownDim, domain_size[1])
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
17 elseif dim(e.bId) == 2
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
18 return (domain_size[1], UnknownDim)
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
19 end
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
20 end
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
21 LazyTensors.domain_size(e::BoundaryValue{T}, range_size::NTuple{2,Integer}) where T = (range_size[3-dim(e.bId)],)
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
22 # TODO: Make a nicer solution for 3-dim(e.bId)
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
23
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
24 # TODO: Make this independent of dimension
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
25 function LazyTensors.apply(e::BoundaryValue{T}, v::AbstractArray{T}, I::NTuple{2,Index}) where T
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
26 i = I[dim(e.bId)]
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
27 j = I[3-dim(e.bId)]
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
28 N_i = size(e.grid)[dim(e.bId)]
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
29 return apply_boundary_value(e.op, v[j], i, N_i, region(e.bId))
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
30 end
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
31
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
32 function LazyTensors.apply_transpose(e::BoundaryValue{T}, v::AbstractArray{T}, I::NTuple{1,Index}) where T
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
33 u = selectdim(v,3-dim(e.bId),Int(I[1]))
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
34 return apply_boundary_value_transpose(e.op, u, region(e.bId))
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
35 end
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
36
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
37 function apply_boundary_value_transpose(op::ConstantStencilOperator, v::AbstractVector, ::Type{Lower})
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
38 @boundscheck if length(v) < closuresize(op)
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
39 throw(BoundsError())
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
40 end
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
41 apply_stencil(op.eClosure,v,1)
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
42 end
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
43
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
44 function apply_boundary_value_transpose(op::ConstantStencilOperator, v::AbstractVector, ::Type{Upper})
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
45 @boundscheck if length(v) < closuresize(op)
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
46 throw(BoundsError())
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
47 end
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
48 apply_stencil_backwards(op.eClosure,v,length(v))
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
49 end
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
50 export apply_boundary_value_transpose
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
51
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
52 function apply_boundary_value(op::ConstantStencilOperator, v::Number, i::Index, N::Integer, ::Type{Lower})
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
53 @boundscheck if !(0<length(Int(i)) <= N)
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
54 throw(BoundsError())
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
55 end
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
56 op.eClosure[Int(i)-1]*v
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
57 end
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
58
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
59 function apply_boundary_value(op::ConstantStencilOperator, v::Number, i::Index, N::Integer, ::Type{Upper})
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
60 @boundscheck if !(0<length(Int(i)) <= N)
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
61 throw(BoundsError())
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
62 end
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
63 op.eClosure[N-Int(i)]*v
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
64 end
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
65 export apply_boundary_value
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
66
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
67
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
68 """
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
69 BoundaryValue{T,N,M,K} <: TensorMapping{T,2,1}
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
70
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
71 Implements the boundary operator `e` as a TensorMapping
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
72 """
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
73 struct BoundaryValue{D,T,M,R} <: TensorMapping{T,D,1}
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
74 e:BoundaryOperator{T,M,R}
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
75 bId::CartesianBoundary
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
76 end
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
77
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
78 function LazyTensors.apply_transpose(bv::BoundaryValue{T,M,Lower}, v::AbstractVector{T}, i::Index) where T
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
79 u = selectdim(v,3-dim(bv.bId),Int(I[1]))
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
80 return apply_transpose(bv.e, u, I)
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
81 end
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
82
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
83
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
84 """
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
85 BoundaryOperator{T,N,R} <: TensorMapping{T,1,1}
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
86
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
87 Implements the boundary operator `e` as a TensorMapping
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
88 """
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
89 export BoundaryOperator
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
90 struct BoundaryOperator{T,M,R<:Region} <: TensorMapping{T,1,1}
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
91 closure::Stencil{T,M}
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
92 end
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
93
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
94 function LazyTensors.range_size(e::BoundaryOperator, domain_size::NTuple{1,Integer})
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
95 return UnknownDim
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
96 end
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
97
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
98 LazyTensors.domain_size(e::BoundaryOperator{T}, range_size::NTuple{1,Integer}) where T = range_size
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
99
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
100 function LazyTensors.apply_transpose(e::BoundaryOperator{T,M,Lower}, v::AbstractVector{T}, i::Index{Lower}) where T
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
101 @boundscheck if length(v) < closuresize(e) #TODO: Use domain_size here?
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
102 throw(BoundsError())
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
103 end
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
104 apply_stencil(e.closure,v,Int(i))
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
105 end
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
106
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
107 function LazyTensors.apply_transpose(e::BoundaryOperator{T,M,Upper}}, v::AbstractVector{T}, i::Index{Upper}) where T
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
108 @boundscheck if length(v) < closuresize(e) #TODO: Use domain_size here?
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
109 throw(BoundsError())
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
110 end
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
111 apply_stencil_backwards(e.closure,v,Int(i))
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
112 end
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
113
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
114 function LazyTensors.apply_transpose(e::BoundaryOperator{T}, v::AbstractVector{T}, i::Index) where T
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
115 @boundscheck if length(v) < closuresize(e) #TODO: Use domain_size here?
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
116 throw(BoundsError())
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
117 end
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
118 return eltype(v)(0)
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
119 end
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
120
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
121 #TODO: Implement apply in a meaningful way. Should it return a vector or a single value (perferable?) Should fit into the
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
122 function LazyTensors.apply(e::BoundaryOperator, v::AbstractVector, i::Index)
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
123 @boundscheck if !(0<length(Int(i)) <= length(v))
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
124 throw(BoundsError())
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
125 end
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
126 return e.closure[Int(i)].*v
f8a4850caed2 Move BoundaryValue from Laplace to separate file. Currently WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
127 end