Skip to content

Commit

Permalink
Fix some corrections that were too ambitious
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Oct 23, 2023
1 parent 80f3bbc commit d216aad
Show file tree
Hide file tree
Showing 24 changed files with 175 additions and 127 deletions.
4 changes: 2 additions & 2 deletions include/openPMD/Dataset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ class Dataset
friend class RecordComponent;

public:
Dataset(Datatype, Extent const &, std::string options = "{}");
Dataset(Datatype, Extent, std::string options = "{}");

/**
* @brief Constructor that sets the datatype to undefined.
*
* Helpful for resizing datasets, since datatypes need not be given twice.
*
*/
Dataset(Extent const &);
Dataset(Extent);

Dataset &extend(Extent newExtent);

Expand Down
18 changes: 9 additions & 9 deletions include/openPMD/IO/ADIOS/ADIOS2IOHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ namespace detail
ADIOS2IOHandlerImpl &,
adios2::IO &IO,
std::string name,
std::shared_ptr<Attribute::resource> const &resource);
Attribute::resource &resource);

template <int n, typename... Params>
static Datatype call(Params &&...);
Expand Down Expand Up @@ -1196,21 +1196,21 @@ class ADIOS2IOHandler : public AbstractIOHandler
#if openPMD_HAVE_MPI

ADIOS2IOHandler(
std::string const &path,
std::string path,
Access,
MPI_Comm,
json::TracingJSON const &options,
std::string const &engineType,
std::string const &specifiedExtension);
json::TracingJSON options,
std::string engineType,
std::string specifiedExtension);

#endif

ADIOS2IOHandler(
std::string const &path,
std::string path,
Access,
json::TracingJSON const &options,
std::string const &engineType,
std::string const &specifiedExtension);
json::TracingJSON options,
std::string engineType,
std::string specifiedExtension);

