Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Community
adiosFoam
Commits
f635fe33
Commit
f635fe33
authored
Jul 23, 2020
by
Mark OLESEN
Browse files
STYLE: use unique_ptr instead of autoPtr for adios variables
parent
642cf1e1
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/adiosFoam/read/adiosReader.C
View file @
f635fe33
...
...
@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-20
19
OpenCFD Ltd.
Copyright (C) 2016-20
20
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -324,7 +324,7 @@ void Foam::adiosFoam::adiosReader::close()
bool
Foam
::
adiosFoam
::
adiosReader
::
isGood
()
const
{
return
readFilePtr_
.
valid
(
);
return
bool
(
readFilePtr_
);
}
...
...
src/adiosFoam/read/adiosReader.H
View file @
f635fe33
...
...
@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-20
19
OpenCFD Ltd.
Copyright (C) 2016-20
20
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
autoP
tr
<
adios2
::
IO
>
readIOPtr_
;
mutable
std
::
unique_p
tr
<
adios2
::
IO
>
readIOPtr_
;
//- ADIOS file read - mirror of ...
mutable
autoP
tr
<
adios2
::
Engine
>
readFilePtr_
;
mutable
std
::
unique_p
tr
<
adios2
::
Engine
>
readFilePtr_
;
// Data populated by the scan method
...
...
@@ -225,11 +226,11 @@ public:
//- Extract cloud information as a registry
autoP
tr
<
objectRegistry
>
std
::
unique_p
tr
<
objectRegistry
>
getCloud
(
const
word
&
regName
,
const
word
&
cloudName
);
//- Extract cloud information as a registry
autoP
tr
<
objectRegistry
>
std
::
unique_p
tr
<
objectRegistry
>
getCloud
(
const
adiosFoam
::
cloudInfo
&
cldInfo
);
...
...
src/adiosFoam/read/adiosReaderCloud.C
View file @
f635fe33
...
...
@@ -37,7 +37,7 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam
::
autoP
tr
<
Foam
::
objectRegistry
>
std
::
unique_p
tr
<
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
=
autoP
tr
<
objectRegistry
>
::
New
std
::
unique_p
tr
<
objectRegistry
>
obrPtr
(
IO
object
new
object
Registry
(
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
));
...
...
@@ -107,7 +109,7 @@ Foam::adiosFoam::adiosReader::getCloud
}
Foam
::
autoP
tr
<
Foam
::
objectRegistry
>
std
::
unique_p
tr
<
Foam
::
objectRegistry
>
Foam
::
adiosFoam
::
adiosReader
::
getCloud
(
const
adiosFoam
::
cloudInfo
&
cldInfo
...
...
src/adiosFoam/write/adiosCoreWrite.C
View file @
f635fe33
...
...
@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-20
19
OpenCFD Ltd.
Copyright (C) 2016-20
20
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
();
...
...
src/adiosFoam/write/adiosCoreWrite.H
View file @
f635fe33
...
...
@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-20
19
OpenCFD Ltd.
Copyright (C) 2016-20
20
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")
autoP
tr
<
adios2
::
IO
>
writeIOPtr_
;
std
::
unique_p
tr
<
adios2
::
IO
>
writeIOPtr_
;
//- ADIOS file write - mirror of ...
autoP
tr
<
adios2
::
Engine
>
writeFilePtr_
;
std
::
unique_p
tr
<
adios2
::
Engine
>
writeFilePtr_
;
private:
...
...
src/adiosFoam/write/adiosCoreWriteTemplates.C
View file @
f635fe33
...
...
@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-20
19
OpenCFD Ltd.
Copyright (C) 2016-20
20
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", ...);
...
...
src/adiosWrite/adiosReadData.C
View file @
f635fe33
...
...
@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-20
19
OpenCFD Ltd.
Copyright (C) 2016-20
20
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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment