Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
OPAL
src
Commits
b094d1aa
Commit
b094d1aa
authored
Feb 18, 2020
by
kraus
Browse files
check format flags in the header, adjust precision of written values since only 1 and -1
parent
ae6eeff9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
10 deletions
+40
-10
src/Structure/ElementPositionWriter.cpp
src/Structure/ElementPositionWriter.cpp
+9
-9
src/Structure/SDDSColumn.cpp
src/Structure/SDDSColumn.cpp
+31
-1
No files found.
src/Structure/ElementPositionWriter.cpp
View file @
b094d1aa
...
...
@@ -29,43 +29,43 @@ void ElementPositionWriter::fillHeader() {
"1"
,
"dipole field present"
,
std
::
ios_base
::
fixed
,
4
);
0
);
columns_m
.
addColumn
(
"quadrupole"
,
"float"
,
"1"
,
"quadrupole field present"
,
std
::
ios_base
::
fixed
,
4
);
0
);
columns_m
.
addColumn
(
"sextupole"
,
"float"
,
"1"
,
"sextupole field present"
,
std
::
ios_base
::
fixed
,
4
);
0
);
columns_m
.
addColumn
(
"octupole"
,
"float"
,
"1"
,
"octupole field present"
,
std
::
ios_base
::
fixed
,
4
);
0
);
columns_m
.
addColumn
(
"decapole"
,
"float"
,
"1"
,
"decapole field present"
,
std
::
ios_base
::
fixed
,
4
);
0
);
columns_m
.
addColumn
(
"multipole"
,
"float"
,
"1"
,
"higher multipole field present"
,
std
::
ios_base
::
fixed
,
4
);
0
);
columns_m
.
addColumn
(
"solenoid"
,
"float"
,
"1"
,
"solenoid field present"
,
std
::
ios_base
::
fixed
,
4
);
0
);
columns_m
.
addColumn
(
"rfcavity"
,
"float"
,
"1"
,
...
...
@@ -77,13 +77,13 @@ void ElementPositionWriter::fillHeader() {
"1"
,
"monitor present"
,
std
::
ios_base
::
fixed
,
4
);
0
);
columns_m
.
addColumn
(
"other"
,
"float"
,
"1"
,
"other element present"
,
std
::
ios_base
::
fixed
,
4
);
0
);
columns_m
.
addColumn
(
"element_names"
,
"string"
,
""
,
...
...
src/Structure/SDDSColumn.cpp
View file @
b094d1aa
...
...
@@ -2,6 +2,7 @@
#include "Utilities/OpalException.h"
#include <iomanip>
#include <list>
SDDSColumn
::
SDDSColumn
(
const
std
::
string
&
name
,
const
std
::
string
&
type
,
...
...
@@ -14,7 +15,36 @@ SDDSColumn::SDDSColumn(const std::string& name,
writeFlags_m
(
flags
),
writePrecision_m
(
prec
),
set_m
(
false
)
{
}
{
std
::
list
<
std
::
ios_base
::
fmtflags
>
numericalBase
({
std
::
ios_base
::
dec
,
std
::
ios_base
::
hex
,
std
::
ios_base
::
oct
});
std
::
list
<
std
::
ios_base
::
fmtflags
>
floatFormat
({
std
::
ios_base
::
fixed
,
std
::
ios_base
::
scientific
});
std
::
list
<
std
::
ios_base
::
fmtflags
>
adjustmentFlags
({
std
::
ios_base
::
internal
,
std
::
ios_base
::
left
,
std
::
ios_base
::
right
});
for
(
std
::
ios_base
::
fmtflags
flag
:
numericalBase
)
{
if
(
writeFlags_m
&
flag
)
{
writeFlags_m
=
(
flag
|
(
writeFlags_m
&
~
std
::
ios_base
::
basefield
));
break
;
}
}
for
(
std
::
ios_base
::
fmtflags
flag
:
floatFormat
)
{
if
(
writeFlags_m
&
flag
)
{
writeFlags_m
=
(
flag
|
(
writeFlags_m
&
~
std
::
ios_base
::
floatfield
));
break
;
}
}
for
(
std
::
ios_base
::
fmtflags
flag
:
adjustmentFlags
)
{
if
(
writeFlags_m
&
flag
)
{
writeFlags_m
=
(
flag
|
(
writeFlags_m
&
~
std
::
ios_base
::
adjustfield
));
break
;
}
}
}
void
SDDSColumn
::
writeHeader
(
std
::
ostream
&
os
,
...
...
kraus
@kraus
mentioned in commit
07a0788e
·
Feb 18, 2020
mentioned in commit
07a0788e
mentioned in commit 07a0788ed7436385df85cfc94fab142159e6b500
Toggle commit list
kraus
@kraus
mentioned in merge request
!285 (merged)
·
Feb 18, 2020
mentioned in merge request
!285 (merged)
mentioned in merge request !285
Toggle commit list
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