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

Re-add getfieldnames(::FieldHandler) #659

Merged
merged 3 commits into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Internal changes
- `Ferrite.ndim(dh, fieldname)` has been removed, use `Ferrite.getfielddim(dh,
fieldname)` instead. ([#658][github-658])
- `getfielddims(::FieldHandler)` and `getfieldinterpolations(::FieldHandler)` removed ([#647][github-647]) (Note that `getfieldnames(::FieldHandler)` was re-introduced in [#659][github-659])

## [0.3.13] - 2023-03-23
### Added
Expand Down Expand Up @@ -385,6 +386,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[github-645]: https://github.com/Ferrite-FEM/Ferrite.jl/pull/645
[github-650]: https://github.com/Ferrite-FEM/Ferrite.jl/pull/650
[github-658]: https://github.com/Ferrite-FEM/Ferrite.jl/pull/658
[github-647]: https://github.com/Ferrite-FEM/Ferrite.jl/pull/647
[github-659]: https://github.com/Ferrite-FEM/Ferrite.jl/pull/659

[Unreleased]: https://github.com/Ferrite-FEM/Ferrite.jl/compare/v0.3.13...HEAD
[0.3.13]: https://github.com/Ferrite-FEM/Ferrite.jl/compare/v0.3.12...v0.3.13
Expand Down
2 changes: 2 additions & 0 deletions src/Dofs/MixedDofHandler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,13 @@ end

"""
getfieldnames(dh::MixedDofHandler)
getfieldnames(fh::FieldHandler)

Return a vector with the names of all fields. Can be used as an iterable over all the fields
in the problem.
"""
getfieldnames(dh::MixedDofHandler) = dh.field_names
getfieldnames(fh::FieldHandler) = [field.name for field in fh.fields]

getfielddim(fh::FieldHandler, field_idx::Int) = fh.fields[field_idx].dim
getfielddim(fh::FieldHandler, field_name::Symbol) = getfielddim(fh, find_field(fh, field_name))
Expand Down
2 changes: 2 additions & 0 deletions test/test_mixeddofhandler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ function test_2d_mixed_1_el()
@test ndofs(dh) == 12
@test ndofs_per_cell(dh, 1) == 12
@test celldofs(dh, 1) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]

@test Set(Ferrite.getfieldnames(dh)) == Set(Ferrite.getfieldnames(dh.fieldhandlers[1]))
end

function test_2d_mixed_2_el()
Expand Down