From b11fdcca07734237a73a0a492b964e032a923dd0 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Wed, 9 Oct 2024 15:57:30 -0700 Subject: [PATCH] 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