diff options
Diffstat (limited to 'Source/Particles/Resampling')
-rw-r--r-- | Source/Particles/Resampling/LevelingThinning.H | 10 | ||||
-rw-r--r-- | Source/Particles/Resampling/LevelingThinning.cpp | 6 | ||||
-rw-r--r-- | Source/Particles/Resampling/Resampling.H | 9 | ||||
-rw-r--r-- | Source/Particles/Resampling/Resampling.cpp | 10 | ||||
-rw-r--r-- | Source/Particles/Resampling/ResamplingTrigger.H | 7 | ||||
-rw-r--r-- | Source/Particles/Resampling/ResamplingTrigger.cpp | 8 |
6 files changed, 36 insertions, 14 deletions
diff --git a/Source/Particles/Resampling/LevelingThinning.H b/Source/Particles/Resampling/LevelingThinning.H index 920fa07c9..14d0f8e6a 100644 --- a/Source/Particles/Resampling/LevelingThinning.H +++ b/Source/Particles/Resampling/LevelingThinning.H @@ -19,10 +19,18 @@ */ class LevelingThinning: public ResamplingAlgorithm { public: + + /** + * \brief Default constructor of the LevelingThinning class. + */ + LevelingThinning () = default; + /** * \brief Constructor of the LevelingThinning class + * + * @param[in] species_name the name of the resampled species */ - LevelingThinning (); + LevelingThinning (const std::string species_name); /** * \brief A method that performs leveling thinning for the considered species. diff --git a/Source/Particles/Resampling/LevelingThinning.cpp b/Source/Particles/Resampling/LevelingThinning.cpp index 0fc347241..7ac28932e 100644 --- a/Source/Particles/Resampling/LevelingThinning.cpp +++ b/Source/Particles/Resampling/LevelingThinning.cpp @@ -9,12 +9,12 @@ #include <AMReX_Particles.H> -LevelingThinning::LevelingThinning () +LevelingThinning::LevelingThinning (const std::string species_name) { using namespace amrex::literals; - amrex::ParmParse pp("resampling_algorithm"); - pp.query("target_ratio", m_target_ratio); + amrex::ParmParse pp(species_name); + pp.query("resampling_algorithm_target_ratio", m_target_ratio); AMREX_ALWAYS_ASSERT_WITH_MESSAGE( m_target_ratio > 0._rt, "Resampling target ratio should be strictly greater than 0"); if (m_target_ratio <= 1._rt) diff --git a/Source/Particles/Resampling/Resampling.H b/Source/Particles/Resampling/Resampling.H index de919bfcb..b381771f8 100644 --- a/Source/Particles/Resampling/Resampling.H +++ b/Source/Particles/Resampling/Resampling.H @@ -39,10 +39,17 @@ class Resampling public: /** + * \brief Default constructor of the Resampling class. + */ + Resampling () = default; + + /** * \brief Constructor of the Resampling class. Reads the chosen resampling algorithm from the * input file. + * + * @param[in] species_name the name of the resampled species */ - Resampling (); + Resampling (const std::string species_name); /** * \brief A method that returns true if resampling should be done for the considered species diff --git a/Source/Particles/Resampling/Resampling.cpp b/Source/Particles/Resampling/Resampling.cpp index 65332d191..b5c2d8b4f 100644 --- a/Source/Particles/Resampling/Resampling.cpp +++ b/Source/Particles/Resampling/Resampling.cpp @@ -7,18 +7,20 @@ #include "Resampling.H" #include "LevelingThinning.H" -Resampling::Resampling () +Resampling::Resampling (const std::string species_name) { - amrex::ParmParse pp("resampling_algorithm"); + amrex::ParmParse pp(species_name); std::string resampling_algorithm_string = "leveling_thinning"; // default resampling algorithm - pp.query("type", resampling_algorithm_string); + pp.query("resampling_algorithm", resampling_algorithm_string); if (resampling_algorithm_string.compare("leveling_thinning") == 0) { - m_resampling_algorithm = std::make_unique<LevelingThinning>(); + m_resampling_algorithm = std::make_unique<LevelingThinning>(species_name); } else { amrex::Abort("Unknown resampling algorithm."); } + + m_resampling_trigger = ResamplingTrigger(species_name); } bool Resampling::triggered (const int timestep, const amrex::Real global_numparts) const diff --git a/Source/Particles/Resampling/ResamplingTrigger.H b/Source/Particles/Resampling/ResamplingTrigger.H index 7e373289a..830b511f2 100644 --- a/Source/Particles/Resampling/ResamplingTrigger.H +++ b/Source/Particles/Resampling/ResamplingTrigger.H @@ -22,10 +22,15 @@ class ResamplingTrigger public: /** + * \brief Default constructor of the ResamplingTrigger class. + */ + ResamplingTrigger () = default; + + /** * \brief Constructor of the ResamplingTrigger class. Reads the resampling trigger parameters * from the input file. */ - ResamplingTrigger (); + ResamplingTrigger (const std::string species_name); /** * \brief A method that returns true if resampling should be done for the considered species diff --git a/Source/Particles/Resampling/ResamplingTrigger.cpp b/Source/Particles/Resampling/ResamplingTrigger.cpp index c89f01848..97407d51a 100644 --- a/Source/Particles/Resampling/ResamplingTrigger.cpp +++ b/Source/Particles/Resampling/ResamplingTrigger.cpp @@ -7,15 +7,15 @@ #include "ResamplingTrigger.H" #include "WarpX.H" -ResamplingTrigger::ResamplingTrigger () +ResamplingTrigger::ResamplingTrigger (const std::string species_name) { - amrex::ParmParse pprt("resampling_trigger"); + amrex::ParmParse pprt(species_name); std::vector<std::string> resampling_trigger_int_string_vec = {"0"}; - pprt.queryarr("intervals", resampling_trigger_int_string_vec); + pprt.queryarr("resampling_trigger_intervals", resampling_trigger_int_string_vec); m_resampling_intervals = IntervalsParser(resampling_trigger_int_string_vec); - pprt.query("max_avg_ppc", m_max_avg_ppc); + pprt.query("resampling_trigger_max_avg_ppc", m_max_avg_ppc); } bool ResamplingTrigger::triggered (const int timestep, const amrex::Real global_numparts) const |