Remove fmt::format and replace with std::format

This commit is contained in:
Alexander Bock
2024-03-24 20:19:14 +01:00
parent 9878bfc8f7
commit 3ba346a227
246 changed files with 1343 additions and 1300 deletions
@@ -369,7 +369,7 @@ RenderableFieldlinesSequence::RenderableFieldlinesSequence(
}
else {
_tracingVariable = "b"; // Magnetic field variable as default
LWARNING(fmt::format(
LWARNING(std::format(
"No tracing variable, using default '{}'", _tracingVariable
));
}
@@ -388,7 +388,7 @@ RenderableFieldlinesSequence::RenderableFieldlinesSequence(
// the files with the same extension as fileTypeString
std::filesystem::path sourcePath = p.sourceFolder;
if (!std::filesystem::is_directory(sourcePath)) {
LERROR(fmt::format(
LERROR(std::format(
"FieldlinesSequence '{}' is not a valid directory", sourcePath
));
}
@@ -420,7 +420,7 @@ RenderableFieldlinesSequence::RenderableFieldlinesSequence(
// Ensure that there are available and valid source files left
if (_sourceFiles.empty()) {
LERROR(fmt::format(
LERROR(std::format(
"'{}' contains no {} files", sourcePath.string(), fileTypeString
));
}
@@ -490,7 +490,7 @@ RenderableFieldlinesSequence::RenderableFieldlinesSequence(
_outputFolderPath = p.outputFolder.value_or(_outputFolderPath);
if (!_outputFolderPath.empty() && !std::filesystem::is_directory(_outputFolderPath)) {
_outputFolderPath.clear();
LERROR(fmt::format(
LERROR(std::format(
"The specified output path '{}' does not exist", _outputFolderPath
));
}
@@ -617,7 +617,7 @@ void RenderableFieldlinesSequence::loadOsflsStatesIntoRAM() {
}
}
else {
LWARNING(fmt::format("Failed to load state from '{}'", filePath));
LWARNING(std::format("Failed to load state from '{}'", filePath));
}
}
}
@@ -851,7 +851,7 @@ std::unordered_map<std::string, std::vector<glm::vec3>>
std::unordered_map<std::string, std::vector<glm::vec3>> outMap;
if (!std::filesystem::is_directory(filePath)) {
LERROR(fmt::format(
LERROR(std::format(
"The specified seed point directory '{}' does not exist", filePath
));
return outMap;
@@ -868,12 +868,12 @@ std::unordered_map<std::string, std::vector<glm::vec3>>
std::ifstream seedFile(seedFilePath);
if (!seedFile.good()) {
LERROR(fmt::format("Could not open seed points file '{}'", seedFilePath));
LERROR(std::format("Could not open seed points file '{}'", seedFilePath));
outMap.clear();
return {};
}
LDEBUG(fmt::format("Reading seed points from file '{}'", seedFilePath));
LDEBUG(std::format("Reading seed points from file '{}'", seedFilePath));
std::string line;
std::vector<glm::vec3> outVec;
while (std::getline(seedFile, line)) {
@@ -886,7 +886,7 @@ std::unordered_map<std::string, std::vector<glm::vec3>>
}
if (outVec.empty()) {
LERROR(fmt::format("Found no seed points in '{}'", seedFilePath));
LERROR(std::format("Found no seed points in '{}'", seedFilePath));
outMap.clear();
return {};
}
@@ -140,7 +140,7 @@ bool FieldlinesState::loadStateFromJson(const std::string& pathToJsonFile,
std::ifstream ifs(pathToJsonFile);
if (!ifs.is_open()) {
LERROR(fmt::format("Failed to open file '{}'", pathToJsonFile));
LERROR(std::format("Failed to open file '{}'", pathToJsonFile));
return false;
}
@@ -252,7 +252,7 @@ void FieldlinesState::saveStateToOsfls(const std::string& absPath) {
std::ofstream ofs(absPath + fileName, std::ofstream::binary | std::ofstream::trunc);
if (!ofs.is_open()) {
LERROR(fmt::format(
LERROR(std::format(
"Failed to save state to binary file: {}{}", absPath, fileName
));
return;
@@ -326,12 +326,12 @@ void FieldlinesState::saveStateToJson(const std::string& absPath) {
const char* ext = ".json";
std::ofstream ofs(absPath + ext, std::ofstream::trunc);
if (!ofs.is_open()) {
LERROR(fmt::format(
LERROR(std::format(
"Failed to save state to json file at location: {}{}", absPath, ext
));
return;
}
LINFO(fmt::format("Saving fieldline state to: {}{}", absPath, ext));
LINFO(std::format("Saving fieldline state to: {}{}", absPath, ext));
json jColumns = { "x", "y", "z" };
for (const std::string& s : _extraQuantityNames) {
@@ -371,7 +371,7 @@ void FieldlinesState::saveStateToJson(const std::string& absPath) {
const int indentationSpaces = 2;
ofs << std::setw(indentationSpaces) << jFile << std::endl;
LINFO(fmt::format("Saved fieldline state to: {}{}", absPath, ext));
LINFO(std::format("Saved fieldline state to: {}{}", absPath, ext));
}
void FieldlinesState::setModel(fls::Model m) {
@@ -311,7 +311,7 @@ void prepareStateAndKameleonForExtras(ccmc::Kameleon* kameleon,
str = TAsPOverRho;
}
if (!success) {
LWARNING(fmt::format("Failed to load extra variable '{}'. Ignoring", str));
LWARNING(std::format("Failed to load extra variable '{}'. Ignoring", str));
extraScalarVars.erase(extraScalarVars.begin() + i);
--i;
}
@@ -349,7 +349,7 @@ void prepareStateAndKameleonForExtras(ccmc::Kameleon* kameleon,
name = JParallelB;
}
if (!success) {
LWARNING(fmt::format(
LWARNING(std::format(
"Failed to load at least one of the magnitude variables: '{}', '{}', "
"'{}'. Removing ability to store corresponding magnitude",
s1, s2, s3
@@ -368,7 +368,7 @@ void prepareStateAndKameleonForExtras(ccmc::Kameleon* kameleon,
else {
// WRONG NUMBER OF MAGNITUDE VARIABLES.. REMOVE ALL!
extraMagVars.clear();
LWARNING(fmt::format(
LWARNING(std::format(
"Wrong number of variables provided for storing magnitudes. Expects multiple "
"of 3 but {} are provided",
extraMagVars.size()