Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/boundary_conditions/boundary_condition.jl @ 2057:8a2a0d678d6f feature/lazy_tensors/pretty_printing
Merge default
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Tue, 10 Feb 2026 22:41:19 +0100 |
| parents | 48596b2f7923 |
| children |
comparison
equal
deleted
inserted
replaced
| 1110:c0bff9f6e0fb | 2057:8a2a0d678d6f |
|---|---|
| 1 """ | |
| 2 BoundaryCondition | |
| 3 | |
| 4 Description of a boundary condition. Implementations describe the kind of | |
| 5 boundary condition, what boundary the condition applies to, and any associated | |
| 6 data. Should implement [`boundary`](@ref) and may implement | |
| 7 [`boundary_data`](@ref) if applicable. | |
| 8 | |
| 9 For examples see [`DirichletCondition`](@ref) and [`NeumannCondition`](@ref) | |
| 10 """ | |
| 11 abstract type BoundaryCondition end | |
| 12 | |
| 13 """ | |
| 14 boundary(::BoundaryCondition) | |
| 15 | |
| 16 The boundary identifier of the BoundaryCondition. | |
| 17 """ | |
| 18 function boundary end | |
| 19 | |
| 20 """ | |
| 21 boundary_data(::BoundaryCondition) | |
| 22 | |
| 23 If implemented, the data associated with the BoundaryCondition. | |
| 24 """ | |
| 25 function boundary_data end | |
| 26 | |
| 27 """ | |
| 28 discretize_data(grid, bc::BoundaryCondition) | |
| 29 | |
| 30 The data of `bc` as a lazily evaluated grid function on the boundary grid | |
| 31 specified by `boundary(bc)`. | |
| 32 """ | |
| 33 function discretize_data(grid, bc::BoundaryCondition) | |
| 34 return eval_on(boundary_grid(grid, boundary(bc)), boundary_data(bc)) | |
| 35 end | |
| 36 | |
| 37 """ | |
| 38 DirichletCondition{DT,BID} | |
| 39 | |
| 40 A Dirichlet condition with `data::DT` on the boundary | |
| 41 specified by the boundary identifier `BID`. | |
| 42 """ | |
| 43 struct DirichletCondition{DT,BID} <: BoundaryCondition | |
| 44 data::DT | |
| 45 boundary::BID | |
| 46 end | |
| 47 boundary_data(bc::DirichletCondition) = bc.data | |
| 48 boundary(bc::DirichletCondition) = bc.boundary | |
| 49 | |
| 50 """ | |
| 51 NeumannCondition{DT,BID} | |
| 52 | |
| 53 A Neumann condition with `data::DT` on the boundary | |
| 54 specified by the boundary identifier `BID`. | |
| 55 """ | |
| 56 struct NeumannCondition{DT,BID} <: BoundaryCondition | |
| 57 data::DT | |
| 58 boundary::BID | |
| 59 end | |
| 60 boundary_data(bc::NeumannCondition) = bc.data | |
| 61 boundary(bc::NeumannCondition) = bc.boundary | |
| 62 |
