You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor: remove some unhealthy include dependencies (#7512)
* refactor(pw): remove dead esolver include from hamilt_pw.h
HamiltPW does not reference any ESolver symbol; the include of
source_esolver/esolver_ks_pw.h was unused. Removing it cuts the only
source_pw -> source_esolver back-edge (an operator header depending on
its driver) and drops 15 transitively-included headers from every
consumer of hamilt_pw.h (fan 114 -> 99).
All types named in the header (UnitCell, ModulePW::PW_Basis_K, etc.)
remain provided by klist.h / vnl_pw.h -> structure_factor.h.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* refactor(surchem): forward-declare pw types in surchem.h
Structure_Factor and Parallel_Grid are used in surchem.h only as
pointer/reference parameters, so replace the heavy source_pw includes
with forward declarations. This cuts the hamilt -> pw back-edge from
surchem.h (hamilt->pw edge 4 -> 2) and drops 6 transitively-included
headers from surchem.h's closure (54 -> 48), benefiting its ~160
transitive consumers.
Two consumers relied on the transitive include and now include it
directly (include-what-you-use):
- esolver_fp.h: has a Parallel_Grid value member -> add parallel_grid.h
- forces.cpp: accesses p_sf->strucFac -> add structure_factor.h
Other surchem.h consumers use these types only via pointer/reference
and are covered by the forward declarations; verified the remaining
parallel_grid.h users still reach it through other includes.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix(surchem): include structure_factor.h in cal_pseudo.cpp
cal_pseudo.cpp dereferences Structure_Factor (sf->strucFac) but only
included surchem.h, which now forward-declares the type. Add the direct
include so the complete type is available. Fixes the CI build error
"invalid use of incomplete type 'class Structure_Factor'".
Verified via closure analysis that this is the only remaining file in
surchem.h's affected set that requires the complete type; all other
consumers use Structure_Factor / Parallel_Grid by pointer or reference.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* style(surchem): drop verbose comment on forward declarations
Match the house style used across the codebase (e.g. makov_payne.h,
exx_helper_base.h, cube_io.h), where forward declarations are bare
`class Foo;` lines without an explanatory comment.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* style(surchem): add a one-line note on the forward declarations
Brief comment explaining why the source_pw types are forward-declared
(pointer/reference use only) so the includes are not re-added later.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments