-
Notifications
You must be signed in to change notification settings - Fork 73
Allow meshes to be renamed on load #452
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
Open
Ricky Wong (mo-rickywong)
wants to merge
10
commits into
MetOffice:main
Choose a base branch
from
mo-rickywong:lfric2lfric_in_and_out
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e94d80e
Commit branch that seems to work
mo-rickywong 4d96be9
Merge branch 'main' into lfric2lfric_in_and_out
mo-rickywong a495fb6
Commit changes to fir with linked ticket
mo-rickywong 2ab0c15
Update UMLs and add Doxygen comments
mo-rickywong 2171cfa
Update doxygen
mo-rickywong f46c050
Remove trailing whitespace
mo-rickywong 0348f7a
Test the ugrid_data object
mo-rickywong 03fe4a6
Merge branch 'main' into lfric2lfric_in_and_out
mo-rickywong 61d5885
Merge branch 'main' into lfric2lfric_in_and_out
mo-rickywong c581117
Merge branch 'main' into lfric2lfric_in_and_out
mo-rickywong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,8 +14,8 @@ module load_global_mesh_mod | |
| LOG_LEVEL_INFO | ||
| use ugrid_mesh_data_mod, only: ugrid_mesh_data_type | ||
|
|
||
|
|
||
| use global_mesh_collection_mod, only: global_mesh_collection | ||
| use global_mesh_collection_mod, only: global_mesh_collection_type, & | ||
| global_mesh_collection | ||
|
|
||
| implicit none | ||
|
|
||
|
|
@@ -37,18 +37,34 @@ module load_global_mesh_mod | |
| !> @param[in] mesh_names The names of the global meshes to load | ||
| !> from the <input_mesh_file>. | ||
| subroutine load_global_mesh_multiple( input_mesh_file, & | ||
| mesh_names ) | ||
| mesh_names, & | ||
| rename_to ) | ||
|
|
||
|
|
||
| implicit none | ||
|
|
||
| character(str_max_filename), intent(in) :: input_mesh_file | ||
| character(str_def), intent(in) :: mesh_names(:) | ||
|
|
||
| character(str_def), optional :: rename_to(:) | ||
|
|
||
| character(str_def), allocatable :: names(:) | ||
|
|
||
| integer(i_def) :: i | ||
|
|
||
|
|
||
| allocate(names, source=mesh_names) | ||
|
|
||
| if ( present(rename_to) ) then | ||
| if (size(rename_to) == size(mesh_names)) then | ||
| deallocate(names) | ||
| allocate(names, source=rename_to) | ||
| end if | ||
| end if | ||
|
|
||
| do i=1, size(mesh_names) | ||
| call load_global_mesh_single( input_mesh_file, & | ||
| mesh_names(i) ) | ||
| mesh_names(i), rename_to=names(i) ) | ||
| end do | ||
|
|
||
| end subroutine load_global_mesh_multiple | ||
|
|
@@ -61,17 +77,29 @@ end subroutine load_global_mesh_multiple | |
| !> @param[in] mesh_name The name of the global mesh to load | ||
| !> from the <input_mesh_file>. | ||
| subroutine load_global_mesh_single( input_mesh_file, & | ||
| mesh_name ) | ||
| mesh_name, rename_to ) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rename_to is missing PARAM |
||
|
|
||
| implicit none | ||
|
|
||
| character(str_max_filename), intent(in) :: input_mesh_file | ||
| character(str_def), intent(in) :: mesh_name | ||
| character(*), intent(in) :: input_mesh_file | ||
| character(*), intent(in) :: mesh_name | ||
|
|
||
| character(*), optional, intent(in) :: rename_to | ||
|
|
||
|
|
||
| type(ugrid_mesh_data_type) :: ugrid_mesh_data | ||
| type(global_mesh_type) :: global_mesh | ||
|
|
||
| if (.not. global_mesh_collection%check_for(mesh_name)) then | ||
| character(str_def) :: name | ||
|
|
||
|
|
||
| if ( present(rename_to) ) then | ||
| name=rename_to | ||
| else | ||
| name=mesh_name | ||
| end if | ||
|
|
||
| if (.not. global_mesh_collection%check_for(name)) then | ||
|
|
||
| write(log_scratch_space,'(A)') & | ||
| 'Reading global mesh: "'//trim(mesh_name)//'"' | ||
|
|
@@ -81,7 +109,7 @@ subroutine load_global_mesh_single( input_mesh_file, & | |
| call ugrid_mesh_data%read_from_file( trim(input_mesh_file), & | ||
| mesh_name ) | ||
|
|
||
| global_mesh = global_mesh_type( ugrid_mesh_data ) | ||
| global_mesh = global_mesh_type( ugrid_mesh_data, rename_to=name ) | ||
| call ugrid_mesh_data%clear() | ||
|
|
||
| call global_mesh_collection%add_new_global_mesh ( global_mesh ) | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename_to is missing PARAM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you mean, the
rename_toargument is anoptionalargumentThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you mean Doxygen comments