Skip to content

Commit

Permalink
SoA: Public Getter for Names
Browse files Browse the repository at this point in the history
Expose the names to public member functions.
  • Loading branch information
ax3l committed Oct 10, 2024
1 parent 8df11b6 commit b11fdcc
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Src/Particle/AMReX_StructOfArrays.H
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <algorithm>
#include <array>
#include <stdexcept>
#include <string>
#include <vector>

Expand Down Expand Up @@ -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<std::string> 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<std::string> 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
Expand Down

0 comments on commit b11fdcc

Please sign in to comment.