-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f080df6
commit 1f6ab00
Showing
4 changed files
with
198 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
|
||
function evaluate_cache(a::AbstractVector{<:IntegrandOperator},uh) | ||
return evaluate_cache(first(a),uh) | ||
end | ||
|
||
function Arrays.evaluate!(cache,a::AbstractVector{<:IntegrandOperator},uh) | ||
map(enumerate(a)) do (i,ai) | ||
evaluate!(cache,ai,uh;updated=(i!=1)) | ||
end | ||
end | ||
|
||
function Arrays.evaluate(a::AbstractVector{<:IntegrandOperator},uh) | ||
cache = evaluate_cache(a,uh) | ||
return evaluate!(cache,a,uh) | ||
end | ||
|
||
function gradient_cache(a::AbstractVector{<:IntegrandOperator},uh,K) | ||
return gradient_cache(first(a),uh,K) | ||
end | ||
|
||
function gradient!(cache,a::AbstractVector{<:IntegrandOperator},uh,K) | ||
map(enumerate(a)) do (i,ai) | ||
gradient!(cache,ai,uh,K;updated=(i!=1)) | ||
end | ||
end | ||
|
||
function Gridap.gradient(a::AbstractVector{<:IntegrandOperator},uh,K) | ||
cache = gradient_cache(a,uh,K) | ||
return gradient!(cache,a,uh,K) | ||
end | ||
|
||
function evaluate_and_gradient_cache(a::AbstractVector{<:IntegrandOperator},uh,K) | ||
return evaluate_and_gradient_cache(first(a),uh,K) | ||
end | ||
|
||
function evaluate_and_gradient!(cache,a::AbstractVector{<:IntegrandOperator},uh,K) | ||
map(enumerate(a)) do (i,ai) | ||
evaluate_and_gradient!(cache,ai,uh,K;updated=(i!=1)) | ||
end | ||
end | ||
|
||
function evaluate_and_gradient(a::AbstractVector{<:IntegrandOperator},uh,K) | ||
cache = evaluate_and_gradient_cache(a,uh,K) | ||
return evaluate_and_gradient!(cache,a,uh,K) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.