Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cell field evaluation at arbitrary points #146

Merged
merged 2 commits into from
May 17, 2024

Conversation

principejavier
Copy link
Member

@santiagobadia , @JordiManyer please review this PR, I intent to use it to extract line cuts in 3D models in a simple way, e.g. by

x0=Point(0.,0.5)
x1=Point(0.,0.5)
n=10 # number of points in the cut
t=[(i-1)/n for i=1:n+1]
x=map(x->x*(x1-x0)+x0,t)
u=uh(x)

will provide a cut at y=0.5.

@principejavier principejavier self-assigned this May 17, 2024
@JordiManyer JordiManyer merged commit 0bb7457 into master May 17, 2024
6 checks passed
@JordiManyer JordiManyer deleted the cell_field_evaluation_at_arbitrary_points branch May 17, 2024 07:07
m=length(v)
y=map(local_views(I),local_views(caches)) do fi,cache
w=Vector{Float64}(undef,m)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allocate w as Vector{T} where T=typeof(evaluate!(cache,I,x)

w[i]=evaluate!(cache,fi,x)
catch
w[i]=-Inf
Copy link
Contributor

@pmartorell pmartorell Jun 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set -Inf of type T. E.g., zero(T) - Inf

evaluate!(cache,fi,x)
catch
-Inf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set -Inf of type T. E.g., zero(T) - Inf

@@ -58,6 +58,25 @@ function main(distribute,parts)
u3 = CellField(2.0,Ω)
u = _my_op∘(u1,u2,u3)

order = 1
reffe = ReferenceFE(lagrangian,Float64,order)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a test for a non-scalar field

end
# reduce((v,w)->broadcast(max,v,w),y)
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return non-distributed array. E.g., PArrays.getany(emit(z))

reduce(max,zi)
end
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return non-distributed array. E.g., PArrays.getany(emit(z))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants