Skip to content

Commit

Permalink
generalize to a range of elements
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrKryslUCSD committed May 3, 2024
1 parent f563142 commit d5341bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "FinEtools"
uuid = "91bb5406-6c9a-523d-811d-0644c4229550"
authors = ["Petr Krysl <pkrysl@ucsd.edu>"]
version = "8.0.16"
version = "8.0.17"

[deps]
ChunkSplitters = "ae650224-84b6-46f8-82ea-d812ca08434e"
Expand Down
42 changes: 4 additions & 38 deletions src/FENodeToFEMapModule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ struct FENodeToFEMap{IT}
map::Vector{Vector{IT}}
end

function _makemap(conn, nmax::IT) where {IT<:Integer}
function _makemap(conn, fesindexes, nmax::IT) where {IT<:Integer}
map = Array{Vector{IT}}(undef, nmax)
@inbounds for i in eachindex(map)
map[i] = IT[] # initially empty arrays
end
@inbounds for j in eachindex(conn)
@inbounds for j in fesindexes
c = conn[j]
for i in eachindex(c)
ni = c[i]
Expand All @@ -70,18 +70,7 @@ m = FENodeToFEMap(fes.conn, count(fens))
```
"""
function FENodeToFEMap(conn::Vector{NTuple{N,IT}}, nmax::IT) where {N,IT<:Integer}
# map = Vector{IT}[]
# sizehint!(map, nmax)
# for i in 1:nmax
# push!(map, IT[]) # initially empty arrays
# end
# @inbounds for j in eachindex(conn)
# for i in eachindex(conn[j])
# ni = conn[j][i]
# push!(map[ni], j)
# end
# end
return FENodeToFEMap(_makemap(conn, nmax))
return FENodeToFEMap(_makemap(conn, 1:length(conn), nmax))
end

"""
Expand All @@ -92,30 +81,7 @@ Map from finite element nodes to the finite elements connecting them.
Convenience constructor.
"""
function FENodeToFEMap(fes::FE, nmax::IT) where {FE<:AbstractFESet,IT<:Integer}
return FENodeToFEMap(_makemap(fes.conn, nmax))
return FENodeToFEMap(_makemap(fes.conn, 1:count(fes), nmax))
end

# """
# FENodeToFEMap(conns::FIntMat, nmax::FInt)

# Map from finite element nodes to the finite elements connecting them.

# - `conns` = integer array of the connectivities
# - `nmax` = largest possible node number
# """
# function FENodeToFEMap(conns::Matrix{IT}, nmax::IT) where {IT<:Integer}
# map = Vector{IT}[]
# sizehint!(map, nmax)
# for i in 1:nmax
# push!(map, IT[]) # initially empty arrays
# end
# @inbounds for j in axes(conns, 1)
# for i in axes(conns, 2)
# ni = conns[j, i]
# push!(map[ni], j)
# end
# end
# return FENodeToFEMap(map)
# end

end

2 comments on commit d5341bf

@PetrKryslUCSD
Copy link
Owner Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/106070

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v8.0.17 -m "<description of version>" d5341bf17df840d8c8156d814bcab239e9543991
git push origin v8.0.17

Please sign in to comment.