Mercurial > repos > public > sbplib_julia
comparison diffOp.jl @ 54:4300a3fbd818
switch grid to Grid in diffOp
author | Ylva Rydin <ylva.rydin@telia.com> |
---|---|
date | Mon, 14 Jan 2019 16:30:52 +0100 |
parents | 947f7579ba9c |
children | c62ea0112d4d |
comparison
equal
deleted
inserted
replaced
53:8c6db1f6d8e0 | 54:4300a3fbd818 |
---|---|
14 | 14 |
15 function boundaryCondition(D::DiffOp) | 15 function boundaryCondition(D::DiffOp) |
16 error("not implemented") | 16 error("not implemented") |
17 end | 17 end |
18 | 18 |
19 function interface(Du::DiffOp, Dv::DiffOp, b::grid.BoundaryId; type) | 19 function interface(Du::DiffOp, Dv::DiffOp, b::Grid.BoundaryId; type) |
20 error("not implemented") | 20 error("not implemented") |
21 end | 21 end |
22 | 22 |
23 | 23 |
24 # Differential operator for a*d^2/dx^2 | 24 # Differential operator for a*d^2/dx^2 |
28 op | 28 op |
29 end | 29 end |
30 | 30 |
31 # u = L*v | 31 # u = L*v |
32 function apply!(L::Laplace1D, u::AbstractVector, v::AbstractVector) | 32 function apply!(L::Laplace1D, u::AbstractVector, v::AbstractVector) |
33 h = grid.spacings(L.grid)[1] | 33 h = Grid.spacings(L.grid)[1] |
34 apply!(L.op, u, v, h) | 34 apply!(L.op, u, v, h) |
35 u .= L.a * u | 35 u .= L.a * u |
36 return nothing | 36 return nothing |
37 end | 37 end |
38 | 38 |
45 end | 45 end |
46 | 46 |
47 # u = L*v | 47 # u = L*v |
48 function apply!(L::Laplace2D, u::AbstractVector, v::AbstractVector) | 48 function apply!(L::Laplace2D, u::AbstractVector, v::AbstractVector) |
49 u .= 0*u | 49 u .= 0*u |
50 h = grid.spacings(L.grid) | 50 h = Grid.spacings(L.grid) |
51 | 51 |
52 li = LinearIndices(L.grid.numberOfPointsPerDim) | 52 li = LinearIndices(L.grid.numberOfPointsPerDim) |
53 n_x, n_y = L.grid.numberOfPointsPerDim | 53 n_x, n_y = L.grid.numberOfPointsPerDim |
54 | 54 |
55 | 55 |