Skip to content

Commit 01b9ac9

Browse files
author
chmerdon
committed
added the possibility to change the kernel of the underlying LinearOperator of the MeanValueRestriction
1 parent b6d9c38 commit 01b9ac9

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

src/common_restrictions/mean_value_restriction.jl

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,23 @@ end
99
"""
1010
$(TYPEDSIGNATURES)
1111
12-
Restrict the mean value of a scalar unknown to a certain value.
12+
Construct a mean value restriction for a scalar unknown.
13+
14+
This restriction enforces that the mean value of the given unknown
15+
(or rather the testing of an underlying LinearOperator) matches a specified value.
16+
Optionally, an operator can be applied to the unknown before computing the mean,
17+
and a custom kernel function for the underlying `LinearOperator` can be provided.
18+
19+
# Arguments
20+
- `u::Unknown`: The unknown whose mean value is to be restricted.
21+
- `kernel`: Kernel function for the linear operator (default: `ExtendableFEMBase.constant_one_kernel`).
22+
- `value::T`: The target mean value (default: `0`).
23+
- `operator`: Operator to apply to the unknown before restriction (default: `Identity`).
24+
- `Tv`: Value type for the restriction (default: `Float64`).
1325
14-
An additional operator can be applied to the unknown before the mean value is restricted.
1526
"""
16-
function MeanValueRestriction(u::Unknown; value::T = 0, operator = Identity, Tv = Float64) where {T}
17-
linear_operator = LinearOperator([(u, operator)]; store = true, Tv)
27+
function MeanValueRestriction(u::Unknown; kernel = ExtendableFEMBase.constant_one_kernel, value::T = 0, operator = Identity, Tv = Float64) where {T}
28+
linear_operator = LinearOperator(kernel, [(u, operator)]; store = true, Tv)
1829
return MeanValueRestriction{T, Tv}(u, value, linear_operator, Dict{Symbol, Any}(:name => "MeanValueRestriction"))
1930
end
2031

0 commit comments

Comments
 (0)