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

Nodal reordering of dofs #884

Open
termi-official opened this issue Feb 6, 2024 · 2 comments
Open

Nodal reordering of dofs #884

termi-official opened this issue Feb 6, 2024 · 2 comments

Comments

@termi-official
Copy link
Member

termi-official commented Feb 6, 2024

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
@KnutAM
Copy link
Member

KnutAM commented Feb 8, 2024

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?

@termi-official
Copy link
Member Author

termi-official commented Feb 8, 2024

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).

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

No branches or pull requests

2 participants