From 594eac1b142b80d236a47d583229ea397cec3579 Mon Sep 17 00:00:00 2001 From: Simon Schlepphorst Date: Tue, 19 May 2026 15:41:40 +0200 Subject: [PATCH 1/2] First fix for BareField, FieldLayout and SubFieldLayout --- src/Field/BareField.h | 7 ++++++- src/Field/BareField.hpp | 13 ++++++++++++- src/Field/BareFieldOperations.hpp | 15 +++++++++++++++ src/FieldLayout/FieldLayout.cpp | 2 ++ src/FieldLayout/FieldLayout.h | 5 +++-- src/FieldLayout/FieldLayout.hpp | 16 +++++++++++----- src/FieldLayout/SubFieldLayout.h | 7 ++----- src/FieldLayout/SubFieldLayout.hpp | 19 ++++++++++--------- 8 files changed, 61 insertions(+), 23 deletions(-) diff --git a/src/Field/BareField.h b/src/Field/BareField.h index 33908ef53..8afd7805a 100644 --- a/src/Field/BareField.h +++ b/src/Field/BareField.h @@ -227,7 +227,12 @@ namespace ippl { } // namespace ippl +#ifndef IPPL_BARE_FIELD_HPP #include "Field/BareField.hpp" +#endif // IPPL_BARE_FIELD_HPP + +#ifndef IPPL_BARE_FIELD_OPERATIONS_HPP #include "Field/BareFieldOperations.hpp" +#endif // IPPL_BARE_FIELD_OPERATIONS_HPP -#endif +#endif // IPPL_BARE_FIELD_H diff --git a/src/Field/BareField.hpp b/src/Field/BareField.hpp index efcddb5f1..4d904d0a5 100644 --- a/src/Field/BareField.hpp +++ b/src/Field/BareField.hpp @@ -2,7 +2,16 @@ // Class BareField // A BareField consists of multple LFields and represents a field. // -#include "Ippl.h" + +#ifndef IPPL_BARE_FIELD_HPP +#define IPPL_BARE_FIELD_HPP + +// clang-format off +#ifndef IPPL_BARE_FIELD_H +// HACK: cyclic anitpattern, but necessary for proper LSP markup +#include "Field/BareField.h" +#endif +// clang-format on #include #include @@ -224,3 +233,5 @@ namespace ippl { DefineReduction(Prod, prod, valL *= myVal, std::multiplies) } // namespace ippl + +#endif // IPPL_BARE_FIELD_HPP diff --git a/src/Field/BareFieldOperations.hpp b/src/Field/BareFieldOperations.hpp index c4c0ab005..fd1d09ea1 100644 --- a/src/Field/BareFieldOperations.hpp +++ b/src/Field/BareFieldOperations.hpp @@ -2,6 +2,19 @@ // File BareFieldOperations // Norms and a scalar product for fields // +#ifndef IPPL_BARE_FIELD_OPERATIONS_HPP +#define IPPL_BARE_FIELD_OPERATIONS_HPP + +// clang-format off +#ifndef IPPL_BARE_FIELD_H +// HACK: cyclic anitpattern, but necessary for proper LSP markup +// FIXME: Use a BareField concept, until then this include is needless +#include "Field/BareField.h" +#endif +// clang-format on + +#include "Utility/IpplTimings.h" +#include "Utility/ParallelDispatch.h" namespace ippl { /*! @@ -93,3 +106,5 @@ namespace ippl { } } } // namespace ippl + +#endif // IPPL_BARE_FIELD_OPERATIONS_HPP diff --git a/src/FieldLayout/FieldLayout.cpp b/src/FieldLayout/FieldLayout.cpp index dd93863cd..f2d857c0e 100644 --- a/src/FieldLayout/FieldLayout.cpp +++ b/src/FieldLayout/FieldLayout.cpp @@ -1,3 +1,5 @@ +#include + #include "Utility/IpplException.h" namespace ippl { diff --git a/src/FieldLayout/FieldLayout.h b/src/FieldLayout/FieldLayout.h index 780040e8b..accda2405 100644 --- a/src/FieldLayout/FieldLayout.h +++ b/src/FieldLayout/FieldLayout.h @@ -17,7 +17,6 @@ #include "Communicate/Communicator.h" #include "Index/NDIndex.h" -#include "Partition/Partitioner.h" namespace ippl { @@ -399,6 +398,8 @@ namespace ippl { } } // namespace ippl +#ifndef IPPL_FIELD_LAYOUT_HPP #include "FieldLayout/FieldLayout.hpp" +#endif // IPPL_FIELD_LAYOUT_HPP -#endif +#endif // IPPL_FIELD_LAYOUT_H diff --git a/src/FieldLayout/FieldLayout.hpp b/src/FieldLayout/FieldLayout.hpp index 2bcb1bcd1..d5674d9bf 100644 --- a/src/FieldLayout/FieldLayout.hpp +++ b/src/FieldLayout/FieldLayout.hpp @@ -5,16 +5,20 @@ // partitioning. The user may request that a particular dimension not be // partitioned by flagging that axis as 'SERIAL' (instead of 'PARALLEL'). // -#include "Ippl.h" +#ifndef IPPL_FIELD_LAYOUT_HPP +#define IPPL_FIELD_LAYOUT_HPP -#include -#include +// clang-format off +#ifndef IPPL_FIELD_LAYOUT_H +// HACK: cyclic anitpattern, but necessary for proper LSP markup +#include "FieldLayout/FieldLayout.h" +#endif +// clang-format on -#include "Utility/IpplException.h" #include "Utility/IpplTimings.h" #include "Utility/PAssert.h" -#include "FieldLayout/FieldLayout.h" +#include "Partition/Partitioner.h" namespace ippl { @@ -344,3 +348,5 @@ namespace ippl { } } // namespace ippl + +#endif // IPPL_FIELD_LAYOUT_HPP diff --git a/src/FieldLayout/SubFieldLayout.h b/src/FieldLayout/SubFieldLayout.h index 85fdd0151..7e83bf985 100644 --- a/src/FieldLayout/SubFieldLayout.h +++ b/src/FieldLayout/SubFieldLayout.h @@ -7,11 +7,6 @@ #ifndef IPPL_SUB_FIELD_LAYOUT_H #define IPPL_SUB_FIELD_LAYOUT_H -#include -#include -#include -#include - #include "Types/ViewTypes.h" #include "Communicate/Communicator.h" @@ -178,6 +173,8 @@ namespace ippl { }; } // namespace ippl +#ifndef IPPL_SUB_FIELD_LAYOUT_HPP #include "FieldLayout/SubFieldLayout.hpp" +#endif #endif diff --git a/src/FieldLayout/SubFieldLayout.hpp b/src/FieldLayout/SubFieldLayout.hpp index 53ee24c11..a2bc0f6f7 100644 --- a/src/FieldLayout/SubFieldLayout.hpp +++ b/src/FieldLayout/SubFieldLayout.hpp @@ -4,16 +4,15 @@ // It ensures that the sub-region is partitioned in the same way as the original FieldLayout, // maintaining consistent parallel decomposition and neighbor relationships within the sub-region. // -#include "Ippl.h" - -#include -#include - -#include "Utility/IpplException.h" -#include "Utility/IpplTimings.h" -#include "Utility/PAssert.h" +#ifndef IPPL_SUB_FIELD_LAYOUT_HPP +#define IPPL_SUB_FIELD_LAYOUT_HPP +// clang-format off +#ifndef IPPL_SUB_FIELD_LAYOUT_H +// HACK: cyclic anitpattern, but necessary for proper LSP markup #include "FieldLayout/SubFieldLayout.h" +#endif +// clang-format on namespace ippl { @@ -125,4 +124,6 @@ namespace ippl { originDomain_m = domain; } -} // namespace ippl \ No newline at end of file +} // namespace ippl + +#endif // IPPL_SUB_FIELD_LAYOUT_HPP From ab0b9571b7bdefab880de42fb08c23e7a38af2a2 Mon Sep 17 00:00:00 2001 From: Simon Schlepphorst Date: Tue, 19 May 2026 17:35:47 +0200 Subject: [PATCH 2/2] cleanup, include-what-you-use --- src/Expression/IpplExpressions.h | 4 +++- src/Field/BareField.h | 22 +++++++++++----------- src/Types/Vector.h | 17 ++++++++++++----- src/Types/Vector.hpp | 20 +++++++++++++++++--- 4 files changed, 43 insertions(+), 20 deletions(-) diff --git a/src/Expression/IpplExpressions.h b/src/Expression/IpplExpressions.h index 632238eb2..5917124d9 100644 --- a/src/Expression/IpplExpressions.h +++ b/src/Expression/IpplExpressions.h @@ -5,7 +5,9 @@ #ifndef IPPL_EXPRESSIONS_H #define IPPL_EXPRESSIONS_H -#include +#include // for KOKKOS_INLINE_FUNCTION, KOKKOS_FUNCTION +#include // for size_t +#include // for false_type, true_type namespace ippl { namespace detail { diff --git a/src/Field/BareField.h b/src/Field/BareField.h index 8afd7805a..d0c95dfda 100644 --- a/src/Field/BareField.h +++ b/src/Field/BareField.h @@ -5,21 +5,21 @@ #ifndef IPPL_BARE_FIELD_H #define IPPL_BARE_FIELD_H -#include +#include // for size_t +#include // for std::ostream -#include -#include +#include "Types/IpplTypes.h" // for detail::size_type +#include "Types/ViewTypes.h" // for detail::ViewType -#include "Types/IpplTypes.h" +#include "Utility/Inform.h" // for Inform +#include "Utility/PAssert.h" // for PAssert and PAssert_LE +#include "Utility/ParallelDispatch.h" // for RangePolicy -#include "Utility/IpplInfo.h" -#include "Utility/PAssert.h" -#include "Utility/ViewUtils.h" +#include "Expression/IpplExpressions.h" // for detail::Expression -#include "Expression/IpplExpressions.h" - -#include "Field/HaloCells.h" -#include "FieldLayout/FieldLayout.h" +#include "Field/HaloCells.h" // for detail::HaloCells +#include "FieldLayout/FieldLayout.h" // for FieldLayout +#include "Index/NDIndex.h" // for NDIndex namespace ippl { class Index; diff --git a/src/Types/Vector.h b/src/Types/Vector.h index 89a96bcad..e87b933c8 100644 --- a/src/Types/Vector.h +++ b/src/Types/Vector.h @@ -2,12 +2,17 @@ // Class Vector // Vector class used for vector fields and particle attributes like the coordinate. // -#ifndef IPPL_Vector_H -#define IPPL_Vector_H +#ifndef IPPL_VECTOR_H +#define IPPL_VECTOR_H -#include +#include // for KOKKOS_INLINE_FUNCTION +#include // for array +#include // for size_t +#include // for initializer_list +#include // for enable_if, true_type +#include // for vector -#include "Expression/IpplExpressions.h" +#include "Expression/IpplExpressions.h" // for Expression, isExpression... namespace ippl { /*! @@ -110,6 +115,8 @@ namespace ippl { KOKKOS_INLINE_FUNCTION Vector max(const Vector& a, const Vector& b); } // namespace ippl +#ifndef IPPL_VECTOR_HPP #include "Vector.hpp" - #endif + +#endif // IPPL_VECTOR_H diff --git a/src/Types/Vector.hpp b/src/Types/Vector.hpp index 5f5ffa268..4342585ea 100644 --- a/src/Types/Vector.hpp +++ b/src/Types/Vector.hpp @@ -2,10 +2,23 @@ // Class Vector // Vector class used for vector fields and particle attributes like the coordinate. // -// #include "Utility/PAssert.h" -#include -#include +#ifndef IPPL_VECTOR_HPP +#define IPPL_VECTOR_HPP + +// clang-format off +#ifndef IPPL_Vector_H +// HACK: cyclic anitpattern, but necessary for proper LSP markup +#include "Vector.h" +#endif +// clang-format on + +#include // for max, min +#include // for operator<<, setw +#include // for basic_ostream, char_traits + +#include "Kokkos_Macros.hpp" // for KOKKOS_INLINE_FUNCTION +#include "Kokkos_MathematicalFunctions.hpp" // for pow, abs namespace ippl { namespace detail { @@ -233,6 +246,7 @@ namespace ippl { } } // namespace ippl +#endif // IPPL_VECTOR_HPP // vi: set et ts=4 sw=4 sts=4: // Local Variables: // mode:c