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

Fixing cd lag ref fe #305

Merged
merged 2 commits into from
Jun 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions src/ReferenceFEs/CDLagrangianRefFEs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,36 +30,39 @@ function CDLagrangianRefFE(::Type{T},p::Polytope{D},orders,cont) where {T,D}
grfe.dofs,
face_own_dofs,
face_own_dofs_permutations,
grfe.face_dofs,
grfe.face_dofs,
grfe.shapefuns)

end

function _compute_cd_face_own_nodes(p::ExtrusionPolytope{D},orders::NTuple{D,<:Int},cont::NTuple{D,<:Int}) where D
nodes_ijk = CartesianIndices(Tuple(orders.+1))
nodes_i = LinearIndices(nodes_ijk)
nodes, _ = compute_nodes(p,orders)
_ord = convert(NTuple{D,Float64},orders)
_nodes = map(i -> i.data.*_ord,nodes)
_nodes = map(i -> convert(NTuple{D,Int64},i),_nodes)
perm = Dict(_nodes[i] => i for i = 1:length(_nodes))
face_owned_nodes = Vector{Int64}[]
for nf in p.dface.nfaces
anc = nf.anchor
ext = nf.extrusion
fns = UnitRange{Int64}[]
for (i,(e,a,c,o)) in enumerate(zip(ext,anc,cont,orders))
if e==0 && c == DISC
push!(fns,1:-1)
push!(fns,0:-1)
break
elseif e==0 && c == CONT
push!(fns,a*o+1:a*o+1)
push!(fns,a*o:a*o)
elseif e==1 && c == DISC
push!(fns,1:o+1)
push!(fns,0:o)
elseif e==1 && c == CONT
push!(fns,2:o)
push!(fns,1:o-1)
end
end
n_ijk = CartesianIndices(Tuple(fns))
n_ijk = map(i->i.I,collect(CartesianIndices(Tuple(fns))))
if length(n_ijk) == 0
n_i = Int64[]
else
n_i = Int64[nodes_i[n_ijk]...]
n_i = sort(reshape([perm[i] for i in n_ijk],length(n_ijk)))
end
push!(face_owned_nodes,n_i)
end
Expand Down
4 changes: 4 additions & 0 deletions test/ReferenceFEsTests/CDLagrangianRefFEsTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ T = VectorValue{3,Float64}
reffe = CDLagrangianRefFE(T,HEX,(2,2,2),(CONT,CONT,DISC))
test_reference_fe(reffe)

T = Float64
reffe = LagrangianRefFE(T,QUAD,2)
reffe.face_own_nodes

end # module