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

Topology vroom 1 #753

Merged
merged 27 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
30db7bd
Separate topology from grid.
termi-official Jun 29, 2023
b76473b
Split up topology.
termi-official Jun 29, 2023
f9a290a
Remove todo.
termi-official Jun 29, 2023
5e34ec6
Enhanced type stability.
termi-official Jun 29, 2023
31a6db5
Stop topology from overflowing my terminal buffer.
termi-official Jun 29, 2023
083fd14
Optimize algorithm for topology construction by eliminating allocations.
termi-official Jun 29, 2023
79e8ced
Update variable names.
termi-official Jun 29, 2023
3fed03c
Update variable names 2.
termi-official Jun 29, 2023
d241712
Derp.
termi-official Jun 29, 2023
c2104c0
Fix oopsie.
termi-official Jun 29, 2023
1c6365b
Matrices :)
termi-official Jun 29, 2023
c34e939
Replace last dict in topology with vector, too.
termi-official Jun 29, 2023
7207632
Fix bug.
termi-official Jun 29, 2023
2fc5af9
Update exports.
termi-official Jun 29, 2023
02845b2
Add note about broken mixed-dimensional queries.
termi-official Jun 30, 2023
dc234ed
Update field docs.
termi-official Jun 30, 2023
336d8cb
Update doc reference
termi-official Jun 30, 2023
799344c
Lazy face skeleton.
termi-official Jun 30, 2023
0d2bdcc
Update src/Grid/topology.jl
termi-official Jul 1, 2023
d63fceb
More tweaks.
termi-official Jul 3, 2023
8c4317e
Merge PR.
termi-official Jul 3, 2023
b450c58
Rename as requested.
termi-official Jul 3, 2023
4a1de95
Oopsie
termi-official Jul 3, 2023
bccd0f5
Rename in tests.
termi-official Jul 3, 2023
e7fc044
Missing dispathc.
termi-official Jul 3, 2023
bf51b12
asdf
termi-official Jul 3, 2023
fdd21eb
Remove algebraic stuff on EntityNeighborhood.
termi-official Jul 5, 2023
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
2 changes: 2 additions & 0 deletions docs/src/reference/grid.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ get_cell_coordinates!
Ferrite.ExclusiveTopology
Ferrite.getneighborhood
Ferrite.faceskeleton
Ferrite.vertex_star_stencils
Ferrite.getstencil
```

### Grid Sets Utility
Expand Down
49 changes: 49 additions & 0 deletions src/Dofs/DofHandler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,17 @@ function sortedge(edge::Tuple{Int,Int})
a < b ? (return (edge, PathOrientationInfo(true))) : (return ((b, a), PathOrientationInfo(false)))
end

"""
sortedge_fast(edge::Tuple{Int,Int})

Returns the unique representation of an edge.
Here the unique representation is the sorted node index tuple.
"""
function sortedge_fast(edge::Tuple{Int,Int})
a, b = edge
a < b ? (return edge) : (return (b, a))
end

"""
sortface(face::Tuple{Int})
sortface(face::Tuple{Int,Int})
Expand All @@ -633,6 +644,20 @@ so the unique representation is always a tuple length 3.
"""
sortface(face::Tuple{Int,Int}) = sortedge(face) # Face in 2D is the same as edge in 3D.


"""
sortface_fast(face::Tuple{Int})
sortface_fast(face::Tuple{Int,Int})
sortface_fast(face::Tuple{Int,Int,Int})
sortface_fast(face::Tuple{Int,Int,Int,Int})

Returns the unique representation of a face.
Here the unique representation is the sorted node index tuple.
Note that in 3D we only need indices to uniquely identify a face,
so the unique representation is always a tuple length 3.
"""
sortface_fast(face::Tuple{Int,Int}) = sortedge_fast(face) # Face in 2D is the same as edge in 3D.

"""
!!!NOTE TODO implement me.

Expand Down Expand Up @@ -669,6 +694,16 @@ function sortface(face::Tuple{Int,Int,Int})
return (a, b, c), SurfaceOrientationInfo() # TODO fill struct
end


function sortface_fast(face::Tuple{Int,Int,Int})
a, b, c = face
b, c = minmax(b, c)
a, c = minmax(a, c)
a, b = minmax(a, b)
return (a, b, c)
end


function sortface(face::Tuple{Int,Int,Int,Int})
a, b, c, d = face
c, d = minmax(c, d)
Expand All @@ -680,7 +715,21 @@ function sortface(face::Tuple{Int,Int,Int,Int})
return (a, b, c), SurfaceOrientationInfo() # TODO fill struct
end


function sortface_fast(face::Tuple{Int,Int,Int,Int})
a, b, c, d = face
c, d = minmax(c, d)
b, d = minmax(b, d)
a, d = minmax(a, d)
b, c = minmax(b, c)
a, c = minmax(a, c)
a, b = minmax(a, b)
return (a, b, c)
end


sortface(face::Tuple{Int}) = face, nothing
sortface_fast(face::Tuple{Int}) = face

"""
find_field(dh::DofHandler, field_name::Symbol)::NTuple{2,Int}
Expand Down
2 changes: 2 additions & 0 deletions src/Ferrite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ include("FEValues/face_integrals.jl")

# Grid
include("Grid/grid.jl")
include("Grid/topology.jl")
include("Grid/utils.jl")
include("Grid/grid_generators.jl")
include("Grid/coloring.jl")

Expand Down
Loading