Skip to content

Commit

Permalink
Use TOML stuff in openPMD plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Oct 22, 2021
1 parent faab1f0 commit 2fd5668
Show file tree
Hide file tree
Showing 3 changed files with 212 additions and 32 deletions.
7 changes: 6 additions & 1 deletion include/picongpu/plugins/multi/Option.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ namespace picongpu
*
* @return name
*/
std::string getName()
std::string getName() const
{
return m_name;
}
Expand Down Expand Up @@ -146,6 +146,11 @@ namespace picongpu
return ss.str();
}

bool optionDefined(uint32_t idx) const
{
return idx < StorageType::size();
}

/** get the value set by the user
*
* Throw an exception if there is no default value defined and idx is
Expand Down
16 changes: 15 additions & 1 deletion include/picongpu/plugins/openPMD/openPMDWriter.def
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "picongpu/simulation_defines.hpp"

#include "picongpu/plugins/openPMD/Json.hpp"
#include "picongpu/plugins/openPMD/toml.hpp"
#include "picongpu/simulation/control/MovingWindow.hpp"

#include <pmacc/math/Vector.hpp>
Expand Down Expand Up @@ -71,6 +72,12 @@ namespace picongpu
class openPMDWriter;
class Help;

enum class ConfigurationVia : bool
{
CommandLine,
Toml
};

struct ThreadParams
{
uint32_t currentStep; /** current simulation step */
Expand All @@ -88,6 +95,8 @@ namespace picongpu

std::unique_ptr<AbstractJsonMatcher> jsonMatcher;

std::unique_ptr<toml::DataSources> tomlDataSources;

WriteSpeciesStrategy strategy = WriteSpeciesStrategy::ADIOS;

pmacc::math::UInt64<simDim> fieldsSizeDims;
Expand All @@ -106,11 +115,16 @@ namespace picongpu

std::vector<double> times;

ConfigurationVia m_configurationSource = ConfigurationVia::CommandLine;

::openPMD::Series& openSeries(::openPMD::Access at);

void closeSeries();

void initFromConfig(Help&, size_t id, std::string const& file, std::string const& dir);
/*
* If file is empty, read from command line parameters.
*/
void initFromConfig(Help&, size_t id, std::string const& dir, std::string const& file = "");

/**
* Wrapper for ::openPMD::resetDataset, set dataset parameters
Expand Down
Loading

0 comments on commit 2fd5668

Please sign in to comment.