Skip to content

fix_node_order! function#46

Open
KnutAM wants to merge 2 commits intoFerrite-FEM:masterfrom
KnutAM:kam/fixordering
Open

fix_node_order! function#46
KnutAM wants to merge 2 commits intoFerrite-FEM:masterfrom
KnutAM:kam/fixordering

Conversation

@KnutAM
Copy link
Member

@KnutAM KnutAM commented Mar 12, 2025

As this happens from time to time for users loading from Gmsh, maybe this functionality that I did for an internal project we have could be relevant here.

Would be a solution for e.g. #15 without having to use Gmsh commands, which is useful if Gmsh is run from another software (e.g. neper).

Of course, this functionality could be in Ferrite too since it doesn't really interact with Gmsh, but on the other hand, this problem only seems to arise for Gmsh.

The few tests I've conducted indicate that it's fast enough to be used as a safe (perhaps even default) option when loading a Gmsh grid, but in that case, I guess the order of the vertex- and facetsets should be preserved?

Let me know if this functionality is desired here.

As reference, here is also code I used to visually validate it in addition to the tests,

# `get_nodeset_from_set` in test file
function export_bsets(grid, name = "bsets")
    VTKGridFile(name, grid) do vtk
        for key in keys(grid.facetsets)
            nodes = get_nodeset_from_set(grid, getfacetset(grid, key))
            export_nodes(vtk, grid, nodes, "facets_$key")
        end
        for key in keys(grid.vertexsets)
            nodes = get_nodeset_from_set(grid, getvertexset(grid, key))
            export_nodes(vtk, grid, nodes, "vertex_$key")
        end
    end
end

@KnutAM
Copy link
Member Author

KnutAM commented Mar 13, 2025

Error: Missing download info for actions/cache@v1

Failure seems unrelated, outdated actions?

@termi-official
Copy link
Member

Error: Missing download info for actions/cache@v1

Failure seems unrelated, outdated actions?

xref #32

@termi-official
Copy link
Member

CI is back online.

@@ -0,0 +1,79 @@
function fix_node_order!(grid::Grid{2})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a meaningful error error for 3D and a bypass for 1D?

@KnutAM
Copy link
Member Author

KnutAM commented Feb 13, 2026

Of course, this functionality could be in Ferrite too since it doesn't really interact with Gmsh, but on the other hand, this problem only seems to arise for Gmsh.

We also had this for grids from abaqus input files (ref), perhaps should be added to Ferrite then?

@termi-official
Copy link
Member

Should we add such geometry processing stuff into Ferrite directly or a package like FerriteGeometry/FerriteMeshTools/...?

@KnutAM
Copy link
Member Author

KnutAM commented Feb 19, 2026

I think I’m Ferrite directly makes more sense as long as not too exotic to avoid a jungle of packages and if it doesn’t add more deps

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants