comparison src/BoundaryConditions/boundary_condition.jl @ 1599:37b05221beda feature/boundary_conditions

Review
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 29 May 2024 22:35:08 +0200
parents ee242c3fe4af
children 3e7438e2a033
comparison
equal deleted inserted replaced
1598:19cdec9c21cb 1599:37b05221beda
2 BoundaryCondition 2 BoundaryCondition
3 3
4 A type for implementing data needed in order to impose a boundary condition. 4 A type for implementing data needed in order to impose a boundary condition.
5 Subtypes refer to perticular types of boundary conditions, e.g. Neumann conditions. 5 Subtypes refer to perticular types of boundary conditions, e.g. Neumann conditions.
6 """ 6 """
7 abstract type BoundaryCondition{T1,T2} end 7 abstract type BoundaryCondition{T1,T2} end # REVIEW: No type parameters needed here.
8 8
9 """ 9 """
10 id(::BoundaryCondition) 10 id(::BoundaryCondition)
11 11
12 The boundary identifier of the BoundaryCondition. 12 The boundary identifier of the BoundaryCondition.
31 return eval_on(boundary_grid(grid, id(bc)), data(bc)) 31 return eval_on(boundary_grid(grid, id(bc)), data(bc))
32 end 32 end
33 33
34 struct DirichletCondition{T1,T2} <: BoundaryCondition{T1,T2} 34 struct DirichletCondition{T1,T2} <: BoundaryCondition{T1,T2}
35 data::T1 35 data::T1
36 id::T2 36 id::T2 # REVIEW: This field not needed since BoundaryId are usually type parameters?
37 end 37 end
38 id(bc::DirichletCondition) = bc.id 38 id(bc::DirichletCondition) = bc.id
39 data(bc::DirichletCondition) = bc.data 39 data(bc::DirichletCondition) = bc.data
40 40
41 struct NeumannCondition{T1,T2} <: BoundaryCondition{T1,T2} 41 struct NeumannCondition{T1,T2} <: BoundaryCondition{T1,T2}
42 data::T1 42 data::T1
43 id::T2 43 id::T2 # REVIEW: This field not needed since BoundaryId are usually type parameters?
44 end 44 end
45 id(bc::NeumannCondition) = bc.id 45 id(bc::NeumannCondition) = bc.id
46 data(bc::NeumannCondition) = bc.data 46 data(bc::NeumannCondition) = bc.data
47 47