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

Add remove attribute procedure to FileMetadata #2626

Merged
merged 1 commit into from
Feb 28, 2024
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
- Added procedures to remove an attribute from a FileMetadata object and from a Variable object in PFIO
- Add per-collection timer output for History
- Add python utilities to split and recombine restarts
- Add a new "SPLIT\_CHECKPOINT:" option that has replaced the write-by-face option. This will write a file per writer wit the base checkpoint name being a control file that tells how many files were written to. On reading if this control file is provided as the restart file name, it will automatically trigger reading the individual files
Expand Down
11 changes: 10 additions & 1 deletion pfio/FileMetadata.F90
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ module pFIO_FileMetadataMod
procedure :: add_attribute_1d
procedure :: get_attribute
procedure :: has_attribute
procedure :: remove_attribute

procedure :: get_variable
procedure :: get_coordinate_variable
Expand Down Expand Up @@ -87,7 +88,7 @@ function new_FileMetadata(unusable, dimensions, global, variables, order) result
type (StringVector), optional, intent(in) :: order



fmd%dimensions = StringIntegerMap()
if (present(dimensions)) fmd%dimensions = dimensions

Expand Down Expand Up @@ -235,6 +236,14 @@ logical function has_attribute(this, attr_name)

end function has_attribute

subroutine remove_attribute(this, attr_name)
class (FileMetadata), target, intent(inout) :: this
character(len=*), intent(in) :: attr_name

call this%global_var%remove_attribute(attr_name)

end subroutine


function get_attributes(this, rc ) result(attributes)
type (StringAttributeMap), pointer :: attributes
Expand Down
12 changes: 12 additions & 0 deletions pfio/Variable.F90
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module pFIO_VariableMod
generic :: add_attribute => add_attribute_1d
procedure :: add_attribute_0d
procedure :: add_attribute_1d
procedure :: remove_attribute
procedure :: add_const_value

procedure :: get_chunksizes
Expand Down Expand Up @@ -182,6 +183,17 @@ function get_attributes(this) result(attributes)

end function get_attributes

subroutine remove_attribute(this,attr_name,rc)
class (Variable), target, intent(inout) :: this
character(len=*), intent(in) :: attr_name
integer, optional, intent(out) :: rc
type(StringAttributeMapIterator) :: iter
integer :: status

iter = this%attributes%find(attr_name)
call this%attributes%erase(iter)
_RETURN(_SUCCESS)
end subroutine

subroutine add_attribute_0d(this, attr_name, attr_value, rc)
class (Variable), target, intent(inout) :: this
Expand Down