diff src/SbpOperators/boundary_conditions/boundary_condition.jl @ 1620:48596b2f7923 feature/boundary_conditions

Remove type parameter from BoundaryCondition
author Vidar Stiernström <vidar.stiernstrom@gmail.com>
date Mon, 10 Jun 2024 22:35:43 -0700
parents a00fa58e9fb0
children
line wrap: on
line diff
--- a/src/SbpOperators/boundary_conditions/boundary_condition.jl	Tue Jun 11 00:19:09 2024 +0200
+++ b/src/SbpOperators/boundary_conditions/boundary_condition.jl	Mon Jun 10 22:35:43 2024 -0700
@@ -1,5 +1,5 @@
 """
-    BoundaryCondition{BID}
+    BoundaryCondition
 
 Description of a boundary condition. Implementations describe the kind of
 boundary condition, what boundary the condition applies to, and any associated
@@ -8,14 +8,14 @@
 
 For examples see [`DirichletCondition`](@ref) and [`NeumannCondition`](@ref)
 """
-abstract type BoundaryCondition{BID} end
+abstract type BoundaryCondition end
 
 """
     boundary(::BoundaryCondition)
 
 The boundary identifier of the BoundaryCondition.
 """
-boundary(::BoundaryCondition{BID}) where {BID} = BID()
+function boundary end
 
 """
     boundary_data(::BoundaryCondition)
@@ -40,13 +40,12 @@
 A Dirichlet condition with `data::DT` on the boundary
 specified by the boundary identifier `BID`.
 """
-struct DirichletCondition{DT,BID} <: BoundaryCondition{BID}
+struct DirichletCondition{DT,BID} <: BoundaryCondition
     data::DT
-    function DirichletCondition(data, id)
-        return new{typeof(data),typeof(id)}(data)
-    end
+    boundary::BID
 end
 boundary_data(bc::DirichletCondition) = bc.data
+boundary(bc::DirichletCondition) = bc.boundary
 
 """
     NeumannCondition{DT,BID}
@@ -54,11 +53,10 @@
 A Neumann condition with `data::DT` on the boundary
 specified by the boundary identifier `BID`.
 """
-struct NeumannCondition{DT,BID} <: BoundaryCondition{BID}
+struct NeumannCondition{DT,BID} <: BoundaryCondition
     data::DT
-    function NeumannCondition(data, id)
-        return new{typeof(data),typeof(id)}(data)
-    end
+    boundary::BID
 end
 boundary_data(bc::NeumannCondition) = bc.data
+boundary(bc::NeumannCondition) = bc.boundary