Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Frida
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
Frida
Commits
08e40252
Commit
08e40252
authored
15 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
corr.
leichte Änderung an y08: #tables comment now inline
parent
1e0309de
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pub/src/olm.cpp
+34
-38
34 additions, 38 deletions
pub/src/olm.cpp
pub/src/olm.h
+2
-2
2 additions, 2 deletions
pub/src/olm.h
with
36 additions
and
40 deletions
pub/src/olm.cpp
+
34
−
38
View file @
08e40252
...
...
@@ -24,56 +24,59 @@ int err;
//***************************************************************************//
void
COlo
::
SaveHeader
(
FILE
*
f
d
,
bool
isdata
)
void
COlo
::
SaveHeader
(
FILE
*
f
ile
,
bool
isdata
)
// written for file format y08
{
string
out
;
fprintf
(
f
d
,
"Meta:
\n
"
fprintf
(
f
ile
,
"Meta:
\n
"
" format: frida/y08 for yaml1
\n
"
" type: %s
\n
"
,
isdata
?
"generic tabular data"
:
"frida2 curve"
);
fprintf
(
f
d
,
"History:
\n
"
);
fprintf
(
f
ile
,
"History:
\n
"
);
for
(
uint
i
=
0
;
i
<
lDoc
.
size
();
i
++
)
fprintf
(
f
d
,
"- %s
\n
"
,
yaml
(
lDoc
[
i
]).
c_str
()
);
fprintf
(
f
ile
,
"- %s
\n
"
,
yaml
(
lDoc
[
i
]).
c_str
()
);
out
=
string
(
"saved as "
)
+
name
+
" on "
+
mystd
::
myasctime
(
mystd
::
justnow
(),
0
);
fprintf
(
f
d
,
"- \%s
\n
"
,
yaml
(
out
).
c_str
()
);
fprintf
(
f
ile
,
"- \%s
\n
"
,
yaml
(
out
).
c_str
()
);
fprintf
(
f
d
,
"Coord:
\n
"
);
fprintf
(
f
d
,
" x:
\n
name: %s
\n
unit: %s
\n
"
,
fprintf
(
f
ile
,
"Coord:
\n
"
);
fprintf
(
f
ile
,
" x:
\n
name: %s
\n
unit: %s
\n
"
,
yaml
(
xco
.
name
).
c_str
(),
yaml
(
xco
.
unit
).
c_str
()
);
fprintf
(
f
d
,
" y:
\n
name: %s
\n
unit: %s
\n
"
,
fprintf
(
f
ile
,
" y:
\n
name: %s
\n
unit: %s
\n
"
,
yaml
(
yco
.
name
).
c_str
(),
yaml
(
yco
.
unit
).
c_str
()
);
for
(
uint
i
=
0
;
i
<
ZCo
.
size
();
i
++
)
fprintf
(
f
d
,
" z%u:
\n
name: %s
\n
unit: %s
\n
"
,
fprintf
(
f
ile
,
" z%u:
\n
name: %s
\n
unit: %s
\n
"
,
i
,
yaml
(
ZCo
[
i
].
name
).
c_str
(),
yaml
(
ZCo
[
i
].
unit
).
c_str
()
);
fprintf
(
f
d
,
"Param:
\n
"
);
fprintf
(
f
ile
,
"Param:
\n
"
);
for
(
uint
i
=
0
;
i
<
RPar
.
size
();
i
++
)
fprintf
(
fd
,
" -
\n
name: %s
\n
unit: %s
\n
value: %20.15g
\n
"
,
fprintf
(
file
,
" -
\n
name: %s
\n
unit: %s
\n
value: %20.15g
\n
"
,
yaml
(
RPar
[
i
].
Co
.
name
).
c_str
(),
yaml
(
RPar
[
i
].
Co
.
unit
).
c_str
(),
RPar
[
i
].
val
);
fprintf
(
file
,
"Tables: # %zu tables follow
\n
"
,
nScan
()
);
}
//! Write header in format ASCII-01
void
COlo
::
SaveHeader_a01
(
FILE
*
f
d
)
void
COlo
::
SaveHeader_a01
(
FILE
*
f
ile
)
{
fprintf
(
f
d
,
"fil %s
\n
"
,
name
.
c_str
()
);
fprintf
(
f
ile
,
"fil %s
\n
"
,
name
.
c_str
()
);
lDoc
.
push_back
(
"saved as "
+
name
+
" on "
+
mystd
::
myasctime
(
mystd
::
justnow
(),
0
));
for
(
uint
i
=
0
;
i
<
lDoc
.
size
();
i
++
)
fprintf
(
f
d
,
"doc %s
\n
"
,
lDoc
[
i
].
c_str
()
);
fprintf
(
f
ile
,
"doc %s
\n
"
,
lDoc
[
i
].
c_str
()
);
fprintf
(
f
d
,
"x %s
\n
"
,
xco
.
to_a01
().
c_str
()
);
fprintf
(
f
d
,
"y %s
\n
"
,
yco
.
to_a01
().
c_str
()
);
fprintf
(
f
ile
,
"x %s
\n
"
,
xco
.
to_a01
().
c_str
()
);
fprintf
(
f
ile
,
"y %s
\n
"
,
yco
.
to_a01
().
c_str
()
);
for
(
uint
i
=
0
;
i
<
ZCo
.
size
();
i
++
)
fprintf
(
f
d
,
"z%-2u %s
\n
"
,
i
,
ZCo
[
i
].
to_a01
().
c_str
()
);
fprintf
(
f
ile
,
"z%-2u %s
\n
"
,
i
,
ZCo
[
i
].
to_a01
().
c_str
()
);
for
(
uint
i
=
0
;
i
<
RPar
.
size
();
i
++
)
fprintf
(
f
d
,
"rpa %20.15g %s
\n
"
,
fprintf
(
f
ile
,
"rpa %20.15g %s
\n
"
,
RPar
[
i
].
val
,
RPar
[
i
].
Co
.
to_a01
().
c_str
()
);
}
...
...
@@ -96,11 +99,9 @@ COld::COld( class COlc const* c )
//! Save bulk of online file in one of several formats.
void
COld
::
SaveBody
(
FILE
*
file
,
string
fmt
)
void
COld
::
SaveBody
(
FILE
*
file
,
const
string
&
fmt
)
const
{
if
(
fmt
==
"y08"
){
fprintf
(
file
,
"# %zu tables
\n
"
,
VS
.
size
()
);
fprintf
(
file
,
"Tables:
\n
"
);
for
(
size_t
j
=
0
;
j
<
VS
.
size
();
j
++
){
fprintf
(
file
,
" - # table %zu
\n
"
,
j
);
VS
[
j
].
Save
(
file
,
fmt
);
...
...
@@ -169,14 +170,16 @@ uint COld::nPts() const {
//***************************************************************************//
void
COlc
::
SaveBody
(
FILE
*
file
)
void
COlc
::
SaveBody
(
FILE
*
file
,
const
string
&
fmt
)
const
// written for file format ASCII-01
{
fprintf
(
file
,
"#j %zu
\n
"
,
VC
.
size
());
for
(
size_t
j
=
0
;
j
<
VC
.
size
();
j
++
)
{
fprintf
(
file
,
"scn %zu
\n
"
,
j
);
VC
[
j
].
Save
(
file
);
}
if
(
fmt
==
"y08"
)
{
for
(
size_t
j
=
0
;
j
<
nScan
();
j
++
){
fprintf
(
file
,
" - # table %zu
\n
"
,
j
);
VC
[
j
].
Save
(
file
,
fmt
);
}
}
else
throw
"curve saving not implemented for format "
+
fmt
;
}
//***************************************************************************//
...
...
@@ -193,26 +196,19 @@ void CEle::Save( FILE *file, string fmt )
if
(
Typ
==
DATA
)
{
D
()
->
SaveBody
(
file
,
fmt
);
}
else
if
(
Typ
==
CURVE
)
{
C
()
->
SaveBody
(
file
);
C
()
->
SaveBody
(
file
,
fmt
);
}
else
throw
string
(
"FATAL: invalid Typ in Save"
);
P
()
->
as_on_disk
=
true
;
}
else
if
(
fmt
==
"a01"
){
fprintf
(
file
,
"ASCII-01 JWu
\n
"
);
if
(
Typ
==
CURVE
)
fprintf
(
file
,
"typ C
\n
"
);
else
if
(
Typ
==
DATA
)
if
(
Typ
==
DATA
)
fprintf
(
file
,
"typ D
\n
"
);
else
throw
string
(
"FATAL:
invalid Typ in Save
"
);
throw
string
(
"FATAL:
ASCII-01 save only for data files
"
);
P
()
->
SaveHeader_a01
(
file
);
if
(
Typ
==
DATA
)
{
D
()
->
SaveBody
(
file
,
fmt
);
}
else
if
(
Typ
==
CURVE
)
{
C
()
->
SaveBody
(
file
);
}
else
throw
string
(
"FATAL: invalid Typ in Save"
);
D
()
->
SaveBody
(
file
,
fmt
);
fprintf
(
file
,
"eof
\n
"
);
P
()
->
as_on_disk
=
true
;
...
...
This diff is collapsed.
Click to expand it.
pub/src/olm.h
+
2
−
2
View file @
08e40252
...
...
@@ -48,7 +48,7 @@ class COld : public COlo { // on-line data file
uint
nPts
(
uint
j
)
const
;
uint
nPts
()
const
;
// 0 unless all spectra j have same nPts(j)
void
SaveBody
(
FILE
*
f
d
,
string
fmt
);
void
SaveBody
(
FILE
*
f
ile
,
const
string
&
fmt
)
const
;
};
class
COlc
:
public
COlo
{
// on-line curves
...
...
@@ -81,7 +81,7 @@ class COlc : public COlo { // on-line curves
vector
<
string
>
pInfo
()
const
;
string
pInfoCat
()
const
;
void
SaveBody
(
FILE
*
f
d
)
;
void
SaveBody
(
FILE
*
f
ile
,
const
string
&
fmt
)
const
;
};
// the following is needed to pack (pointers to) COld and COlc into ONE vector :
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment