From 52c0a3f9e7fd373a373b79b8c908b0e4207628b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Wed, 10 Jul 2024 16:10:29 +0200 Subject: [PATCH] CI fixes --- include/openPMD/IO/AbstractIOHandler.hpp | 4 +- include/openPMD/auxiliary/JSONMatcher.hpp | 50 +++++++++++------------ src/IO/AbstractIOHandler.cpp | 29 +++++-------- 3 files changed, 36 insertions(+), 47 deletions(-) diff --git a/include/openPMD/IO/AbstractIOHandler.hpp b/include/openPMD/IO/AbstractIOHandler.hpp index a4b3ece694..b662b908ef 100644 --- a/include/openPMD/IO/AbstractIOHandler.hpp +++ b/include/openPMD/IO/AbstractIOHandler.hpp @@ -232,7 +232,9 @@ class AbstractIOHandler virtual ~AbstractIOHandler(); AbstractIOHandler(AbstractIOHandler const &) = delete; - AbstractIOHandler(AbstractIOHandler &&) noexcept; + // std::queue::queue(queue&&) is not noexcept + // NOLINTNEXTLINE(performance-noexcept-move-constructor) + AbstractIOHandler(AbstractIOHandler &&) noexcept(false); AbstractIOHandler &operator=(AbstractIOHandler const &) = delete; AbstractIOHandler &operator=(AbstractIOHandler &&) noexcept; diff --git a/include/openPMD/auxiliary/JSONMatcher.hpp b/include/openPMD/auxiliary/JSONMatcher.hpp index 8c2cc88371..14b8724a79 100644 --- a/include/openPMD/auxiliary/JSONMatcher.hpp +++ b/include/openPMD/auxiliary/JSONMatcher.hpp @@ -1,21 +1,23 @@ #pragma once -/* Copyright 2021-2023 Franz Poeschel +/* Copyright 2021-2024 Franz Poeschel * - * This file is part of PIConGPU. + * This file is part of openPMD-api. * - * PIConGPU is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * openPMD-api is free software: you can redistribute it and/or modify + * it under the terms of of either the GNU General Public License or + * the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * PIConGPU is distributed in the hope that it will be useful, + * openPMD-api is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License and the GNU Lesser General Public License + * for more details. * * You should have received a copy of the GNU General Public License - * along with PIConGPU. + * and the GNU Lesser General Public License along with openPMD-api. * If not, see . */ @@ -57,15 +59,14 @@ class MatcherPerBackend * * This constructor will parse the given config. * It will distinguish between ordinary openPMD JSON configurations - * and extended configurations as defined by PIConGPU. - * If an ordinary JSON configuration was detected, given regex - * patterns will be matched against "" (the empty string). + * and dataset-specific configurations. * + * @param backendName The backend's JSON key. * @param config The JSON configuration for one backend. * E.g. for ADIOS2, this will be the sub-object/array found * under config["adios2"]["dataset"]. */ - MatcherPerBackend(std::string backendName_in, TracingJSON config); + MatcherPerBackend(std::string backendName, TracingJSON config); std::string backendName; @@ -78,8 +79,7 @@ class MatcherPerBackend auto get(std::string const &datasetPath) const -> nlohmann::json const &; }; /** - * @brief Class to handle extended JSON configurations as used by - * the openPMD plugin. + * @brief Class to handle default and dataset-specific JSON configurations. * * This class handles parsing of the extended JSON patterns as well as * selection of one JSON configuration by regex. @@ -100,22 +100,18 @@ class JsonMatcher explicit JsonMatcher(); /** - * @brief Initialize JSON matcher from command line arguments. + * @brief Initialize JSON matcher from a parsed JSON config. * - * This constructor will parse the given config, after reading it - * from a file if needed. In this case, the constructor is - * MPI-collective. - * It will distinguish between ordinary openPMD JSON configurations - * and extended configurations as defined by PIConGPU. - * If an ordinary JSON configuration was detected, given regex - * patterns will be matched against "" (the empty string). + * Will go through the backends' configurations (keys defined by + * `backendKeys` in JSON_internal.hpp) and check for dataset-specific + * configurations. It will then construct: + * + * 1. A default configuration. + * 2. Matchers for retrieving dataset-specific configurations. * - * @param config The JSON configuration, exactly as in - * --openPMD.json. - * @param comm MPI communicator for collective file reading, - * if needed. + * @param config The parsed JSON configuration as specified by the user. */ - JsonMatcher(openPMD::json::TracingJSON); + JsonMatcher(openPMD::json::TracingJSON config); /** * @brief Get the JSON config associated with a regex pattern. diff --git a/src/IO/AbstractIOHandler.cpp b/src/IO/AbstractIOHandler.cpp index 69a36706ac..34cd5e19d8 100644 --- a/src/IO/AbstractIOHandler.cpp +++ b/src/IO/AbstractIOHandler.cpp @@ -23,6 +23,7 @@ #include "openPMD/IO/FlushParametersInternal.hpp" #include "openPMD/auxiliary/JSONMatcher.hpp" +#include namespace openPMD { @@ -46,40 +47,30 @@ std::future AbstractIOHandler::flush(internal::FlushParams const ¶ms) } #if openPMD_HAVE_MPI -template +template <> AbstractIOHandler::AbstractIOHandler( - std::string path, Access at, TracingJSON &&jsonConfig, MPI_Comm) - : jsonMatcher(std::make_unique( - std::forward(jsonConfig))) + std::string path, Access at, json::TracingJSON &&jsonConfig, MPI_Comm) + : jsonMatcher(std::make_unique(std::move(jsonConfig))) , directory{std::move(path)} , m_backendAccess{at} , m_frontendAccess{at} {} - -template AbstractIOHandler::AbstractIOHandler( - std::string path, Access at, json::TracingJSON &&jsonConfig, MPI_Comm); #endif -template +template <> AbstractIOHandler::AbstractIOHandler( - std::string path, Access at, TracingJSON &&jsonConfig) - : jsonMatcher(std::make_unique( - std::forward(jsonConfig))) + std::string path, Access at, json::TracingJSON &&jsonConfig) + : jsonMatcher(std::make_unique(std::move(jsonConfig))) , directory{std::move(path)} , m_backendAccess{at} , m_frontendAccess{at} {} -template AbstractIOHandler::AbstractIOHandler( - std::string path, Access at, json::TracingJSON &&jsonConfig); - AbstractIOHandler::~AbstractIOHandler() = default; +// std::queue::queue(queue&&) is not noexcept +// NOLINTNEXTLINE(performance-noexcept-move-constructor) +AbstractIOHandler::AbstractIOHandler(AbstractIOHandler &&) = default; -// AbstractIOHandler::AbstractIOHandler(AbstractIOHandler const &) = default; -AbstractIOHandler::AbstractIOHandler(AbstractIOHandler &&) noexcept = default; - -// AbstractIOHandler & -// AbstractIOHandler::operator=(AbstractIOHandler const &) = default; AbstractIOHandler & AbstractIOHandler::operator=(AbstractIOHandler &&) noexcept = default; } // namespace openPMD