Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
Cubism
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mavt-cse
Cubism
Commits
eb0a62dc
Commit
eb0a62dc
authored
Sep 20, 2019
by
fabianw
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'renamedSlices'
parents
ad2e5ac9
2afe02bf
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
82 additions
and
100 deletions
+82
-100
include/Cubism/ArgumentParser.h
include/Cubism/ArgumentParser.h
+6
-0
include/Cubism/BlockLab.h
include/Cubism/BlockLab.h
+1
-1
include/Cubism/DependencyCubeMPI.h
include/Cubism/DependencyCubeMPI.h
+1
-0
include/Cubism/GridMPI.h
include/Cubism/GridMPI.h
+1
-1
include/Cubism/HDF5Dumper.h
include/Cubism/HDF5Dumper.h
+11
-15
include/Cubism/HDF5Dumper_MPI.h
include/Cubism/HDF5Dumper_MPI.h
+13
-18
include/Cubism/HDF5SliceDumper.h
include/Cubism/HDF5SliceDumper.h
+10
-14
include/Cubism/HDF5SliceDumperMPI.h
include/Cubism/HDF5SliceDumperMPI.h
+15
-18
include/Cubism/HDF5SubdomainDumper.h
include/Cubism/HDF5SubdomainDumper.h
+11
-15
include/Cubism/HDF5SubdomainDumperMPI.h
include/Cubism/HDF5SubdomainDumperMPI.h
+13
-18
No files found.
include/Cubism/ArgumentParser.h
View file @
eb0a62dc
...
...
@@ -133,6 +133,12 @@ public:
delete
it
->
second
;
}
ArgumentParser
(
const
ArgumentParser
&
c
)
=
delete
;
ArgumentParser
(
ArgumentParser
&&
c
)
=
default
;
ArgumentParser
&
operator
=
(
const
ArgumentParser
&
c
)
=
delete
;
ArgumentParser
&
operator
=
(
ArgumentParser
&&
c
)
=
default
;
void
readFile
(
const
std
::
string
&
filepath
);
Value
&
operator
()(
std
::
string
key
);
...
...
include/Cubism/BlockLab.h
View file @
eb0a62dc
...
...
@@ -89,7 +89,7 @@ public:
virtual
bool
is_yperiodic
()
{
return
true
;
}
virtual
bool
is_zperiodic
()
{
return
true
;
}
~
BlockLab
()
virtual
~
BlockLab
()
{
_release
(
m_cacheBlock
);
}
...
...
include/Cubism/DependencyCubeMPI.h
View file @
eb0a62dc
...
...
@@ -59,6 +59,7 @@ public:
struct
Object
{
virtual
Region
getRegion
(
const
int
_n
[
3
])
{
return
Region
();
}
virtual
~
Object
()
{}
};
struct
Face
:
Object
...
...
include/Cubism/GridMPI.h
View file @
eb0a62dc
...
...
@@ -218,7 +218,7 @@ public:
}
~
GridMPI
()
~
GridMPI
()
override
{
for
(
auto
it
=
SynchronizerMPIs
.
begin
();
it
!=
SynchronizerMPIs
.
end
();
++
it
)
delete
it
->
second
;
...
...
include/Cubism/HDF5Dumper.h
View file @
eb0a62dc
...
...
@@ -44,21 +44,17 @@ inline void _warn_no_hdf5(void) {
// TStreamer::getAttributeName : Attribute name of the date ("Scalar", "Vector", "Tensor")
template
<
typename
TStreamer
,
typename
hdf5Real
,
typename
TGrid
>
void
DumpHDF5
(
const
TGrid
&
grid
,
const
int
iCounter
,
const
typename
TGrid
::
Real
absTime
,
const
std
::
string
&
f
name
,
const
std
::
string
&
d
path
=
"."
,
const
std
::
string
&
f
ileroot
,
// Filename without folder or extension.
const
std
::
string
&
d
irname
=
"."
,
const
bool
bXMF
=
true
)
{
#ifdef CUBISM_USE_HDF
typedef
typename
TGrid
::
BlockType
B
;
// fname is the base filepath tail without file type extension and
// additional identifiers
std
::
ostringstream
filename
;
std
::
ostringstream
fullpath
;
filename
<<
fname
;
fullpath
<<
dpath
<<
"/"
<<
filename
.
str
();
std
::
string
filename_h5
=
fileroot
+
".h5"
;
std
::
string
fullpath_h5
=
dirname
+
"/"
+
filename_h5
;
std
::
string
fullpath_xmf
=
dirname
+
"/"
+
fileroot
+
".xmf"
;
std
::
vector
<
BlockInfo
>
vInfo_local
=
grid
.
getBlocksInfo
();
...
...
@@ -69,7 +65,7 @@ void DumpHDF5(const TGrid &grid,
// startup file
H5open
();
fapl_id
=
H5Pcreate
(
H5P_FILE_ACCESS
);
file_id
=
H5Fcreate
(
(
fullpath
.
str
()
+
".h5"
)
.
c_str
(),
H5F_ACC_TRUNC
,
H5P_DEFAULT
,
fapl_id
);
file_id
=
H5Fcreate
(
fullpath_h5
.
c_str
(),
H5F_ACC_TRUNC
,
H5P_DEFAULT
,
fapl_id
);
status
=
H5Pclose
(
fapl_id
);
if
(
status
<
0
)
H5Eprint1
(
stdout
);
///////////////////////////////////////////////////////////////////////////
...
...
@@ -172,7 +168,7 @@ void DumpHDF5(const TGrid &grid,
if
(
bXMF
)
{
FILE
*
xmf
=
0
;
xmf
=
fopen
(
(
fullpath
.
str
()
+
".xmf"
)
.
c_str
(),
"w"
);
xmf
=
fopen
(
fullpath_xmf
.
c_str
(),
"w"
);
fprintf
(
xmf
,
"<?xml version=
\"
1.0
\"
?>
\n
"
);
fprintf
(
xmf
,
"<!DOCTYPE Xdmf SYSTEM
\"
Xdmf.dtd
\"
[]>
\n
"
);
fprintf
(
xmf
,
"<Xdmf Version=
\"
2.0
\"
>
\n
"
);
...
...
@@ -182,18 +178,18 @@ void DumpHDF5(const TGrid &grid,
fprintf
(
xmf
,
" <Topology TopologyType=
\"
3DRectMesh
\"
Dimensions=
\"
%d %d %d
\"
/>
\n\n
"
,
mesh_dims
[
2
],
mesh_dims
[
1
],
mesh_dims
[
0
]);
fprintf
(
xmf
,
" <Geometry GeometryType=
\"
VxVyVz
\"
>
\n
"
);
fprintf
(
xmf
,
" <DataItem Name=
\"
mesh_vx
\"
Dimensions=
\"
%d
\"
NumberType=
\"
Float
\"
Precision=
\"
8
\"
Format=
\"
HDF
\"
>
\n
"
,
mesh_dims
[
0
]);
fprintf
(
xmf
,
" %s:/vx
\n
"
,
(
filename
.
str
()
+
".h5"
)
.
c_str
());
fprintf
(
xmf
,
" %s:/vx
\n
"
,
filename_h5
.
c_str
());
fprintf
(
xmf
,
" </DataItem>
\n
"
);
fprintf
(
xmf
,
" <DataItem Name=
\"
mesh_vy
\"
Dimensions=
\"
%d
\"
NumberType=
\"
Float
\"
Precision=
\"
8
\"
Format=
\"
HDF
\"
>
\n
"
,
mesh_dims
[
1
]);
fprintf
(
xmf
,
" %s:/vy
\n
"
,
(
filename
.
str
()
+
".h5"
)
.
c_str
());
fprintf
(
xmf
,
" %s:/vy
\n
"
,
filename_h5
.
c_str
());
fprintf
(
xmf
,
" </DataItem>
\n
"
);
fprintf
(
xmf
,
" <DataItem Name=
\"
mesh_vz
\"
Dimensions=
\"
%d
\"
NumberType=
\"
Float
\"
Precision=
\"
8
\"
Format=
\"
HDF
\"
>
\n
"
,
mesh_dims
[
2
]);
fprintf
(
xmf
,
" %s:/vz
\n
"
,
(
filename
.
str
()
+
".h5"
)
.
c_str
());
fprintf
(
xmf
,
" %s:/vz
\n
"
,
filename_h5
.
c_str
());
fprintf
(
xmf
,
" </DataItem>
\n
"
);
fprintf
(
xmf
,
" </Geometry>
\n\n
"
);
fprintf
(
xmf
,
" <Attribute Name=
\"
data
\"
AttributeType=
\"
%s
\"
Center=
\"
Cell
\"
>
\n
"
,
TStreamer
::
getAttributeName
());
fprintf
(
xmf
,
" <DataItem Dimensions=
\"
%d %d %d %d
\"
NumberType=
\"
Float
\"
Precision=
\"
%d
\"
Format=
\"
HDF
\"
>
\n
"
,
(
int
)
dims
[
0
],
(
int
)
dims
[
1
],
(
int
)
dims
[
2
],
(
int
)
dims
[
3
],
(
int
)
sizeof
(
hdf5Real
));
fprintf
(
xmf
,
" %s:/data
\n
"
,
(
filename
.
str
()
+
".h5"
)
.
c_str
());
fprintf
(
xmf
,
" %s:/data
\n
"
,
filename_h5
.
c_str
());
fprintf
(
xmf
,
" </DataItem>
\n
"
);
fprintf
(
xmf
,
" </Attribute>
\n
"
);
fprintf
(
xmf
,
" </Grid>
\n
"
);
...
...
include/Cubism/HDF5Dumper_MPI.h
View file @
eb0a62dc
...
...
@@ -28,24 +28,19 @@ CUBISM_NAMESPACE_BEGIN
// TStreamer::getAttributeName : Attribute name of the date ("Scalar", "Vector", "Tensor")
template
<
typename
TStreamer
,
typename
hdf5Real
,
typename
TGrid
>
void
DumpHDF5_MPI
(
const
TGrid
&
grid
,
const
int
iCounter
,
const
typename
TGrid
::
Real
absTime
,
const
std
::
string
&
f
name
,
const
std
::
string
&
d
path
=
"."
,
const
std
::
string
&
f
ileroot
,
// Filename without folder or extension.
const
std
::
string
&
d
irname
=
"."
,
const
bool
bXMF
=
true
)
{
#ifdef CUBISM_USE_HDF
typedef
typename
TGrid
::
BlockType
B
;
int
rank
;
// fname is the base filepath tail without file type extension and
// additional identifiers
std
::
ostringstream
filename
;
std
::
ostringstream
fullpath
;
filename
<<
fname
;
fullpath
<<
dpath
<<
"/"
<<
filename
.
str
();
std
::
string
filename_h5
=
fileroot
+
".h5"
;
std
::
string
fullpath_h5
=
dirname
+
"/"
+
filename_h5
;
std
::
string
fullpath_xmf
=
dirname
+
"/"
+
fileroot
+
".xmf"
;
int
rank
;
MPI_Comm
comm
=
grid
.
getCartComm
();
MPI_Comm_rank
(
comm
,
&
rank
);
...
...
@@ -67,7 +62,7 @@ void DumpHDF5_MPI(const TGrid &grid,
{
H5open
();
fapl_id
=
H5Pcreate
(
H5P_FILE_ACCESS
);
file_id
=
H5Fcreate
(
(
fullpath
.
str
()
+
".h5"
)
.
c_str
(),
H5F_ACC_TRUNC
,
H5P_DEFAULT
,
fapl_id
);
file_id
=
H5Fcreate
(
fullpath_h5
.
c_str
(),
H5F_ACC_TRUNC
,
H5P_DEFAULT
,
fapl_id
);
status
=
H5Pclose
(
fapl_id
);
for
(
size_t
i
=
0
;
i
<
3
;
++
i
)
...
...
@@ -102,7 +97,7 @@ void DumpHDF5_MPI(const TGrid &grid,
H5open
();
fapl_id
=
H5Pcreate
(
H5P_FILE_ACCESS
);
status
=
H5Pset_fapl_mpio
(
fapl_id
,
comm
,
MPI_INFO_NULL
);
if
(
status
<
0
)
H5Eprint1
(
stdout
);
file_id
=
H5Fopen
(
(
fullpath
.
str
()
+
".h5"
)
.
c_str
(),
H5F_ACC_RDWR
,
fapl_id
);
file_id
=
H5Fopen
(
fullpath_h5
.
c_str
(),
H5F_ACC_RDWR
,
fapl_id
);
status
=
H5Pclose
(
fapl_id
);
if
(
status
<
0
)
H5Eprint1
(
stdout
);
///////////////////////////////////////////////////////////////////////////
...
...
@@ -203,7 +198,7 @@ void DumpHDF5_MPI(const TGrid &grid,
if
(
bXMF
&&
rank
==
0
)
{
FILE
*
xmf
=
0
;
xmf
=
fopen
(
(
fullpath
.
str
()
+
".xmf"
)
.
c_str
(),
"w"
);
xmf
=
fopen
(
fullpath_xmf
.
c_str
(),
"w"
);
fprintf
(
xmf
,
"<?xml version=
\"
1.0
\"
?>
\n
"
);
fprintf
(
xmf
,
"<!DOCTYPE Xdmf SYSTEM
\"
Xdmf.dtd
\"
[]>
\n
"
);
fprintf
(
xmf
,
"<Xdmf Version=
\"
2.0
\"
>
\n
"
);
...
...
@@ -213,18 +208,18 @@ void DumpHDF5_MPI(const TGrid &grid,
fprintf
(
xmf
,
" <Topology TopologyType=
\"
3DRectMesh
\"
Dimensions=
\"
%d %d %d
\"
/>
\n\n
"
,
mesh_dims
[
2
],
mesh_dims
[
1
],
mesh_dims
[
0
]);
fprintf
(
xmf
,
" <Geometry GeometryType=
\"
VxVyVz
\"
>
\n
"
);
fprintf
(
xmf
,
" <DataItem Name=
\"
mesh_vx
\"
Dimensions=
\"
%d
\"
NumberType=
\"
Float
\"
Precision=
\"
8
\"
Format=
\"
HDF
\"
>
\n
"
,
mesh_dims
[
0
]);
fprintf
(
xmf
,
" %s:/vx
\n
"
,
(
filename
.
str
()
+
".h5"
)
.
c_str
());
fprintf
(
xmf
,
" %s:/vx
\n
"
,
filename_h5
.
c_str
());
fprintf
(
xmf
,
" </DataItem>
\n
"
);
fprintf
(
xmf
,
" <DataItem Name=
\"
mesh_vy
\"
Dimensions=
\"
%d
\"
NumberType=
\"
Float
\"
Precision=
\"
8
\"
Format=
\"
HDF
\"
>
\n
"
,
mesh_dims
[
1
]);
fprintf
(
xmf
,
" %s:/vy
\n
"
,
(
filename
.
str
()
+
".h5"
)
.
c_str
());
fprintf
(
xmf
,
" %s:/vy
\n
"
,
filename_h5
.
c_str
());
fprintf
(
xmf
,
" </DataItem>
\n
"
);
fprintf
(
xmf
,
" <DataItem Name=
\"
mesh_vz
\"
Dimensions=
\"
%d
\"
NumberType=
\"
Float
\"
Precision=
\"
8
\"
Format=
\"
HDF
\"
>
\n
"
,
mesh_dims
[
2
]);
fprintf
(
xmf
,
" %s:/vz
\n
"
,
(
filename
.
str
()
+
".h5"
)
.
c_str
());
fprintf
(
xmf
,
" %s:/vz
\n
"
,
filename_h5
.
c_str
());
fprintf
(
xmf
,
" </DataItem>
\n
"
);
fprintf
(
xmf
,
" </Geometry>
\n\n
"
);
fprintf
(
xmf
,
" <Attribute Name=
\"
data
\"
AttributeType=
\"
%s
\"
Center=
\"
Cell
\"
>
\n
"
,
TStreamer
::
getAttributeName
());
fprintf
(
xmf
,
" <DataItem Dimensions=
\"
%d %d %d %d
\"
NumberType=
\"
Float
\"
Precision=
\"
%d
\"
Format=
\"
HDF
\"
>
\n
"
,(
int
)
dims
[
0
],
(
int
)
dims
[
1
],
(
int
)
dims
[
2
],
(
int
)
dims
[
3
],
(
int
)
sizeof
(
hdf5Real
));
fprintf
(
xmf
,
" %s:/data
\n
"
,
(
filename
.
str
()
+
".h5"
)
.
c_str
());
fprintf
(
xmf
,
" %s:/data
\n
"
,
filename_h5
.
c_str
());
fprintf
(
xmf
,
" </DataItem>
\n
"
);
fprintf
(
xmf
,
" </Attribute>
\n
"
);
fprintf
(
xmf
,
" </Grid>
\n
"
);
...
...
include/Cubism/HDF5SliceDumper.h
View file @
eb0a62dc
...
...
@@ -306,10 +306,9 @@ namespace SliceTypes
// TStreamer::getAttributeName : Attribute name of the date ("Scalar", "Vector", "Tensor")
template
<
typename
TStreamer
,
typename
hdf5Real
,
typename
TSlice
>
void
DumpSliceHDF5
(
const
TSlice
&
slice
,
const
int
stepID
,
const
typename
TSlice
::
GridType
::
Real
t
,
const
std
::
string
&
f
name
,
const
std
::
string
&
d
path
=
"."
,
const
std
::
string
&
f
ileroot
,
// Filename without folder or extension.
const
std
::
string
&
d
irname
=
"."
,
const
bool
bXMF
=
true
)
{
#ifdef CUBISM_USE_HDF
...
...
@@ -326,16 +325,13 @@ void DumpSliceHDF5(const TSlice& slice,
///////////////////////////////////////////////////////////////////////////
// startup file
// fname is the base filepath tail without file type extension and
// additional identifiers
std
::
ostringstream
filename
;
std
::
ostringstream
fullpath
;
filename
<<
fname
<<
"_slice"
<<
slice
.
id
();
fullpath
<<
dpath
<<
"/"
<<
filename
.
str
();
std
::
string
filename_h5
=
fileroot
+
".h5"
;
std
::
string
fullpath_h5
=
dirname
+
"/"
+
filename_h5
;
std
::
string
fullpath_xmf
=
dirname
+
"/"
+
fileroot
+
".xmf"
;
H5open
();
fapl_id
=
H5Pcreate
(
H5P_FILE_ACCESS
);
file_id
=
H5Fcreate
(
(
fullpath
.
str
()
+
".h5"
)
.
c_str
(),
H5F_ACC_TRUNC
,
H5P_DEFAULT
,
fapl_id
);
file_id
=
H5Fcreate
(
fullpath_h5
.
c_str
(),
H5F_ACC_TRUNC
,
H5P_DEFAULT
,
fapl_id
);
status
=
H5Pclose
(
fapl_id
);
if
(
status
<
0
)
H5Eprint1
(
stdout
);
///////////////////////////////////////////////////////////////////////////
...
...
@@ -419,7 +415,7 @@ void DumpSliceHDF5(const TSlice& slice,
if
(
bXMF
)
{
FILE
*
xmf
=
0
;
xmf
=
fopen
(
(
fullpath
.
str
()
+
".xmf"
)
.
c_str
(),
"w"
);
xmf
=
fopen
(
fullpath_xmf
.
c_str
(),
"w"
);
fprintf
(
xmf
,
"<?xml version=
\"
1.0
\"
?>
\n
"
);
fprintf
(
xmf
,
"<!DOCTYPE Xdmf SYSTEM
\"
Xdmf.dtd
\"
[]>
\n
"
);
fprintf
(
xmf
,
"<Xdmf Version=
\"
2.0
\"
>
\n
"
);
...
...
@@ -432,15 +428,15 @@ void DumpSliceHDF5(const TSlice& slice,
fprintf
(
xmf
,
" %e
\n
"
,
0.0
);
fprintf
(
xmf
,
" </DataItem>
\n
"
);
fprintf
(
xmf
,
" <DataItem Name=
\"
mesh_vy
\"
Dimensions=
\"
%d
\"
NumberType=
\"
Float
\"
Precision=
\"
8
\"
Format=
\"
HDF
\"
>
\n
"
,
mesh_dims
[
0
]);
fprintf
(
xmf
,
" %s:/vwidth
\n
"
,
(
filename
.
str
()
+
".h5"
)
.
c_str
());
fprintf
(
xmf
,
" %s:/vwidth
\n
"
,
filename_h5
.
c_str
());
fprintf
(
xmf
,
" </DataItem>
\n
"
);
fprintf
(
xmf
,
" <DataItem Name=
\"
mesh_vz
\"
Dimensions=
\"
%d
\"
NumberType=
\"
Float
\"
Precision=
\"
8
\"
Format=
\"
HDF
\"
>
\n
"
,
mesh_dims
[
1
]);
fprintf
(
xmf
,
" %s:/vheight
\n
"
,
(
filename
.
str
()
+
".h5"
)
.
c_str
());
fprintf
(
xmf
,
" %s:/vheight
\n
"
,
filename_h5
.
c_str
());
fprintf
(
xmf
,
" </DataItem>
\n
"
);
fprintf
(
xmf
,
" </Geometry>
\n\n
"
);
fprintf
(
xmf
,
" <Attribute Name=
\"
data
\"
AttributeType=
\"
%s
\"
Center=
\"
Cell
\"
>
\n
"
,
TStreamer
::
getAttributeName
());
fprintf
(
xmf
,
" <DataItem Dimensions=
\"
%d %d %d
\"
NumberType=
\"
Float
\"
Precision=
\"
%d
\"
Format=
\"
HDF
\"
>
\n
"
,
(
int
)
height
,
(
int
)
width
,
(
int
)
NCHANNELS
,
(
int
)
sizeof
(
hdf5Real
));
fprintf
(
xmf
,
" %s:/data
\n
"
,
(
filename
.
str
()
+
".h5"
)
.
c_str
());
fprintf
(
xmf
,
" %s:/data
\n
"
,
filename_h5
.
c_str
());
fprintf
(
xmf
,
" </DataItem>
\n
"
);
fprintf
(
xmf
,
" </Attribute>
\n
"
);
fprintf
(
xmf
,
" </Grid>
\n
"
);
...
...
include/Cubism/HDF5SliceDumperMPI.h
View file @
eb0a62dc
...
...
@@ -106,22 +106,19 @@ namespace SliceTypesMPI
// TStreamer::operate : Data access methods for read and write
// TStreamer::getAttributeName : Attribute name of the date ("Scalar", "Vector", "Tensor")
template
<
typename
TStreamer
,
typename
hdf5Real
,
typename
TSlice
>
void
DumpSliceHDF5MPI
(
const
TSlice
&
slice
,
const
int
stepID
,
const
typename
TSlice
::
GridType
::
Real
t
,
const
std
::
string
&
fname
,
const
std
::
string
&
dpath
=
"."
,
const
bool
bXMF
=
true
)
void
DumpSliceHDF5MPI
(
const
TSlice
&
slice
,
const
typename
TSlice
::
GridType
::
Real
t
,
const
std
::
string
&
fileroot
,
// Filename without folder or extension.
const
std
::
string
&
dirname
=
"."
,
const
bool
bXMF
=
true
)
{
#ifdef CUBISM_USE_HDF
typedef
typename
TSlice
::
GridType
::
BlockType
B
;
// fname is the base filepath tail without file type extension and
// additional identifiers
std
::
ostringstream
filename
;
std
::
ostringstream
fullpath
;
filename
<<
fname
<<
"_slice"
<<
slice
.
id
();
fullpath
<<
dpath
<<
"/"
<<
filename
.
str
();
std
::
string
filename_h5
=
fileroot
+
".h5"
;
std
::
string
fullpath_h5
=
dirname
+
"/"
+
filename_h5
;
std
::
string
fullpath_xmf
=
dirname
+
"/"
+
fileroot
+
".xmf"
;
static
const
unsigned
int
NCHANNELS
=
TStreamer
::
NCHANNELS
;
const
unsigned
int
width
=
slice
.
localWidth
();
...
...
@@ -144,7 +141,7 @@ void DumpSliceHDF5MPI(const TSlice& slice,
{
H5open
();
fapl_id
=
H5Pcreate
(
H5P_FILE_ACCESS
);
file_id
=
H5Fcreate
(
(
fullpath
.
str
()
+
".h5"
)
.
c_str
(),
H5F_ACC_TRUNC
,
H5P_DEFAULT
,
fapl_id
);
file_id
=
H5Fcreate
(
fullpath_h5
.
c_str
(),
H5F_ACC_TRUNC
,
H5P_DEFAULT
,
fapl_id
);
status
=
H5Pclose
(
fapl_id
);
for
(
size_t
i
=
0
;
i
<
2
;
++
i
)
...
...
@@ -179,7 +176,7 @@ void DumpSliceHDF5MPI(const TSlice& slice,
H5open
();
fapl_id
=
H5Pcreate
(
H5P_FILE_ACCESS
);
status
=
H5Pset_fapl_mpio
(
fapl_id
,
comm
,
MPI_INFO_NULL
);
if
(
status
<
0
)
H5Eprint1
(
stdout
);
file_id
=
H5Fopen
(
(
fullpath
.
str
()
+
".h5"
)
.
c_str
(),
H5F_ACC_RDWR
,
fapl_id
);
file_id
=
H5Fopen
(
fullpath_h5
.
c_str
(),
H5F_ACC_RDWR
,
fapl_id
);
status
=
H5Pclose
(
fapl_id
);
if
(
status
<
0
)
H5Eprint1
(
stdout
);
///////////////////////////////////////////////////////////////////////////
...
...
@@ -250,7 +247,7 @@ void DumpSliceHDF5MPI(const TSlice& slice,
if
(
bXMF
&&
0
==
myRank
)
{
FILE
*
xmf
=
0
;
xmf
=
fopen
(
(
fullpath
.
str
()
+
".xmf"
)
.
c_str
(),
"w"
);
xmf
=
fopen
(
fullpath_xmf
.
c_str
(),
"w"
);
fprintf
(
xmf
,
"<?xml version=
\"
1.0
\"
?>
\n
"
);
fprintf
(
xmf
,
"<!DOCTYPE Xdmf SYSTEM
\"
Xdmf.dtd
\"
[]>
\n
"
);
fprintf
(
xmf
,
"<Xdmf Version=
\"
2.0
\"
>
\n
"
);
...
...
@@ -263,15 +260,15 @@ void DumpSliceHDF5MPI(const TSlice& slice,
fprintf
(
xmf
,
" %e
\n
"
,
0.0
);
fprintf
(
xmf
,
" </DataItem>
\n
"
);
fprintf
(
xmf
,
" <DataItem Name=
\"
mesh_vy
\"
Dimensions=
\"
%d
\"
NumberType=
\"
Float
\"
Precision=
\"
8
\"
Format=
\"
HDF
\"
>
\n
"
,
mesh_dims
[
0
]);
fprintf
(
xmf
,
" %s:/vwidth
\n
"
,
(
filename
.
str
()
+
".h5"
)
.
c_str
());
fprintf
(
xmf
,
" %s:/vwidth
\n
"
,
filename_h5
.
c_str
());
fprintf
(
xmf
,
" </DataItem>
\n
"
);
fprintf
(
xmf
,
" <DataItem Name=
\"
mesh_vz
\"
Dimensions=
\"
%d
\"
NumberType=
\"
Float
\"
Precision=
\"
8
\"
Format=
\"
HDF
\"
>
\n
"
,
mesh_dims
[
1
]);
fprintf
(
xmf
,
" %s:/vheight
\n
"
,
(
filename
.
str
()
+
".h5"
)
.
c_str
());
fprintf
(
xmf
,
" %s:/vheight
\n
"
,
filename_h5
.
c_str
());
fprintf
(
xmf
,
" </DataItem>
\n
"
);
fprintf
(
xmf
,
" </Geometry>
\n\n
"
);
fprintf
(
xmf
,
" <Attribute Name=
\"
data
\"
AttributeType=
\"
%s
\"
Center=
\"
Cell
\"
>
\n
"
,
TStreamer
::
getAttributeName
());
fprintf
(
xmf
,
" <DataItem Dimensions=
\"
%d %d %d
\"
NumberType=
\"
Float
\"
Precision=
\"
%d
\"
Format=
\"
HDF
\"
>
\n
"
,
(
int
)
dims
[
0
],
(
int
)
dims
[
1
],
(
int
)
dims
[
2
],
(
int
)
sizeof
(
hdf5Real
));
fprintf
(
xmf
,
" %s:/data
\n
"
,
(
filename
.
str
()
+
".h5"
)
.
c_str
());
fprintf
(
xmf
,
" %s:/data
\n
"
,
filename_h5
.
c_str
());
fprintf
(
xmf
,
" </DataItem>
\n
"
);
fprintf
(
xmf
,
" </Attribute>
\n
"
);
fprintf
(
xmf
,
" </Grid>
\n
"
);
...
...
include/Cubism/HDF5SubdomainDumper.h
View file @
eb0a62dc
...
...
@@ -298,21 +298,17 @@ namespace SubdomainTypes
// TStreamer::getAttributeName : Attribute name of the date ("Scalar", "Vector", "Tensor")
template
<
typename
TStreamer
,
typename
hdf5Real
,
typename
TSubdomain
>
void
DumpSubdomainHDF5
(
const
TSubdomain
&
subdomain
,
const
int
stepID
,
const
typename
TSubdomain
::
GridType
::
Real
t
,
const
std
::
string
&
f
name
,
const
std
::
string
&
d
path
=
"."
,
const
std
::
string
&
f
ileroot
,
// Filename w/o folder or extension.
const
std
::
string
&
d
irname
=
"."
,
const
bool
bXMF
=
true
)
{
#ifdef CUBISM_USE_HDF
typedef
typename
TSubdomain
::
GridType
::
BlockType
B
;
// fname is the base filepath tail without file type extension and
// additional identifiers
std
::
ostringstream
filename
;
std
::
ostringstream
fullpath
;
filename
<<
fname
<<
"_subdomain"
<<
subdomain
.
id
();
fullpath
<<
dpath
<<
"/"
<<
filename
.
str
();
std
::
string
filename_h5
=
fileroot
+
".h5"
;
std
::
string
fullpath_h5
=
dirname
+
"/"
+
filename_h5
;
std
::
string
fullpath_xmf
=
dirname
+
"/"
+
fileroot
+
".xmf"
;
herr_t
status
;
hid_t
file_id
,
dataset_id
,
fspace_id
,
fapl_id
,
mspace_id
;
...
...
@@ -321,7 +317,7 @@ void DumpSubdomainHDF5(const TSubdomain& subdomain,
// startup file
H5open
();
fapl_id
=
H5Pcreate
(
H5P_FILE_ACCESS
);
file_id
=
H5Fcreate
(
(
fullpath
.
str
()
+
".h5"
)
.
c_str
(),
H5F_ACC_TRUNC
,
H5P_DEFAULT
,
fapl_id
);
file_id
=
H5Fcreate
(
fullpath_h5
.
c_str
(),
H5F_ACC_TRUNC
,
H5P_DEFAULT
,
fapl_id
);
status
=
H5Pclose
(
fapl_id
);
if
(
status
<
0
)
H5Eprint1
(
stdout
);
///////////////////////////////////////////////////////////////////////////
...
...
@@ -460,7 +456,7 @@ void DumpSubdomainHDF5(const TSubdomain& subdomain,
if
(
bXMF
)
{
FILE
*
xmf
=
0
;
xmf
=
fopen
(
(
fullpath
.
str
()
+
".xmf"
)
.
c_str
(),
"w"
);
xmf
=
fopen
(
fullpath_xmf
.
c_str
(),
"w"
);
fprintf
(
xmf
,
"<?xml version=
\"
1.0
\"
?>
\n
"
);
fprintf
(
xmf
,
"<!DOCTYPE Xdmf SYSTEM
\"
Xdmf.dtd
\"
[]>
\n
"
);
fprintf
(
xmf
,
"<Xdmf Version=
\"
2.0
\"
>
\n
"
);
...
...
@@ -470,18 +466,18 @@ void DumpSubdomainHDF5(const TSubdomain& subdomain,
fprintf
(
xmf
,
" <Topology TopologyType=
\"
3DRectMesh
\"
Dimensions=
\"
%d %d %d
\"
/>
\n\n
"
,
mesh_dims
[
2
],
mesh_dims
[
1
],
mesh_dims
[
0
]);
fprintf
(
xmf
,
" <Geometry GeometryType=
\"
VxVyVz
\"
>
\n
"
);
fprintf
(
xmf
,
" <DataItem Name=
\"
mesh_vx
\"
Dimensions=
\"
%d
\"
NumberType=
\"
Float
\"
Precision=
\"
8
\"
Format=
\"
HDF
\"
>
\n
"
,
mesh_dims
[
0
]);
fprintf
(
xmf
,
" %s:/vx
\n
"
,
(
filename
.
str
()
+
".h5"
)
.
c_str
());
fprintf
(
xmf
,
" %s:/vx
\n
"
,
filename_h5
.
c_str
());
fprintf
(
xmf
,
" </DataItem>
\n
"
);
fprintf
(
xmf
,
" <DataItem Name=
\"
mesh_vy
\"
Dimensions=
\"
%d
\"
NumberType=
\"
Float
\"
Precision=
\"
8
\"
Format=
\"
HDF
\"
>
\n
"
,
mesh_dims
[
1
]);
fprintf
(
xmf
,
" %s:/vy
\n
"
,
(
filename
.
str
()
+
".h5"
)
.
c_str
());
fprintf
(
xmf
,
" %s:/vy
\n
"
,
filename_h5
.
c_str
());
fprintf
(
xmf
,
" </DataItem>
\n
"
);
fprintf
(
xmf
,
" <DataItem Name=
\"
mesh_vz
\"
Dimensions=
\"
%d
\"
NumberType=
\"
Float
\"
Precision=
\"
8
\"
Format=
\"
HDF
\"
>
\n
"
,
mesh_dims
[
2
]);
fprintf
(
xmf
,
" %s:/vz
\n
"
,
(
filename
.
str
()
+
".h5"
)
.
c_str
());
fprintf
(
xmf
,
" %s:/vz
\n
"
,
filename_h5
.
c_str
());
fprintf
(
xmf
,
" </DataItem>
\n
"
);
fprintf
(
xmf
,
" </Geometry>
\n\n
"
);
fprintf
(
xmf
,
" <Attribute Name=
\"
data
\"
AttributeType=
\"
%s
\"
Center=
\"
Cell
\"
>
\n
"
,
TStreamer
::
getAttributeName
());
fprintf
(
xmf
,
" <DataItem Dimensions=
\"
%d %d %d %d
\"
NumberType=
\"
Float
\"
Precision=
\"
%d
\"
Format=
\"
HDF
\"
>
\n
"
,
(
int
)
dims
[
0
],
(
int
)
dims
[
1
],
(
int
)
dims
[
2
],
(
int
)
dims
[
3
],
(
int
)
sizeof
(
hdf5Real
));
fprintf
(
xmf
,
" %s:/data
\n
"
,
(
filename
.
str
()
+
".h5"
)
.
c_str
());
fprintf
(
xmf
,
" %s:/data
\n
"
,
filename_h5
.
c_str
());
fprintf
(
xmf
,
" </DataItem>
\n
"
);
fprintf
(
xmf
,
" </Attribute>
\n
"
);
fprintf
(
xmf
,
" </Grid>
\n
"
);
...
...
include/Cubism/HDF5SubdomainDumperMPI.h
View file @
eb0a62dc
...
...
@@ -141,24 +141,19 @@ namespace SubdomainTypesMPI
// TStreamer::getAttributeName : Attribute name of the date ("Scalar", "Vector", "Tensor")
template
<
typename
TStreamer
,
typename
hdf5Real
,
typename
TSubdomain
>
void
DumpSubdomainHDF5MPI
(
const
TSubdomain
&
subdomain
,
const
int
stepID
,
const
typename
TSubdomain
::
GridType
::
Real
t
,
const
std
::
string
&
f
name
,
const
std
::
string
&
d
path
=
"."
,
const
std
::
string
&
f
ileroot
,
const
std
::
string
&
d
irname
=
"."
,
const
bool
bXMF
=
true
)
{
#ifdef CUBISM_USE_HDF
typedef
typename
TSubdomain
::
GridType
::
BlockType
B
;
int
rank
;
// fname is the base filepath tail without file type extension and
// additional identifiers
std
::
ostringstream
filename
;
std
::
ostringstream
fullpath
;
filename
<<
fname
<<
"_subdomain"
<<
subdomain
.
id
();
fullpath
<<
dpath
<<
"/"
<<
filename
.
str
();
std
::
string
filename_h5
=
fileroot
+
".h5"
;
std
::
string
fullpath_h5
=
dirname
+
"/"
+
filename_h5
;
std
::
string
fullpath_xmf
=
dirname
+
"/"
+
fileroot
+
".xmf"
;
int
rank
;
MPI_Comm
comm
=
subdomain
.
getGrid
()
->
getCartComm
();
MPI_Comm_rank
(
comm
,
&
rank
);
...
...
@@ -176,7 +171,7 @@ void DumpSubdomainHDF5MPI(const TSubdomain& subdomain,
{
H5open
();
fapl_id
=
H5Pcreate
(
H5P_FILE_ACCESS
);
file_id
=
H5Fcreate
(
(
fullpath
.
str
()
+
".h5"
)
.
c_str
(),
H5F_ACC_TRUNC
,
H5P_DEFAULT
,
fapl_id
);
file_id
=
H5Fcreate
(
fullpath_h5
.
c_str
(),
H5F_ACC_TRUNC
,
H5P_DEFAULT
,
fapl_id
);
status
=
H5Pclose
(
fapl_id
);
for
(
size_t
i
=
0
;
i
<
3
;
++
i
)
...
...
@@ -212,7 +207,7 @@ void DumpSubdomainHDF5MPI(const TSubdomain& subdomain,
H5open
();
fapl_id
=
H5Pcreate
(
H5P_FILE_ACCESS
);
status
=
H5Pset_fapl_mpio
(
fapl_id
,
comm
,
MPI_INFO_NULL
);
if
(
status
<
0
)
H5Eprint1
(
stdout
);
file_id
=
H5Fopen
(
(
fullpath
.
str
()
+
".h5"
)
.
c_str
(),
H5F_ACC_RDWR
,
fapl_id
);
file_id
=
H5Fopen
(
fullpath_h5
.
c_str
(),
H5F_ACC_RDWR
,
fapl_id
);
status
=
H5Pclose
(
fapl_id
);
if
(
status
<
0
)
H5Eprint1
(
stdout
);
///////////////////////////////////////////////////////////////////////////
...
...
@@ -335,7 +330,7 @@ void DumpSubdomainHDF5MPI(const TSubdomain& subdomain,
if
(
bXMF
&&
rank
==
0
)
{
FILE
*
xmf
=
0
;
xmf
=
fopen
(
(
fullpath
.
str
()
+
".xmf"
)
.
c_str
(),
"w"
);
xmf
=
fopen
(
fullpath_xmf
.
c_str
(),
"w"
);
fprintf
(
xmf
,
"<?xml version=
\"
1.0
\"
?>
\n
"
);
fprintf
(
xmf
,
"<!DOCTYPE Xdmf SYSTEM
\"
Xdmf.dtd
\"
[]>
\n
"
);
fprintf
(
xmf
,
"<Xdmf Version=
\"
2.0
\"
>
\n
"
);
...
...
@@ -345,18 +340,18 @@ void DumpSubdomainHDF5MPI(const TSubdomain& subdomain,
fprintf
(
xmf
,
" <Topology TopologyType=
\"
3DRectMesh
\"
Dimensions=
\"
%d %d %d
\"
/>
\n\n
"
,
mesh_dims
[
2
],
mesh_dims
[
1
],
mesh_dims
[
0
]);
fprintf
(
xmf
,
" <Geometry GeometryType=
\"
VxVyVz
\"
>
\n
"
);
fprintf
(
xmf
,
" <DataItem Name=
\"
mesh_vx
\"
Dimensions=
\"
%d
\"
NumberType=
\"
Float
\"
Precision=
\"
8
\"
Format=
\"
HDF
\"
>
\n
"
,
mesh_dims
[
0
]);
fprintf
(
xmf
,
" %s:/vx
\n
"
,
(
filename
.
str
()
+
".h5"
)
.
c_str
());
fprintf
(
xmf
,
" %s:/vx
\n
"
,
filename_h5
.
c_str
());
fprintf
(
xmf
,
" </DataItem>
\n
"
);
fprintf
(
xmf
,
" <DataItem Name=
\"
mesh_vy
\"
Dimensions=
\"
%d
\"
NumberType=
\"
Float
\"
Precision=
\"
8
\"
Format=
\"
HDF
\"
>
\n
"
,
mesh_dims
[
1
]);
fprintf
(
xmf
,
" %s:/vy
\n
"
,
(
filename
.
str
()
+
".h5"
)
.
c_str
());
fprintf
(
xmf
,
" %s:/vy
\n
"
,
filename_h5
.
c_str
());
fprintf
(
xmf
,
" </DataItem>
\n
"
);
fprintf
(
xmf
,
" <DataItem Name=
\"
mesh_vz
\"
Dimensions=
\"
%d
\"
NumberType=
\"
Float
\"
Precision=
\"
8
\"
Format=
\"
HDF
\"
>
\n
"
,
mesh_dims
[
2
]);
fprintf
(
xmf
,
" %s:/vz
\n
"
,
(
filename
.
str
()
+
".h5"
)
.
c_str
());
fprintf
(
xmf
,
" %s:/vz
\n
"
,
filename_h5
.
c_str
());
fprintf
(
xmf
,
" </DataItem>
\n
"
);
fprintf
(
xmf
,
" </Geometry>
\n\n
"
);
fprintf
(
xmf
,
" <Attribute Name=
\"
data
\"
AttributeType=
\"
%s
\"
Center=
\"
Cell
\"
>
\n
"
,
TStreamer
::
getAttributeName
());
fprintf
(
xmf
,
" <DataItem Dimensions=
\"
%d %d %d %d
\"
NumberType=
\"
Float
\"
Precision=
\"
%d
\"
Format=
\"
HDF
\"
>
\n
"
,(
int
)
dims
[
0
],
(
int
)
dims
[
1
],
(
int
)
dims
[
2
],
(
int
)
dims
[
3
],
(
int
)
sizeof
(
hdf5Real
));
fprintf
(
xmf
,
" %s:/data
\n
"
,
(
filename
.
str
()
+
".h5"
)
.
c_str
());
fprintf
(
xmf
,
" %s:/data
\n
"
,
filename_h5
.
c_str
());
fprintf
(
xmf
,
" </DataItem>
\n
"
);
fprintf
(
xmf
,
" </Attribute>
\n
"
);
fprintf
(
xmf
,
" </Grid>
\n
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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