Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
S
src
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Code Review
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
H5hut
src
Commits
90c2a260
Commit
90c2a260
authored
Sep 21, 2006
by
gsell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src/H5BlockTestAttributes.c
- bugfixes
parent
4f423dbd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
69 deletions
+43
-69
test/H5BlockTestAttributes.c
test/H5BlockTestAttributes.c
+43
-69
No files found.
test/H5BlockTestAttributes.c
View file @
90c2a260
...
...
@@ -66,6 +66,40 @@ _write_data (
return
1
;
}
static
h5part_int64_t
_write_attributes
(
H5PartFile
*
f
,
const
int
myproc
)
{
h5part_int64_t
herr
=
H5BlockWriteFieldAttribString
(
f
,
"TestField"
,
"TestString"
,
"42"
);
if
(
herr
<
0
)
return
-
1
;
h5part_int64_t
ival
[
1
]
=
{
42
};
h5part_float64_t
rval
[
1
]
=
{
42
.
0
};
herr
=
H5BlockWriteFieldAttrib
(
f
,
"TestField"
,
"TestInt64"
,
H5PART_INT64
,
ival
,
1
);
if
(
herr
<
0
)
return
-
1
;
herr
=
H5BlockWriteFieldAttrib
(
f
,
"TestField"
,
"TestFloat64"
,
H5PART_FLOAT64
,
rval
,
1
);
if
(
herr
<
0
)
return
-
1
;
return
H5PART_SUCCESS
;
}
static
h5part_int64_t
_write_file
(
const
char
*
fname
,
...
...
@@ -104,74 +138,19 @@ _write_file (
return
2
;
}
herr
=
H5PartCloseFile
(
f
);
if
(
herr
<
0
)
return
-
1
;
return
0
;
}
static
h5part_int64_t
_write_attributes
(
const
char
*
fname
,
const
int
myproc
,
MPI_Comm
comm
)
{
h5part_int64_t
timestep
=
0
;
printf
(
"PROC[%d]: Open file
\"
%s
\"
for writing ...
\n
"
,
myproc
,
fname
);
#ifdef PARALLEL_IO
H5PartFile
*
f
=
H5PartOpenFileParallel
(
fname
,
H5PART_APPEND
,
comm
);
#else
H5PartFile
*
f
=
H5PartOpenFile
(
fname
,
H5PART_APPEND
);
#endif
if
(
f
==
NULL
)
return
-
1
;
if
(
_write_attributes
(
f
,
myproc
)
<
0
)
{
printf
(
"Failed to write attributes
\"
%s
\"\n
"
,
fname
);
return
2
;
}
h5part_int64_t
herr
=
H5PartSetStep
(
f
,
timestep
);
if
(
herr
<
0
)
return
herr
;
herr
=
H5BlockWriteFieldAttribString
(
f
,
"TestField"
,
"TestString"
,
"42"
);
if
(
herr
<
0
)
return
-
1
;
h5part_int64_t
ival
[
1
]
=
{
42
};
h5part_float64_t
rval
[
1
]
=
{
42
.
0
};
herr
=
H5BlockWriteFieldAttrib
(
f
,
"TestField"
,
"TestInt64"
,
H5PART_INT64
,
ival
,
1
);
if
(
herr
<
0
)
return
-
1
;
herr
=
H5BlockWriteFieldAttrib
(
f
,
"TestField"
,
"TestFloat64"
,
H5PART_FLOAT64
,
rval
,
1
);
if
(
herr
<
0
)
return
-
1
;
herr
=
H5PartCloseFile
(
f
);
if
(
herr
<
0
)
return
-
1
;
return
H5PART_SUCCESS
;
return
0
;
}
static
h5part_int64_t
_read_data
(
H5PartFile
*
f
,
...
...
@@ -326,19 +305,19 @@ _read_attributes (
h5part_int64_t
timestep
=
0
;
printf
(
"PROC[%d]: Open file
\"
%s
\"
for
writ
ing ...
\n
"
,
printf
(
"PROC[%d]: Open file
\"
%s
\"
for
read
ing ...
\n
"
,
myproc
,
fname
);
#ifdef PARALLEL_IO
H5PartFile
*
f
=
H5PartOpenFileParallel
(
fname
,
H5PART_
WRITE
,
H5PART_
READ
,
comm
);
#else
H5PartFile
*
f
=
H5PartOpenFile
(
fname
,
H5PART_
WRITE
H5PART_
READ
);
#endif
if
(
f
==
NULL
)
return
-
1
;
...
...
@@ -434,11 +413,6 @@ main (
ex
=
1
;
goto
cleanup
;
}
if
(
_write_attributes
(
fname
,
myproc
,
comm
)
<
0
)
{
printf
(
"Failed to write attributes
\"
%s
\"\n
"
,
fname
);
ex
=
1
;
goto
cleanup
;
}
}
else
if
(
opt_read
)
{
if
(
_read_file
(
fname
,
myproc
,
comm
,
Layout1
)
<
0
)
{
printf
(
"Failed to read file
\"
%s
\"\n
"
,
fname
);
...
...
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