Skip to content

Commit 158f818

Browse files
committed
removing a bunch of dead code from DofManager.
1 parent 20b4012 commit 158f818

File tree

3 files changed

+1
-157
lines changed

3 files changed

+1
-157
lines changed

src/DofManagers.jl

Lines changed: 0 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -219,54 +219,6 @@ Base.length(dof::DofManager) = length(dof.H1_bc_dofs) + length(dof.H1_unknown_do
219219

220220
KA.get_backend(dof::DofManager) = KA.get_backend(dof.H1_unknown_dofs)
221221

222-
# is create_bcs even really needed anymore?
223-
224-
"""
225-
$(TYPEDSIGNATURES)
226-
"""
227-
function create_bcs(dof::DofManager, ::Type{H1Field})
228-
backend = KA.get_backend(dof.H1_bc_dofs)
229-
return KA.zeros(backend, Float64, length(dof.H1_bc_dofs))
230-
end
231-
232-
# this one needs some TLC
233-
# function create_bcs(dof::DofManager, ::Type{H1Field}, dirichlet_bcs, time)
234-
# backend = KA.get_backend(dof.H1_bc_dofs)
235-
236-
# X = dof.H1_vars[1].fspace.coords
237-
# # ND = num_dimensions(dof.H1_vars[1].fspace)
238-
# ND = size(X, 1) # TODO do this in a type stable way
239-
# # ND = num_fields(X)
240-
# # gather all dirichlet dofs
241-
# dirichlet_dofs = vcat(map(x -> x.bookkeeping.dofs, dirichlet_bcs)...)
242-
# dirichlet_vals = KA.zeros(backend, Float64, 0)
243-
244-
# dirichlet_perm = sortperm(dirichlet_dofs)
245-
# dirichlet_dofs = dirichlet_dofs[dirichlet_perm]
246-
# dof_unique = unique(i -> dirichlet_dofs[i], eachindex(dirichlet_dofs))
247-
# dirichlet_dofs = dirichlet_dofs[dof_unique]
248-
249-
# # dirichlet_vals = vcat(map(x -> x.func.(X[:, x.bookkeeping.nodes], (time,)), dirichlet_bcs)...)
250-
251-
# for bc in dirichlet_bcs
252-
# # for node in bc.bookkeeping.nodes
253-
# AK.foreachindex(bc.bookkeeping.nodes) do n
254-
# node = bc.bookkeeping.nodes[n]
255-
# X_temp = SVector{ND, Float64}(@views X[:, node])
256-
# # @show bc.func(X_temp, time)
257-
# push!(dirichlet_vals, bc.func(X_temp, time))
258-
# end
259-
# end
260-
# # @show dirichlet_vals
261-
# # dirichlet_dofs
262-
# # need to get the coordinates and time
263-
# # for bc in dirichlet_bcs
264-
265-
# # end
266-
# dirichlet_vals[dirichlet_perm][dof_unique]
267-
# end
268-
269-
270222
"""
271223
$(TYPEDSIGNATURES)
272224
"""
@@ -470,51 +422,6 @@ function update_dofs!(dof::DofManager, dirichlet_dofs::T) where T <: AbstractArr
470422
return nothing
471423
end
472424

473-
KA.@kernel function _update_field_bcs_kernel!(U::H1Field, dof::DofManager, Ubc::T) where T <: AbstractArray{<:Number, 1}
474-
N = KA.@index(Global)
475-
@inbounds U[dof.H1_bc_dofs[N]] = Ubc[N]
476-
end
477-
478-
function _update_field_bcs!(U::H1Field, dof::DofManager, Ubc::T, backend::KA.Backend) where T <: AbstractArray{<:Number, 1}
479-
kernel! = _update_field_bcs_kernel!(backend)
480-
kernel!(U, dof, Ubc, ndrange = length(Ubc))
481-
return nothing
482-
end
483-
484-
function _update_field_bcs!(U::H1Field, dof::DofManager, Ubc::T, ::KA.CPU) where T <: AbstractArray{<:Number, 1}
485-
U[dof.H1_bc_dofs] .= Ubc
486-
return nothing
487-
end
488-
489-
"""
490-
$(TYPEDSIGNATURES)
491-
Does a simple copy on CPUs. On GPUs it uses a ```KernelAbstractions``` kernel
492-
"""
493-
function update_field_bcs!(U::H1Field, dof::DofManager, Ubc::T) where T <: AbstractArray{<:Number, 1}
494-
_update_field_bcs!(U, dof, Ubc, KA.get_backend(dof))
495-
return nothing
496-
end
497-
498-
# # CPU only for now
499-
# function update_field_bcs!(U::H1Field, dof::DofManager, dbc::DirichletBC, t)
500-
# X_global = dof.H1_vars[1].fspace.coords
501-
# for (n, node) in enumerate(dbc.bookkeeping.nodes)
502-
# X = @views X_global[:, node]
503-
# dbc.vals[n] = dbc.func(X, t)
504-
# end
505-
# for (n, dof) in enumerate(dbc.bookkeeping.dofs)
506-
# U[dof] = dbc.vals[n]
507-
# end
508-
# return nothing
509-
# end
510-
511-
# CPU only for now, implementations in bcs folders
512-
function update_field_bcs!(U::H1Field, dof::DofManager, dbcs, t)
513-
for bc in dbcs
514-
update_field_bcs!(U, dof, bc, t)
515-
end
516-
end
517-
518425
KA.@kernel function _update_field_unknowns_kernel!(U::H1Field, dof::DofManager, Uu::T) where T <: AbstractArray{<:Number, 1}
519426
N = KA.@index(Global)
520427
@inbounds U[dof.H1_unknown_dofs[N]] = Uu[N]
@@ -541,69 +448,6 @@ function update_field_unknowns!(U::H1Field, dof::DofManager, Uu::T) where T <: A
541448
return nothing
542449
end
543450

544-
KA.@kernel function _update_field_unknowns_kernel_minus!(U::H1Field, dof::DofManager, Uu::T) where T <: AbstractArray{<:Number, 1}
545-
N = KA.@index(Global)
546-
@inbounds U[dof.H1_unknown_dofs[N]] -= Uu[N]
547-
end
548-
549-
KA.@kernel function _update_field_unknowns_kernel_plus!(U::H1Field, dof::DofManager, Uu::T) where T <: AbstractArray{<:Number, 1}
550-
N = KA.@index(Global)
551-
@inbounds U[dof.H1_unknown_dofs[N]] += Uu[N]
552-
end
553-
554-
function _update_field_unknowns!(U::H1Field, dof::DofManager, Uu::T, ::typeof(-), backend::KA.Backend) where T <: AbstractArray{<:Number, 1}
555-
kernel! = _update_field_unknowns_kernel_minus!(backend)
556-
kernel!(U, dof, Uu, ndrange = length(Uu))
557-
return nothing
558-
end
559-
560-
function _update_field_unknowns!(U::H1Field, dof::DofManager, Uu::T, ::typeof(+), backend::KA.Backend) where T <: AbstractArray{<:Number, 1}
561-
kernel! = _update_field_unknowns_kernel_plus!(backend)
562-
kernel!(U, dof, Uu, ndrange = length(Uu))
563-
return nothing
564-
end
565-
566-
function _update_field_unknowns!(U::H1Field, dof::DofManager, Uu::T, ::typeof(-), ::KA.CPU) where T <: AbstractArray{<:Number, 1}
567-
for (n, d) in enumerate(dof.H1_unknown_dofs)
568-
U[d] -= Uu[n]
569-
end
570-
return nothing
571-
end
572-
573-
function _update_field_unknowns!(U::H1Field, dof::DofManager, Uu::T, ::typeof(+), ::KA.CPU) where T <: AbstractArray{<:Number, 1}
574-
for (n, d) in enumerate(dof.H1_unknown_dofs)
575-
U[d] += Uu[n]
576-
end
577-
return nothing
578-
end
579-
580-
"""
581-
$(TYPEDSIGNATURES)
582-
Does a simple addition on CPUs. On GPUs it uses a ```KernelAbstractions``` kernel
583-
"""
584-
function update_field_unknowns!(U::H1Field, dof::DofManager, Uu::T, ::typeof(-)) where T <: AbstractArray{<:Number, 1}
585-
_update_field_unknowns!(U, dof, Uu, -, KA.get_backend(dof))
586-
return nothing
587-
end
588-
589-
"""
590-
$(TYPEDSIGNATURES)
591-
Does a simple addition on CPUs. On GPUs it uses a ```KernelAbstractions``` kernel
592-
"""
593-
function update_field_unknowns!(U::H1Field, dof::DofManager, Uu::T, ::typeof(+)) where T <: AbstractArray{<:Number, 1}
594-
_update_field_unknowns!(U, dof, Uu, +, KA.get_backend(dof))
595-
return nothing
596-
end
597-
598-
"""
599-
$(TYPEDSIGNATURES)
600-
"""
601-
function update_field!(U::H1Field, dof::DofManager, Uu::T, Ubc::T) where T <: AbstractArray{<:Number, 1}
602-
update_field_bcs!(U, dof, Ubc)
603-
update_field_unknowns!(U, dof, Uu)
604-
return nothing
605-
end
606-
607451
Base.show(io::IO, dof::DofManager) =
608452
print(io, "DofManager\n",
609453
" Number of nodes = $(num_nodes(dof))\n",

src/FiniteElementContainers.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export create_field
3131
export create_unknowns
3232
export update_bcs!
3333
export update_dofs!
34-
export update_field_bcs!
3534
export update_field_unknowns!
3635
export update_field!
3736

test/TestDofManagers.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ function test_dof_constructors(fspace)
66
dof = DofManager(u)
77
dof = DofManager(u, v)
88
dof = DofManager(u, v, w)
9+
@show dof
910
end
1011

1112
function test_dof_methods(fspace)

0 commit comments

Comments
 (0)