Skip to content

Commit

Permalink
enable scattering of all degree of freedom kinds
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrKryslUCSD committed May 21, 2024
1 parent d30ae0a commit d8bf110
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 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.21"
version = "8.0.22"

[deps]
DataDrop = "aa547a04-dd37-49ab-8e73-656744f8a8fc"
Expand Down
26 changes: 13 additions & 13 deletions src/FieldModule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ function gathersysvec(self::F, kind::Symbol) where {F<:AbstractField}
end

"""
gathersysvec!(self::F,
vec::Vector{T}, which = :f) where {F<:AbstractField, T}
gathersysvec!(self::F, vec::Vector{T}, kind::KIND_INT = DOF_KIND_FREE) where {F<:AbstractField,T}
Gather values from the field for the system vector.
Expand All @@ -192,7 +191,7 @@ Gather values from the field for the system vector.
- `vec`: destination buffer;
- `kind`: integer, kind of degrees of freedom to gather: default is `DOF_KIND_FREE`.
"""
function gathersysvec!(self::F, vec::Vector{T}, kind = DOF_KIND_FREE) where {F<:AbstractField,T}
function gathersysvec!(self::F, vec::Vector{T}, kind::KIND_INT = DOF_KIND_FREE) where {F<:AbstractField,T}
nents, dim = size(self.values)
from, upto = first(dofrange(self, kind)), last(dofrange(self, kind))
length(vec) == length(from:upto) || error("Vector needs to be of length equal to $(length(from:upto))")
Expand Down Expand Up @@ -650,21 +649,22 @@ function applyebc!(self::F) where {F<:AbstractField}
end

"""
scattersysvec!(self::F, vec::AbstractVector{T}) where {F<:AbstractField, T<:Number}
scattersysvec!(self::F, vec::AbstractVector{T}, kind::KIND_INT = DOF_KIND_FREE) where {F<:AbstractField,T<:Number}
Scatter values to the field from a system vector.
The vector may be either for just the free degrees of freedom, or for all the
degrees of freedom.
The vector may be for an arbitrary kind of degrees of freedom (default is the free degrees of freedom).
"""
function scattersysvec!(self::F, vec::AbstractVector{T}) where {F<:AbstractField,T<:Number}
function scattersysvec!(self::F, vec::AbstractVector{T}, kind::KIND_INT = DOF_KIND_FREE) where {F<:AbstractField,T<:Number}
nents, dim = size(self.values)
nve = length(vec)
for i = 1:nents
for j = 1:dim
dn = self.dofnums[i, j]
if (dn > 0) && (dn <= nve)
self.values[i, j] = vec[dn]
from, upto = first(dofrange(self, kind)), last(dofrange(self, kind))
length(vec) == length(from:upto) || error("Vector needs to be of length equal to $(length(from:upto))")
@inbounds for i in 1:nents
for j in 1:dim
en = self.dofnums[i, j]
if from <= en <= upto
p = en - from + 1
self.values[i, j] = vec[p]
end
end
end
Expand Down

2 comments on commit d8bf110

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

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.22 -m "<description of version>" d8bf11021da09c43f3322e3c8c882de090f383c7
git push origin v8.0.22

Please sign in to comment.