Commits (2)
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -191,7 +191,7 @@ bool Foam::adiosFoam::regionControl::acceptFieldObject
(autoWrite() && obj.writeOpt() == IOobject::AUTO_WRITE)
|| requestedFields_.match(name)
)
&& !name.endsWith("_0") // ignore _0 fields
&& !name.ends_with("_0") // ignore _0 fields
);
}
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -168,7 +168,7 @@ void Foam::adiosFoam::adiosReader::scan(bool verbose)
{
const fileName varName(iter->first);
if (varName.endsWith("_0"))
if (varName.ends_with("_0"))
{
// The "_0" fields are addressed separately
continue;
......@@ -324,7 +324,7 @@ void Foam::adiosFoam::adiosReader::close()
bool Foam::adiosFoam::adiosReader::isGood() const
{
return readFilePtr_.valid();
return bool(readFilePtr_);
}
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -49,6 +49,7 @@ SourceFiles
#include "fvMesh.H"
#include "HashSet.H"
#include "Ostream.H"
#include <memory>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -71,10 +72,10 @@ private:
adios2::ADIOS& adios_;
//- ADIOS input IO definitions - mirror of InquireIO("read")
mutable autoPtr<adios2::IO> readIOPtr_;
mutable std::unique_ptr<adios2::IO> readIOPtr_;
//- ADIOS file read - mirror of ...
mutable autoPtr<adios2::Engine> readFilePtr_;
mutable std::unique_ptr<adios2::Engine> readFilePtr_;
// Data populated by the scan method
......@@ -225,11 +226,11 @@ public:
//- Extract cloud information as a registry
autoPtr<objectRegistry>
std::unique_ptr<objectRegistry>
getCloud(const word& regName, const word& cloudName);
//- Extract cloud information as a registry
autoPtr<objectRegistry>
std::unique_ptr<objectRegistry>
getCloud(const adiosFoam::cloudInfo& cldInfo);
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -37,7 +37,7 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::autoPtr<Foam::objectRegistry>
std::unique_ptr<Foam::objectRegistry>
Foam::adiosFoam::adiosReader::getCloud
(
const word& regName,
......@@ -47,18 +47,20 @@ Foam::adiosFoam::adiosReader::getCloud
// Use dummy Time for objectRegistry
autoPtr<Time> dummyTimePtr(Time::New());
auto obrPtr = autoPtr<objectRegistry>::New
std::unique_ptr<objectRegistry> obrPtr
(
IOobject
new objectRegistry
(
cloudName,
*dummyTimePtr,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
IOobject
(
cloudName,
*dummyTimePtr,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
)
)
);
auto& obr = *obrPtr;
const fileName prefixCloud(adiosFoam::cloudPath(regName, cloudName));
......@@ -69,7 +71,7 @@ Foam::adiosFoam::adiosReader::getCloud
{
const fileName varName(iter->first);
if (varName.endsWith("_0"))
if (varName.ends_with("_0"))
{
// The "_0" fields are addressed separately
continue;
......@@ -107,7 +109,7 @@ Foam::adiosFoam::adiosReader::getCloud
}
Foam::autoPtr<Foam::objectRegistry>
std::unique_ptr<Foam::objectRegistry>
Foam::adiosFoam::adiosReader::getCloud
(
const adiosFoam::cloudInfo& cldInfo
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -134,7 +134,7 @@ bool Foam::adiosFoam::adiosCoreWrite::open(const fileName& dataFile)
Foam::mkDir(path);
}
if (writeFilePtr_.valid())
if (writeFilePtr_)
{
writeFilePtr_->Close();
writeFilePtr_ = nullptr;
......@@ -147,7 +147,7 @@ bool Foam::adiosFoam::adiosCoreWrite::open(const fileName& dataFile)
// Any error handling?
return writeFilePtr_.valid();
return bool(writeFilePtr_);
}
......@@ -156,7 +156,7 @@ void Foam::adiosFoam::adiosCoreWrite::close()
// MPI_Barrier(MPI_COMM_WORLD);
// Close the file
if (writeFilePtr_.valid())
if (writeFilePtr_)
{
DebugInFunction<< "Close write" << endl;
......@@ -170,7 +170,7 @@ bool Foam::adiosFoam::adiosCoreWrite::beginWrite()
{
return
(
writeFilePtr_.valid()
writeFilePtr_
&& (adios2::StepStatus::OK == writeFilePtr_->BeginStep())
);
}
......@@ -178,7 +178,7 @@ bool Foam::adiosFoam::adiosCoreWrite::beginWrite()
bool Foam::adiosFoam::adiosCoreWrite::endWrite()
{
if (writeFilePtr_.valid())
if (writeFilePtr_)
{
writeFilePtr_->EndStep();
return true;
......@@ -193,7 +193,7 @@ void Foam::adiosFoam::adiosCoreWrite::reset()
// Remove all variable definitions and attributes
// to enable a new list of definitions in case the mesh changes
if (writeIOPtr_.valid())
if (writeIOPtr_)
{
writeIOPtr_->RemoveAllAttributes();
writeIOPtr_->RemoveAllVariables();
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -42,12 +42,12 @@ SourceFiles
#ifndef adiosCoreWrite_H
#define adiosCoreWrite_H
#include "autoPtr.H"
#include "adiosCore.H"
#include "adiosFoamCloudInfo.H"
#include "adiosFoamFieldInfo.H"
#include "dictionary.H"
#include "GeometricField.H"
#include <memory>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -78,10 +78,10 @@ protected:
std::unique_ptr<adios2::ADIOS> adiosPtr_;
//- ADIOS output IO definitions - mirror of InquireIO("write")
autoPtr<adios2::IO> writeIOPtr_;
std::unique_ptr<adios2::IO> writeIOPtr_;
//- ADIOS file write - mirror of ...
autoPtr<adios2::Engine> writeFilePtr_;
std::unique_ptr<adios2::Engine> writeFilePtr_;
private:
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -151,7 +151,7 @@ bool Foam::adiosFoam::adiosCoreWrite::putListVariable
dims // local dims
);
if (writeFilePtr_.valid())
if (writeFilePtr_)
{
#if 0
// DefineOperator("zfp", ...);
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -120,14 +120,11 @@ Foam::functionObjects::adiosWrite::readData(const fileName& bpFile)
}
autoPtr<objectRegistry> obrPtr = reader.getCloud(cldInfo);
auto obrPtr = reader.getCloud(cldInfo);
if (!obrPtr)
{
continue;
}
const objectRegistry& obr = *obrPtr;
if (adiosCore::debug & 2)
......