std::string backendName() const override
{
Expand Down
12 changes: 6 additions & 6 deletions include/openPMD/IO/AbstractIOHandlerHelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ namespace openPMD
*/
template <typename JSON>
std::unique_ptr<AbstractIOHandler> createIOHandler(
std::string const &path,
std::string path,
Access access,
Format format,
std::string const &originalExtension,
std::string originalExtension,
MPI_Comm comm,
JSON options,
std::string const &pathAsItWasSpecifiedInTheConstructor);
Expand All @@ -74,17 +74,17 @@ std::unique_ptr<AbstractIOHandler> createIOHandler(
*/
template <typename JSON>
std::unique_ptr<AbstractIOHandler> createIOHandler(
std::string const &path,
std::string path,
Access access,
Format format,
std::string const &originalExtension,
std::string originalExtension,
JSON options,
std::string const &pathAsItWasSpecifiedInTheConstructor);

// version without configuration to use in AuxiliaryTest
std::unique_ptr<AbstractIOHandler> createIOHandler(
std::string const &path,
std::string path,
Access access,
Format format,
std::string const &originalExtension);
std::string originalExtension);
} // namespace openPMD
2 changes: 1 addition & 1 deletion include/openPMD/IO/DummyIOHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace openPMD
class DummyIOHandler : public AbstractIOHandler
{
public:
DummyIOHandler(std::string const &, Access);
DummyIOHandler(std::string, Access);
~DummyIOHandler() override = default;

/** No-op consistent with the IOHandler interface to enable library use
Expand Down
2 changes: 1 addition & 1 deletion include/openPMD/IO/HDF5/HDF5IOHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class HDF5IOHandlerImpl;
class HDF5IOHandler : public AbstractIOHandler
{
public:
HDF5IOHandler(std::string const &path, Access, json::TracingJSON config);
HDF5IOHandler(std::string path, Access, json::TracingJSON config);
~HDF5IOHandler() override;

std::string backendName() const override
Expand Down
2 changes: 1 addition & 1 deletion include/openPMD/IO/HDF5/ParallelHDF5IOHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ParallelHDF5IOHandler : public AbstractIOHandler
public:
#if openPMD_HAVE_MPI
ParallelHDF5IOHandler(
std::string const &path, Access, MPI_Comm, json::TracingJSON config);
std::string path, Access, MPI_Comm, json::TracingJSON config);
#else
ParallelHDF5IOHandler(
std::string const &path, Access, json::TracingJSON config);
Expand Down
4 changes: 2 additions & 2 deletions include/openPMD/IO/InvalidatableFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace openPMD
*/
struct InvalidatableFile
{
explicit InvalidatableFile(std::string const &s);
explicit InvalidatableFile(std::string s);

InvalidatableFile() = default;

Expand All @@ -60,7 +60,7 @@ struct InvalidatableFile

bool valid() const;

InvalidatableFile &operator=(std::string const &s);
InvalidatableFile &operator=(std::string s);

bool operator==(InvalidatableFile const &f) const;

Expand Down
2 changes: 1 addition & 1 deletion include/openPMD/IO/JSON/JSONIOHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class JSONIOHandler : public AbstractIOHandler
JSONIOHandler(
std::string const &path,
Access at,
openPMD::json::TracingJSON const &config,
openPMD::json::TracingJSON config,
JSONIOHandlerImpl::FileFormat,
std::string originalExtension);

Expand Down
2 changes: 1 addition & 1 deletion include/openPMD/IO/JSON/JSONIOHandlerImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class JSONIOHandlerImpl : public AbstractIOHandlerImpl

explicit JSONIOHandlerImpl(
AbstractIOHandler *,
openPMD::json::TracingJSON const &config,
openPMD::json::TracingJSON config,
FileFormat,
std::string originalExtension);

Expand Down
2 changes: 1 addition & 1 deletion include/openPMD/ReadIterations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class ReadIterations
std::optional<internal::ParsePreference> m_parsePreference;

ReadIterations(
Series const &,
Series,
Access,
std::optional<internal::ParsePreference> parsePreference);

Expand Down
8 changes: 7 additions & 1 deletion include/openPMD/Series.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,13 @@ class Series : public Attributable
Access at,
std::string const &options = "{}");

virtual ~Series() = default;
Series(Series const &) = default;
Series(Series &&) = default;

Series &operator=(Series const &) = default;
Series &operator=(Series &&) = default;

~Series() override = default;

/**
* An unsigned integer type, used to identify Iterations in a Series.
Expand Down
14 changes: 7 additions & 7 deletions src/Dataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@

namespace openPMD
{
Dataset::Dataset(Datatype d, const Extent &e, std::string options_in)
: extent{e}
, dtype{d}
, rank{static_cast<uint8_t>(e.size())}
, options{std::move(options_in)}
{}
Dataset::Dataset(Datatype d, Extent e, std::string options_in)
: extent{std::move(e)}, dtype{d}, options{std::move(options_in)}
{
// avoid initialization order issues
rank = static_cast<uint8_t>(extent.size());
}

Dataset::Dataset(Extent const &e) : Dataset(Datatype::UNDEFINED, e)
Dataset::Dataset(Extent e) : Dataset(Datatype::UNDEFINED, std::move(e))
{}

Dataset &Dataset::extend(Extent newExtents)
Expand Down
82 changes: 51 additions & 31 deletions src/IO/ADIOS/ADIOS2IOHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ void ADIOS2IOHandlerImpl::readAttribute(
}

Datatype ret = switchType<detail::AttributeReader>(
type, *this, ba.m_IO, name, parameters.resource);
type, *this, ba.m_IO, name, *parameters.resource);
*parameters.dtype = ret;
}

Expand Down Expand Up @@ -1615,7 +1615,7 @@ namespace detail
ADIOS2IOHandlerImpl &impl,
adios2::IO &IO,
std::string name,
std::shared_ptr<Attribute::resource> const &resource)
Attribute::resource &resource)
{
(void)impl;
/*
Expand Down Expand Up @@ -1653,11 +1653,11 @@ namespace detail
auto meta = IO.InquireAttribute<rep>(metaAttr);
if (meta.Data().size() == 1 && meta.Data()[0] == 1)
{
*resource = bool_repr::fromRep(attr.Data()[0]);
resource = bool_repr::fromRep(attr.Data()[0]);
return determineDatatype<bool>();
}
}
*resource = attr.Data()[0];
resource = attr.Data()[0];
}
else if constexpr (IsUnsupportedComplex_v<T>)
{
Expand All @@ -1674,7 +1674,7 @@ namespace detail
"[ADIOS2] Internal error: Failed reading attribute '" +
name + "'.");
}
*resource = attr.Data();
resource = attr.Data();
}
else if constexpr (auxiliary::IsArray_v<T>)
{
Expand All @@ -1691,7 +1691,7 @@ namespace detail
{
res[i] = data[i];
}
*resource = res;
resource = res;
}
else if constexpr (std::is_same_v<T, bool>)
{
Expand All @@ -1707,7 +1707,7 @@ namespace detail
"[ADIOS2] Internal error: Failed reading attribute '" +
name + "'.");
}
*resource = attr.Data()[0];
resource = attr.Data()[0];
}

return determineDatatype<T>();
Expand Down Expand Up @@ -3394,26 +3394,35 @@ namespace detail
#if openPMD_HAVE_MPI

ADIOS2IOHandler::ADIOS2IOHandler(
std::string const &path,
std::string path,
openPMD::Access at,
MPI_Comm comm,
json::TracingJSON const &options,
std::string const &engineType,
std::string const &specifiedExtension)
: AbstractIOHandler(path, at, comm)
, m_impl{this, comm, options, engineType, specifiedExtension}
json::TracingJSON options,
std::string engineType,
std::string specifiedExtension)
: AbstractIOHandler(std::move(path), at, comm)
, m_impl{
this,
comm,
std::move(options),
std::move(engineType),
std::move(specifiedExtension)}
{}

#endif

ADIOS2IOHandler::ADIOS2IOHandler(
std::string const &path,
std::string path,
Access at,
json::TracingJSON const &options,
std::string const &engineType,
std::string const &specifiedExtension)
: AbstractIOHandler(path, at)
, m_impl{this, options, engineType, specifiedExtension}
json::TracingJSON options,
std::string engineType,
std::string specifiedExtension)
: AbstractIOHandler(std::move(path), at)
, m_impl{
this,
std::move(options),
std::move(engineType),
std::move(specifiedExtension)}
{}

std::future<void>
Expand All @@ -3424,27 +3433,38 @@ ADIOS2IOHandler::flush(internal::ParsedFlushParams &flushParams)

#else // openPMD_HAVE_ADIOS2

namespace detail
{
template <typename... Args>
void forget(Args...)
{}
} // namespace detail

#if openPMD_HAVE_MPI
ADIOS2IOHandler::ADIOS2IOHandler(
std::string const &path,
std::string path,
Access at,
MPI_Comm comm,
json::TracingJSON const &,
std::string const &,
std::string const &)
: AbstractIOHandler(path, at, comm)
{}
json::TracingJSON a,
std::string b,
std::string c)
: AbstractIOHandler(std::move(path), at, comm)
{
detail::forget(a, b, c);
}

#endif // openPMD_HAVE_MPI

ADIOS2IOHandler::ADIOS2IOHandler(
std::string const &path,
std::string path,
Access at,
json::TracingJSON const &,
std::string const &,
std::string const &)
: AbstractIOHandler(path, at)
{}
json::TracingJSON a,
std::string b,
std::string c)
: AbstractIOHandler(std::move(path), at)
{
detail::forget(std::move(a), std::move(b), std::move(c));
}

std::future<void> ADIOS2IOHandler::flush(internal::ParsedFlushParams &)
{
Expand Down
Loading

0 comments on commit d216aad

Please sign in to comment.