Mercurial > repos > public > sbplib_julia
comparison src/BoundaryConditions/boundary_condition.jl @ 1404:481960ca366f feature/boundary_conditions
Fix type signatures
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Tue, 22 Aug 2023 21:52:10 +0200 |
parents | 35840a0681d1 |
children | ee242c3fe4af |
comparison
equal
deleted
inserted
replaced
1396:35840a0681d1 | 1404:481960ca366f |
---|---|
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 end | 7 abstract type BoundaryCondition{T} end |
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. |
28 a `LazyArray` holding the `BoundaryData` discretized on `boundary_grid`. | 28 a `LazyArray` holding the `BoundaryData` discretized on `boundary_grid`. |
29 """ | 29 """ |
30 function discretize_data(grid, bc::BoundaryCondition) | 30 function discretize_data(grid, bc::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 NeumannCondition{DT} <: BoundaryCondition{DT} | 34 struct DirichletCondition{T} <: BoundaryCondition{T} |
35 data::DT | 35 data::T |
36 id::BoundaryIdentifier | |
37 end | |
38 id(bc::DirichletCondition) = bc.id | |
39 data(bc::DirichletCondition) = bc.data | |
40 | |
41 struct NeumannCondition{T} <: BoundaryCondition{T} | |
42 data::T | |
36 id::BoundaryIdentifier | 43 id::BoundaryIdentifier |
37 end | 44 end |
38 id(bc::NeumannCondition) = bc.id | 45 id(bc::NeumannCondition) = bc.id |
39 data(bc::NeumannCondition) = bc.data | 46 data(bc::NeumannCondition) = bc.data |
40 | 47 |
41 struct DirichletCondition{DT} <: BoundaryCondition{DT} | |
42 data::DT | |
43 id::BoundaryIdentifier | |
44 end | |
45 id(bc::NeumannCondition) = bc.id | |
46 data(bc::DirichletCondition) = bc.data |