-
Notifications
You must be signed in to change notification settings - Fork 111
Refac data input - Post process #902
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
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #902 +/- ##
=========================================
Coverage ? 45.98%
=========================================
Files ? 68
Lines ? 18629
Branches ? 2239
=========================================
Hits ? 8566
Misses ? 8711
Partials ? 1352 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@wilfonba can you review this by just making sure it works - in particular for a short IBM case with parallel_io true and false. Just look at the output from this branch and see if it matches output from master. |
@sbryngelson Sorry, I'm just now seeing this comment. Yeah, I'll put it on my list. |
tyty |
I fixed an IB bug in the PR code. Here's the results: Serial I/Otest.mp4Parallel I/Otest.mp4Everything between the two is identical, except for the master branch doesn't seem to have the correct IB markers in the silo files with |
Fun. Does this mean it's mergeable, or am I missing something subtle? |
It's mergeable |
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.
Pull Request Overview
This PR refactors the data input module to eliminate duplicate code by extracting common file reading and MPI I/O setup logic into dedicated helper subroutines. Key changes include:
- Addition of new helper subroutines such as s_read_grid_data_direction, s_setup_mpi_io_params, s_read_ib_data_files, and s_allocate_field_arrays.
- Replacing repetitive grid data reading and MPI I/O operations with the newly created helper functions.
- Consolidation of both serial and parallel data file reading logic, reducing duplication and improving maintainability.
Comments suppressed due to low confidence (1)
src/post_process/m_data_input.f90:433
- Consider adding a detailed documentation header for the subroutine s_read_parallel_conservative_data, similar to the other helper subroutines, to clearly describe its parameters and expected behavior.
impure subroutine s_read_parallel_conservative_data(t_step, m_MOK, n_MOK, p_MOK, WP_MOK, MOK, str_MOK, NVARS_MOK)
open (1, FILE=trim(file_loc), FORM='unformatted', & | ||
STATUS='old', ACTION='read') | ||
read (1) cb_array(-1:size_dim) | ||
close (1) |
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.
Consider using parameterized or named file unit numbers instead of the hard-coded unit 1 to prevent potential conflicts and improve code clarity.
open (1, FILE=trim(file_loc), FORM='unformatted', & | |
STATUS='old', ACTION='read') | |
read (1) cb_array(-1:size_dim) | |
close (1) | |
open (UNIT_CB, FILE=trim(file_loc), FORM='unformatted', & | |
STATUS='old', ACTION='read') | |
read (UNIT_CB) cb_array(-1:size_dim) | |
close (UNIT_CB) |
Copilot uses AI. Check for mistakes.
file_loc = trim(t_step_ib_dir)//'/.' | ||
call my_inquire(file_loc, dir_check) |
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.
[nitpick] The variable 'file_loc' is reused for different directory paths, which may reduce clarity; consider using a distinct variable name for IB directory handling to improve maintainability.
file_loc = trim(t_step_ib_dir)//'/.' | |
call my_inquire(file_loc, dir_check) | |
file_loc_ib = trim(t_step_ib_dir)//'/.' | |
call my_inquire(file_loc_ib, dir_check) |
Copilot uses AI. Check for mistakes.
Got these errors recently when using
|
this must have been |
I guess the |
Previous commits of m_data_input.f90 build just fine. This PR might be the issue. |
It likely is, then, indeed. I'd rather the PR be fixed rather than attempting to revert it, if possible. Unless the issue is so deep-rooted that fixing it makes the PR meaningless. |
Co-authored-by: Ben Wilfong <48168887+wilfonba@users.noreply.github.com>
User description
Ton of duplicate junk to refactor. Let's see if it works.
PR Type
Enhancement
Description
Refactored data input module by extracting common code into helper subroutines
Eliminated duplicate code for grid data reading across x, y, z directions
Consolidated MPI I/O parameter setup and IB data file reading
Simplified field array allocation with unified helper function
Changes walkthrough 📝
m_data_input.f90
Refactor data input with helper subroutines
src/post_process/m_data_input.f90
s_read_grid_data_direction
s_setup_mpi_io_params
s_allocate_field_arrays
s_read_ib_data_files