Ferrite.jl
Ferrite.jl copied to clipboard
Nodal reordering of dofs
Users often seem to want to have the ability that the node numbering and dof numbering coincides. We might want to consider providing a helper routine for this.
Prototype:
function reorder_nodal!(dh::DofHandler)
@assert length(dh.field_names) == 1 "Just single field possible."
grid = Ferrite.get_grid(dh)
for sdh in dh.subdofhandlers
firstcellidx = first(sdh.cellset)
celltype = typeof(getcells(grid,firstcellidx))
@assert sdh.field_interpolations[1] == Ferrite.default_interpolation(celltype)
for i ∈ 1:getncells(grid)
dh.cell_dofs[dh.cell_dofs_offset[i]:(dh.cell_dofs_offset[i]+Ferrite.ndofs_per_cell(dh, i)-1)] .= getcells(grid,i).nodes
end
end
end
That would not be possible in many cases, right? E.g. sub/superparametric. Would an alternative be to provide a query function for the dofs associated with a given node? E.g. for setting constraints, or are you thinking about visualization purposes?
That would not be possible in many cases, right? E.g. sub/superparametric.
Yes, correct. In this case we should just error out.
Would an alternative be to provide a query function for the dofs associated with a given node? E.g. for setting constraints, or are you thinking about visualization purposes?
And yes, or e.g. it seems to be quite often the case that people provide node-associated metadata (e.g. needed for ReadVTK.jl integration).