-
Notifications
You must be signed in to change notification settings - Fork 16
move common functionality to a utility library #252
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
base: develop
Are you sure you want to change the base?
Conversation
b2a97e5 to
1acda58
Compare
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 reorganizes the codebase by moving common utility functionality (types, arrays, memory spaces, assertions, profiling, printing, etc.) into a new pcms::utility library. This refactoring addresses circular dependency issues, particularly enabling pcms::core to utilize pcms::interpolator without creating dependency cycles. The changes lay the groundwork for more modular organization of pcms::sources components.
Key Changes
- Created a new
pcms::utilitylibrary containing low-level utilities (types, arrays, memory spaces, assertions, profiling, and printing functionality) - Updated all include paths throughout the codebase from
pcms/<utility>.htopcms/utility/<utility>.h - Moved
ProcessTypealias from utility/common.h to coupler.h to keep it in the public API layer - Updated CMake configuration to build and export the new utility library, with proper dependency ordering
Reviewed changes
Copilot reviewed 50 out of 54 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/pcms/utility/types.h |
New file defining basic types (Real, LO, GO) and type utilities |
src/pcms/utility/profile.h |
New file with performance profiling macros |
src/pcms/utility/print.h |
Moved print utilities with updated includes |
src/pcms/utility/print.cpp |
Moved print implementation with corrected include path |
src/pcms/utility/memory_spaces.h |
New file defining Kokkos memory space aliases |
src/pcms/utility/inclusive_scan.h |
New file with inclusive scan implementation |
src/pcms/utility/common.h |
Moved common utilities, removed ProcessType alias |
src/pcms/utility/assert.h |
Moved assertion macros with PCMS_ prefixes |
src/pcms/utility/assert.cpp |
Moved assertion implementation |
src/pcms/utility/arrays.h |
Moved array utilities with updated includes |
src/pcms/utility/array_mask.h |
Moved array mask utilities (has include path issues) |
src/pcms/utility/CMakeLists.txt |
New CMake configuration for utility library |
src/CMakeLists.txt |
Updated to build utility library and link pcms_core to it |
config.cmake.in |
Added pcms_utility-targets import |
src/pcms/coupler.h |
Added ProcessType alias for public API |
src/pcms/*.h |
Multiple core files updated with new include paths |
src/pcms/adapter/**/*.{h,cpp} |
Adapter files updated with new include paths |
src/pcms/interpolator/**/*.hpp |
Interpolator files updated with new include paths |
src/pcms/capi/*.cpp |
C API files updated with new include paths |
test/*.cpp |
Test files updated with new include paths |
tools/*.cpp |
Tool files updated with new include paths |
Comments suppressed due to low confidence (4)
src/pcms/utility/array_mask.h:3
- This include path should be updated to use the new utility directory. It should be
#include "pcms/utility/arrays.h"instead of#include "pcms/arrays.h"to match the refactoring where arrays.h was moved to the utility library.
src/pcms/utility/array_mask.h:4 - This include should use the full path
pcms/utility/assert.hinstead of justassert.h. The relative includeassert.hcould potentially resolve to the standard library's assert.h instead of the intended pcms utility assert header, which would cause compilation errors since the file needs the PCMS_ALWAYS_ASSERT macro and other definitions.
src/pcms/utility/assert.cpp:1 - The assert.cpp implementation file should include its own header
pcms/utility/assert.hto ensure the function declaration matches the implementation. This is a best practice that helps catch signature mismatches at compile time and ensures consistency.
src/pcms/utility/assert.h:48 - These commented-out undef statements should either be removed entirely or uncommented if they're needed. Leaving them commented creates ambiguity about whether macro cleanup is intentionally disabled or simply forgotten. Since these macros are prefixed with PCMS_ to avoid naming conflicts, leaving them defined is likely acceptable, but the code should be consistent with the project's approach.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1acda58 to
ddf7e9b
Compare
ddf7e9b to
95986c8
Compare
95986c8 to
c47b4af
Compare
This reorganization will help decouple components. For example, the vmec field needs to use interpolation. With the utility libraries moved to a lower level, we can avoid a circular dependency between pcms::core pcms::interpolator. That is, pcms::core can utilize pcms::interpolator. This is really the first step in a broader re-organization of the pcms::sources to be more modular.
c47b4af to
2e50a6d
Compare
|
I think the clang-tidy failure here is actually an issue with redev. See: SCOREC/redev#56 |
|
Note:
|
Sichao25
left a comment
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.
Looks good to me!
This reorganization will help decouple components. For example, the vmec field needs to use interpolation. With the utility libraries moved to a lower level, we can avoid a circular dependency between pcms::core pcms::interpolator. That is, pcms::core can utilize pcms::interpolator. This is really the first step in a broader re-organization of the pcms::sources to be more modular.