From b11fdcca07734237a73a0a492b964e032a923dd0 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Wed, 9 Oct 2024 15:57:30 -0700 Subject: [PATCH 1/3] SoA: Public Getter for Names Expose the names to public member functions. --- Src/Particle/AMReX_StructOfArrays.H | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Src/Particle/AMReX_StructOfArrays.H b/Src/Particle/AMReX_StructOfArrays.H index 201cf340dc..c051ddeb7c 100644 --- a/Src/Particle/AMReX_StructOfArrays.H +++ b/Src/Particle/AMReX_StructOfArrays.H @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -52,6 +53,28 @@ struct StructOfArrays { /** Get access to the particle Int Arrays (only compile-time components) */ [[nodiscard]] const std::array< IntVector, NInt>& GetIntData () const { return m_idata; } + /** Get the names for the real SoA components **/ + [[nodiscard]] std::vector GetRealNames () const + { + if (m_rdata_names) { + return *m_rdata_names; + } + else { + throw std::runtime_error("SoA: no Real names defined!"); + } + } + + /** Get the names for the int SoA components **/ + [[nodiscard]] std::vector GetIntNames () const + { + if (m_idata_names) { + return *m_idata_names; + } + else { + throw std::runtime_error("SoA: no int names defined!"); + } + } + /** Get access to a particle Real component Array (compile-time and runtime component) * * @param index component with 0...NReal-1 compile-time and NReal... runtime arguments From f5c73d860b3a6fbc726f37fcdaa1a89bbb35ae43 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Thu, 10 Oct 2024 10:48:27 -0700 Subject: [PATCH 2/3] Return empty --- Src/Particle/AMReX_StructOfArrays.H | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Src/Particle/AMReX_StructOfArrays.H b/Src/Particle/AMReX_StructOfArrays.H index c051ddeb7c..558255daed 100644 --- a/Src/Particle/AMReX_StructOfArrays.H +++ b/Src/Particle/AMReX_StructOfArrays.H @@ -60,7 +60,7 @@ struct StructOfArrays { return *m_rdata_names; } else { - throw std::runtime_error("SoA: no Real names defined!"); + return std::vector(); } } @@ -71,7 +71,7 @@ struct StructOfArrays { return *m_idata_names; } else { - throw std::runtime_error("SoA: no int names defined!"); + return std::vector(); } } From 225be7f4d61e2d5b6acd6a2033568bdb42e53e22 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Thu, 10 Oct 2024 10:48:42 -0700 Subject: [PATCH 3/3] Return empty (include) --- Src/Particle/AMReX_StructOfArrays.H | 1 - 1 file changed, 1 deletion(-) diff --git a/Src/Particle/AMReX_StructOfArrays.H b/Src/Particle/AMReX_StructOfArrays.H index 558255daed..46d18a1715 100644 --- a/Src/Particle/AMReX_StructOfArrays.H +++ b/Src/Particle/AMReX_StructOfArrays.H @@ -8,7 +8,6 @@ #include #include -#include #include #include