8 #include "ConfigFileArguments.hpp" 9 #include "include/pv_common.h" 10 #include "utils/PVLog.hpp" 19 std::string
const &configFile,
20 MPI_Comm communicator,
21 bool allowUnrecognizedArguments) {
23 initialize(configFile, communicator, allowUnrecognizedArguments);
29 std::string
const &configFile,
30 MPI_Comm communicator,
31 bool allowUnrecognizedArguments) {
32 resetState(configFile, communicator, allowUnrecognizedArguments);
37 std::string
const &configFile,
38 MPI_Comm communicator,
39 bool allowUnrecognizedArguments) {
40 std::string configContents;
41 unsigned int fileSize = 0U;
43 MPI_Comm_rank(communicator, &rank);
46 std::ifstream configFileStream{configFile};
48 configFileStream.fail(),
49 "ConfigFileArguments unable to open \"%s\" for reading: %s\n",
52 configFileStream.seekg(0, std::ios_base::end);
53 fileSize = (
unsigned int)configFileStream.tellg();
54 configContents.resize(fileSize);
55 configFileStream.seekg(0, std::ios_base::beg);
56 configFileStream.read(&configContents.at(0), fileSize);
57 MPI_Bcast(&fileSize, 1, MPI_UNSIGNED, 0, communicator);
58 MPI_Bcast(&configContents.at(0), (int)fileSize, MPI_CHAR, 0, communicator);
61 MPI_Bcast(&fileSize, 1, MPI_UNSIGNED, 0, communicator);
62 configContents.resize(fileSize);
63 MPI_Bcast(&configContents.at(0), (int)fileSize, MPI_CHAR, 0, communicator);
65 std::istringstream configStream{configContents};
ConfigFileArguments(std::string const &configFile, MPI_Comm communicator, bool allowUnrecognizedArguments)
int initialize(std::string const &configFile, MPI_Comm communicator, bool allowUnrecognizedArguments)