|
| 1 | +const CONT = 0 |
| 2 | +const DISC = 1 |
| 3 | + |
| 4 | +function CDLagrangianRefFE(::Type{T},p::Polytope{D},order::Int,cont) where {T,D} |
| 5 | + orders = tfill(order,Val{D}()) |
| 6 | + CDLagrangianRefFE(T,p,orders,cont) |
| 7 | +end |
| 8 | + |
| 9 | +function CDLagrangianRefFE(::Type{T},p::Polytope{D},orders,cont) where {T,D} |
| 10 | + |
| 11 | + lrfe = LagrangianRefFE(T,p,orders) |
| 12 | + grfe = lrfe.data |
| 13 | + |
| 14 | + face_own_nodes = _compute_cd_face_own_nodes(p,orders,cont) |
| 15 | + |
| 16 | + face_own_dofs = _generate_face_own_dofs(face_own_nodes, grfe.dofs.node_and_comp_to_dof) |
| 17 | + |
| 18 | + reffaces = compute_lagrangian_reffaces(T,p,orders) |
| 19 | + |
| 20 | + _reffaces = vcat(reffaces...) |
| 21 | + |
| 22 | + ndofs = length(grfe.dofs.dof_to_node) |
| 23 | + |
| 24 | + face_own_dofs_permutations = _trivial_face_own_dofs_permutations(face_own_dofs) |
| 25 | + |
| 26 | + GenericRefFE( |
| 27 | + grfe.ndofs, |
| 28 | + grfe.polytope, |
| 29 | + grfe.prebasis, |
| 30 | + grfe.dofs, |
| 31 | + face_own_dofs, |
| 32 | + face_own_dofs_permutations, |
| 33 | + grfe.face_dofs, |
| 34 | + grfe.shapefuns) |
| 35 | + |
| 36 | +end |
| 37 | + |
| 38 | +function _compute_cd_face_own_nodes(p::ExtrusionPolytope{D},orders::NTuple{D,<:Int},cont::NTuple{D,<:Int}) where D |
| 39 | + nodes_ijk = CartesianIndices(Tuple(orders.+1)) |
| 40 | + nodes_i = LinearIndices(nodes_ijk) |
| 41 | + face_owned_nodes = Vector{Int64}[] |
| 42 | + for nf in p.dface.nfaces |
| 43 | + anc = nf.anchor |
| 44 | + ext = nf.extrusion |
| 45 | + fns = UnitRange{Int64}[] |
| 46 | + for (i,(e,a,c,o)) in enumerate(zip(ext,anc,cont,orders)) |
| 47 | + if e==0 && c == DISC |
| 48 | + push!(fns,1:-1) |
| 49 | + break |
| 50 | + elseif e==0 && c == CONT |
| 51 | + push!(fns,a*o+1:a*o+1) |
| 52 | + elseif e==1 && c == DISC |
| 53 | + push!(fns,1:o+1) |
| 54 | + elseif e==1 && c == CONT |
| 55 | + push!(fns,2:o) |
| 56 | + end |
| 57 | + end |
| 58 | + n_ijk = CartesianIndices(Tuple(fns)) |
| 59 | + if length(n_ijk) == 0 |
| 60 | + n_i = Int64[] |
| 61 | + else |
| 62 | + n_i = Int64[nodes_i[n_ijk]...] |
| 63 | + end |
| 64 | + push!(face_owned_nodes,n_i) |
| 65 | + end |
| 66 | + face_owned_nodes |
| 67 | +end |
0 commit comments