diff diffOp.jl @ 59:60d575e4a2d8

Merge with latest changes
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Wed, 16 Jan 2019 12:40:20 +0100
parents c62ea0112d4d
children 27a8d3021a1c 8a7a537f54e5 d04569696918
line wrap: on
line diff
--- a/diffOp.jl	Wed Jan 16 12:39:42 2019 +0100
+++ b/diffOp.jl	Wed Jan 16 12:40:20 2019 +0100
@@ -12,14 +12,25 @@
     error("not implemented")
 end
 
-function boundaryCondition(D::DiffOp)
+function boundaryCondition(D::DiffOp,b::Grid.BoundaryId,type)::(Closure, Penalty)
+    error("not implemented")
+end
+
+function interface(Du::DiffOp, Dv::DiffOp, b::Grid.BoundaryId; type)
     error("not implemented")
 end
 
-function interface(Du::DiffOp, Dv::DiffOp, b::grid.BoundaryId; type)
+abstract type Closure end
+
+function apply(c::Closure, v::AbstractVector, i::Int)
     error("not implemented")
 end
 
+abstract type Penalty end
+
+function apply(c::Penalty, g, i::Int)
+    error("not implemented")
+end
 
 # Differential operator for a*d^2/dx^2
 struct Laplace1D <: DiffOp
@@ -30,7 +41,7 @@
 
 # u = L*v
 function apply!(L::Laplace1D, u::AbstractVector, v::AbstractVector)
-    h = grid.spacings(L.grid)[1]
+    h = Grid.spacings(L.grid)[1]
     apply!(L.op, u, v, h)
     u .= L.a * u
     return nothing
@@ -47,7 +58,7 @@
 # u = L*v
 function apply!(L::Laplace2D, u::AbstractVector, v::AbstractVector)
     u .= 0*u
-    h = grid.spacings(L.grid)
+    h = Grid.spacings(L.grid)
 
     li = LinearIndices(L.grid.numberOfPointsPerDim)
     n_x, n_y = L.grid.numberOfPointsPerDim