Skip to content

Commit

Permalink
improve performance of subset
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrKryslUCSD committed Feb 15, 2024
1 parent 39504a6 commit 2b1f4dc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 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 <[email protected]>"]
version = "7.3.4"
version = "7.3.5"

[deps]
ChunkSplitters = "ae650224-84b6-46f8-82ea-d812ca08434e"
Expand Down
20 changes: 15 additions & 5 deletions src/FESetModule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Define the concrete type for a finite element set.
"""
macro define_FESet(NAME, MANIFOLD, NODESPERELEM)
return esc(:(mutable struct $NAME{IT} <: $MANIFOLD{$NODESPERELEM}
conn::Array{NTuple{$NODESPERELEM, IT}, 1}
conn::Vector{NTuple{$NODESPERELEM, IT}}
label::Vector{IT}
delegateof::Any
function $NAME(conn::AbstractArray{IT}) where {IT}
Expand All @@ -65,6 +65,19 @@ macro define_FESet(NAME, MANIFOLD, NODESPERELEM)
setlabel!(self, 0)
return self
end
function $NAME{IT}(conn::Vector{NTuple{$NODESPERELEM, IT}}) where {IT}
self = new{IT}(conn, IT[], nothing)
setlabel!(self, 0)
return self
end
function $NAME{IT}(conn::Vector{NTuple{$NODESPERELEM, IT}}, labels::Vector{IT}) where {IT}
self = new{IT}(conn, labels, nothing)
return self
end
function $NAME{IT}(conn::Vector{NTuple{$NODESPERELEM, IT}}, labels::Vector{IT}, delegof) where {IT}
self = new{IT}(conn, labels, delegof)
return self
end
end))
end
# show(macroexpand(Main, :(@define_FESet FESetT10 AbstractFESet0Manifold 10)))
Expand Down Expand Up @@ -231,10 +244,7 @@ Extract a subset of the finite elements from the given finite element set.
- `L`: an integer vector, tuple, or a range.
"""
function subset(self::ET, L) where {ET <: AbstractFESet}
result = deepcopy(self)
result.conn = deepcopy(self.conn[L])
result.label = deepcopy(self.label[L])
return result
return ET(self.conn[L], self.label[L], self.delegateof)
end

"""
Expand Down

2 comments on commit 2b1f4dc

@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/100962

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 v7.3.5 -m "<description of version>" 2b1f4dcd95e1f1c0cb6db1e5fdc40f74a20ed0d2
git push origin v7.3.5

Please sign in to comment.