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
71
Issues
71
List
Boards
Labels
Service Desk
Milestones
Merge Requests
5
Merge Requests
5
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
OPAL
src
Commits
d5032367
Commit
d5032367
authored
Dec 23, 2014
by
gsell
Browse files
Options
Browse Files
Download
Plain Diff
bugfixes in LossDataSink
parents
88c13382
6baf1626
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
28 deletions
+35
-28
classic/5.0/src/Structure/LossDataSink.cpp
classic/5.0/src/Structure/LossDataSink.cpp
+33
-24
classic/5.0/src/Structure/LossDataSink.h
classic/5.0/src/Structure/LossDataSink.h
+2
-4
No files found.
classic/5.0/src/Structure/LossDataSink.cpp
View file @
d5032367
...
...
@@ -91,16 +91,15 @@ void LossDataSink::writeHeaderH5() {
ERRORMSG
(
"H5 rc= "
<<
rc
<<
" in "
<<
__FILE__
<<
" @ line "
<<
__LINE__
<<
endl
);
/// in case of circular machines
if
(
time_m
.
size
()
!=
0
)
{
rc
=
H5WriteFileAttribString
(
H5file_m
,
"turnUnit"
,
"1"
);
if
(
rc
!=
H5_SUCCESS
)
ERRORMSG
(
"H5 rc= "
<<
rc
<<
" in "
<<
__FILE__
<<
" @ line "
<<
__LINE__
<<
endl
);
rc
=
H5WriteFileAttribString
(
H5file_m
,
"timeUnit"
,
"s"
);
if
(
rc
!=
H5_SUCCESS
)
ERRORMSG
(
"H5 rc= "
<<
rc
<<
" in "
<<
__FILE__
<<
" @ line "
<<
__LINE__
<<
endl
);
if
(
hasTimeAttribute
()
)
{
rc
=
H5WriteFileAttribString
(
H5file_m
,
"turnUnit"
,
"1"
);
if
(
rc
!=
H5_SUCCESS
)
ERRORMSG
(
"H5 rc= "
<<
rc
<<
" in "
<<
__FILE__
<<
" @ line "
<<
__LINE__
<<
endl
);
rc
=
H5WriteFileAttribString
(
H5file_m
,
"timeUnit"
,
"s"
);
if
(
rc
!=
H5_SUCCESS
)
ERRORMSG
(
"H5 rc= "
<<
rc
<<
" in "
<<
__FILE__
<<
" @ line "
<<
__LINE__
<<
endl
);
}
rc
=
H5WriteFileAttribString
(
H5file_m
,
"SPOSUnit"
,
"mm"
);
if
(
rc
!=
H5_SUCCESS
)
ERRORMSG
(
"H5 rc= "
<<
rc
<<
" in "
<<
__FILE__
<<
" @ line "
<<
__LINE__
<<
endl
);
...
...
@@ -154,7 +153,6 @@ void LossDataSink::save() {
saveH5
();
H5CloseFile
(
H5file_m
);
Ippl
::
Comm
->
barrier
();
}
else
{
...
...
@@ -197,13 +195,24 @@ bool LossDataSink::hasNoParticlesToDump() {
return
nLoc
==
0
;
}
bool
LossDataSink
::
hasTimeAttribute
()
{
size_t
tLoc
=
time_m
.
size
();
reduce
(
tLoc
,
tLoc
,
OpAddAssign
());
return
tLoc
!=
0
;
}
void
LossDataSink
::
saveH5
()
{
h5_int64_t
rc
;
size_t
nLoc
=
x_m
.
size
();
INFOMSG
(
"saveH5 n = "
<<
nLoc
<<
endl
);
std
::
unique_ptr
<
char
[]
>
varray
(
new
char
[(
nLoc
)
*
sizeof
(
double
)]);
double
*
farray
=
reinterpret_cast
<
double
*>
(
varray
.
get
());
h5_int64_t
*
larray
=
reinterpret_cast
<
h5_int64_t
*>
(
varray
.
get
());
...
...
@@ -270,18 +279,18 @@ void LossDataSink::saveH5() {
if
(
rc
!=
H5_SUCCESS
)
ERRORMSG
(
"H5 rc= "
<<
rc
<<
" in "
<<
__FILE__
<<
" @ line "
<<
__LINE__
<<
endl
);
if
(
time_m
.
size
()
!=
0
)
{
for
(
size_t
i
=
0
;
i
<
nLoc
;
i
++
)
farray
[
i
]
=
time_m
[
i
];
rc
=
H5PartWriteDataFloat64
(
H5file_m
,
"time"
,
farray
);
if
(
rc
!=
H5_SUCCESS
)
ERRORMSG
(
"H5 rc= "
<<
rc
<<
" in "
<<
__FILE__
<<
" @ line "
<<
__LINE__
<<
endl
);
for
(
size_t
i
=
0
;
i
<
nLoc
;
i
++
)
larray
[
i
]
=
turn_m
[
i
];
rc
=
H5PartWriteDataInt64
(
H5file_m
,
"turn"
,
larray
);
if
(
rc
!=
H5_SUCCESS
)
ERRORMSG
(
"H5 rc= "
<<
rc
<<
" in "
<<
__FILE__
<<
" @ line "
<<
__LINE__
<<
endl
);
if
(
hasTimeAttribute
()
)
{
for
(
size_t
i
=
0
;
i
<
nLoc
;
i
++
)
farray
[
i
]
=
time_m
[
i
];
rc
=
H5PartWriteDataFloat64
(
H5file_m
,
"time"
,
farray
);
if
(
rc
!=
H5_SUCCESS
)
ERRORMSG
(
"H5 rc= "
<<
rc
<<
" in "
<<
__FILE__
<<
" @ line "
<<
__LINE__
<<
endl
);
for
(
size_t
i
=
0
;
i
<
nLoc
;
i
++
)
larray
[
i
]
=
turn_m
[
i
];
rc
=
H5PartWriteDataInt64
(
H5file_m
,
"turn"
,
larray
);
if
(
rc
!=
H5_SUCCESS
)
ERRORMSG
(
"H5 rc= "
<<
rc
<<
" in "
<<
__FILE__
<<
" @ line "
<<
__LINE__
<<
endl
);
}
H5call_m
++
;
}
...
...
classic/5.0/src/Structure/LossDataSink.h
View file @
d5032367
...
...
@@ -63,12 +63,10 @@ private:
}
}
//bool hasNoParticlesToDump() {
//return x_m.size() == 0;
//}
bool
hasNoParticlesToDump
();
bool
hasTimeAttribute
();
void
writeHeaderH5
();
void
openH5
();
...
...
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