Better operator evaluations + more operator tests#69
Open
chmerdon wants to merge 13 commits into
Open
Conversation
added 2 commits
May 22, 2026 13:35
…here for application of inverse trafo to compute derivatives; removed some type annotations from get_coefficient closure functions; item loops and citem properties of structs now use Ti type
pjaap
reviewed
May 22, 2026
Member
pjaap
left a comment
There was a problem hiding this comment.
Nice work!
I think @views would really improve the code here.
But this is up to you. I'm not judging. Well, ok, a little :)
| for i in 1:size(cvals, 3), c in 1:length(offsets), k in 1:size(L2GAinv, 2), dof_i in 1:size(cvals, 2) | ||
| # compute duc/dxk | ||
| cvals[k + offsets[c], dof_i, i] += L2GAinv[k, j] * refbasisderivvals[subset[dof_i] + offsets2[c], j, i] | ||
| cvals[k + offsets[c], dof_i, i] = dot(view(L2GAinv, k, :), view(refbasisderivvals, subset[dof_i] + offsets2[c], :, i)) |
Member
There was a problem hiding this comment.
You know I'm a fan of @views and here, it really makes the code better + less brackets:
cvals[k + offsets[c], dof_i, i] = @views dot(L2GAinv[k, :], refbasisderivvals[subset[dof_i] + offsets2[c], :, i])
| cvals[3, dof_i, i] -= L2GAinv[2, k] * refbasisderivvals[subset[dof_i] + offsets2[1], k, i] # - du1/dx2 | ||
| end | ||
| end | ||
| for i in 1:size(cvals, 3), dof_i in 1:size(cvals, 2) |
Member
There was a problem hiding this comment.
here you can put the @views even in front of the for.
|
|
||
| if fetype <: AbstractHcurlFiniteElement | ||
| return maximum([error_curl3]) | ||
| else |
Member
There was a problem hiding this comment.
Just for better code readability:
if cond
return XXX
end
# no else, since this code branch is evaluated anyway
| println("EG = Tetrahedron3D | $fetype | operator = Gradient | error = $error_grad") | ||
| println("EG = Tetrahedron3D | $fetype | operator = Divergence | error = $error_div") | ||
|
|
||
| if fetype <: AbstractH1FiniteElement |
Member
There was a problem hiding this comment.
and here
if !(fetype <: AbstractH1FiniteElemen)
return ...
end
# no else
added 4 commits
May 22, 2026 17:30
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.