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
Coenen, Joachim
Frida
Commits
31688bc7
Commit
31688bc7
authored
16 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
.. line plotting ..
parent
2646dfea
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/dualplot.cpp
+18
-17
18 additions, 17 deletions
src/dualplot.cpp
src/dualplot.h
+1
-1
1 addition, 1 deletion
src/dualplot.h
src/edif.cpp
+9
-8
9 additions, 8 deletions
src/edif.cpp
with
28 additions
and
26 deletions
src/dualplot.cpp
+
18
−
17
View file @
31688bc7
...
@@ -278,8 +278,7 @@ void NPlot::Open()
...
@@ -278,8 +278,7 @@ void NPlot::Open()
}
}
fcntl
(
gp_fifo
,
F_SETFL
,
O_NONBLOCK
);
fcntl
(
gp_fifo
,
F_SETFL
,
O_NONBLOCK
);
// gp_write(string("plot 1 2 3")); // test
gp_write
(
string
(
"set terminal x11"
)
);
gp_write
(
string
(
"set terminal x11"
));
ps_fnum
=
0
;
ps_fnum
=
0
;
}
}
...
@@ -369,7 +368,7 @@ void NPlot::Box()
...
@@ -369,7 +368,7 @@ void NPlot::Box()
ps_accu
.
push_back
(
"
\n
%% modeDD
\n
plotbefore
\n
"
);
ps_accu
.
push_back
(
"
\n
%% modeDD
\n
plotbefore
\n
"
);
}
}
void
NPlot
::
Line
(
const
int
l
style
,
void
NPlot
::
Line
(
const
bool
as_line
,
const
int
style
_no
,
const
vector
<
double
>
xp
,
const
vector
<
double
>
yp
,
const
vector
<
double
>
xp
,
const
vector
<
double
>
yp
,
const
vector
<
double
>*
z
,
const
vector
<
double
>*
z
,
const
string
xco
,
const
string
yco
,
const
string
xco
,
const
string
yco
,
...
@@ -382,7 +381,7 @@ void NPlot::Line( const int lstyle,
...
@@ -382,7 +381,7 @@ void NPlot::Line( const int lstyle,
if
(
np
!=
yp
.
size
()
)
if
(
np
!=
yp
.
size
()
)
throw
string
(
"PROG ERR NPLot::Line x.size<>y.size"
);
throw
string
(
"PROG ERR NPLot::Line x.size<>y.size"
);
//
Save to
file:
//
Data to tmp
file:
char
gp_fnam
[
40
];
char
gp_fnam
[
40
];
sprintf
(
gp_fnam
,
"/tmp/%s-%03d.gnu"
,
getenv
(
"LOGNAME"
),
gp_fno
++
);
sprintf
(
gp_fnam
,
"/tmp/%s-%03d.gnu"
,
getenv
(
"LOGNAME"
),
gp_fno
++
);
if
(
gp_fnames
!=
""
)
gp_fnames
+=
", "
;
if
(
gp_fnames
!=
""
)
gp_fnames
+=
", "
;
...
@@ -390,7 +389,7 @@ void NPlot::Line( const int lstyle,
...
@@ -390,7 +389,7 @@ void NPlot::Line( const int lstyle,
// string(" title \"") + xco + string (" -> ")
// string(" title \"") + xco + string (" -> ")
// + yco + string ("\"");
// + yco + string ("\"");
" notitle"
;
" notitle"
;
if
(
lstyle
<
0
)
if
(
as_line
)
gp_fnames
+=
" with lines"
;
gp_fnames
+=
" with lines"
;
FILE
*
gp_fd
;
FILE
*
gp_fd
;
if
(
!
(
gp_fd
=
fopen
(
gp_fnam
,
"w"
)))
if
(
!
(
gp_fd
=
fopen
(
gp_fnam
,
"w"
)))
...
@@ -399,27 +398,29 @@ void NPlot::Line( const int lstyle,
...
@@ -399,27 +398,29 @@ void NPlot::Line( const int lstyle,
fprintf
(
gp_fd
,
"%16.8g %16.8g
\n
"
,
xp
[
i
],
yp
[
i
]);
fprintf
(
gp_fd
,
"%16.8g %16.8g
\n
"
,
xp
[
i
],
yp
[
i
]);
fclose
(
gp_fd
);
fclose
(
gp_fd
);
// Plot command:
// Live display:
string
cmd
=
"plot "
;
char
aux
[
80
];
char
aux
[
80
];
sprintf
(
aux
,
"[%12.8g:%12.8g] [%12.8g:%12.8g] "
,
sprintf
(
aux
,
"[%12.8g:%12.8g] [%12.8g:%12.8g] "
,
X
.
R
.
inf
,
X
.
R
.
sup
,
Y
.
R
.
inf
,
Y
.
R
.
sup
);
X
.
R
.
inf
,
X
.
R
.
sup
,
Y
.
R
.
inf
,
Y
.
R
.
sup
);
gp_write
(
string
(
"plot "
)
+
aux
+
gp_fnames
);
cmd
+=
aux
+
gp_fnames
;
gp_write
(
cmd
);
snprintf
(
outlin
,
LINSIZ
,
"
\n
%3u ["
,
++
ps_snum
);
// Postscript copy:
snprintf
(
outlin
,
LINSIZ
,
"
\n
%3u ["
,
++
ps_snum
);
ps_accu
.
push_back
(
outlin
);
ps_accu
.
push_back
(
outlin
);
for
(
uint
i
=
0
;
i
<
z
->
size
();
i
++
){
for
(
uint
i
=
0
;
i
<
z
->
size
();
i
++
){
snprintf
(
outlin
,
LINSIZ
,
" %12g"
,
(
*
z
)[
i
]);
snprintf
(
outlin
,
LINSIZ
,
" %12g"
,
(
*
z
)[
i
]);
ps_accu
.
push_back
(
outlin
);
ps_accu
.
push_back
(
outlin
);
}
}
snprintf
(
outlin
,
LINSIZ
,
" ] zValues
\n
"
);
snprintf
(
outlin
,
LINSIZ
,
" ] zValues
\n
"
);
ps_accu
.
push_back
(
outlin
);
ps_accu
.
push_back
(
outlin
);
if
(
as_line
)
if
(
lstyle
>=
0
)
snprintf
(
outlin
,
LINSIZ
,
"%2d cstyle"
,
1
);
snprintf
(
outlin
,
LINSIZ
,
"%2d pstyle"
,
++
ps_pnum
);
else
else
snprintf
(
outlin
,
LINSIZ
,
"%2d
c
style"
,
1
);
snprintf
(
outlin
,
LINSIZ
,
"%2d
p
style"
,
style_no
);
ps_accu
.
push_back
(
outlin
);
ps_accu
.
push_back
(
outlin
);
snprintf
(
outlin
,
LINSIZ
-
2
,
" %% (%s -> %s)"
,
xco
.
c_str
(),
yco
.
c_str
());
snprintf
(
outlin
,
LINSIZ
-
2
,
" %% (%s -> %s)"
,
xco
.
c_str
(),
yco
.
c_str
()
);
strncat
(
outlin
,
"
\n
"
,
LINSIZ
);
strncat
(
outlin
,
"
\n
"
,
LINSIZ
);
ps_accu
.
push_back
(
outlin
);
ps_accu
.
push_back
(
outlin
);
for
(
uint
i
=
0
;
i
<
np
;
i
++
)
{
for
(
uint
i
=
0
;
i
<
np
;
i
++
)
{
...
@@ -512,11 +513,11 @@ void NPlot::Dialog()
...
@@ -512,11 +513,11 @@ void NPlot::Dialog()
}
}
}
}
void
NPlot
::
gp_write
(
string
in
)
void
NPlot
::
gp_write
(
string
in
)
{
{
// cout << "DEBUG gp_write " << in << "\n";
string
out
=
in
+
"
\n
"
;
string
out
=
in
+
"
\n
"
;
write
(
gp_fifo
,
out
.
c_str
(),
out
.
size
());
printf
(
"DEBUG GNUPLOT '%s'
\n
"
,
out
.
c_str
()
);
write
(
gp_fifo
,
out
.
c_str
(),
out
.
size
()
);
}
}
void
NPlot
::
ps_ticktack
(
uint
ntack
,
double
*
tack
,
int
ntpt
,
double
*
ticklim
,
void
NPlot
::
ps_ticktack
(
uint
ntack
,
double
*
tack
,
int
ntpt
,
double
*
ticklim
,
...
...
This diff is collapsed.
Click to expand it.
src/dualplot.h
+
1
−
1
View file @
31688bc7
...
@@ -46,7 +46,7 @@ namespace NPlot { // additional declarations in dualplot.cpp
...
@@ -46,7 +46,7 @@ namespace NPlot { // additional declarations in dualplot.cpp
void
Clear
();
void
Clear
();
void
Box
();
void
Box
();
void
Line
(
const
int
l
style
,
void
Line
(
const
bool
as_line
,
const
int
style
_no
,
const
vector
<
double
>
x
,
const
vector
<
double
>
y
,
const
vector
<
double
>
x
,
const
vector
<
double
>
y
,
const
vector
<
double
>*
z
,
const
vector
<
double
>*
z
,
const
string
xco
,
const
string
yco
,
const
string
xco
,
const
string
yco
,
...
...
This diff is collapsed.
Click to expand it.
src/edif.cpp
+
9
−
8
View file @
31688bc7
...
@@ -954,11 +954,15 @@ void NEdif::Plot( bool add )
...
@@ -954,11 +954,15 @@ void NEdif::Plot( bool add )
const
COld
*
fd
;
const
COld
*
fd
;
const
COlc
*
fc
;
const
COlc
*
fc
;
CScan
S
;
CScan
S
;
static
int
pstyle
=
0
,
cstyle
=
0
;
NOlm
::
JSelAsk
(
"Plot which scans"
,
&
JSel
);
NOlm
::
JSelAsk
(
"Plot which scans"
,
&
JSel
);
if
(
!
add
)
{
if
(
!
add
)
{
pstyle
=
0
;
cstyle
=
0
;
// determine x-range ?
// determine x-range ?
double
inf
,
sup
;
double
inf
,
sup
;
...
@@ -1058,7 +1062,6 @@ void NEdif::Plot( bool add )
...
@@ -1058,7 +1062,6 @@ void NEdif::Plot( bool add )
}
}
// plot data:
// plot data:
int
lstyle
;
NOlm
::
IterateEle
eiter
;
NOlm
::
IterateEle
eiter
;
while
(
(
e
=
eiter
())
){
while
(
(
e
=
eiter
())
){
k
=
eiter
.
SelNo
();
k
=
eiter
.
SelNo
();
...
@@ -1109,8 +1112,8 @@ void NEdif::Plot( bool add )
...
@@ -1109,8 +1112,8 @@ void NEdif::Plot( bool add )
if
(
nyh
)
if
(
nyh
)
printf
(
" %d points > ymax
\n
"
,
nyh
);
printf
(
" %d points > ymax
\n
"
,
nyh
);
}
else
{
}
else
{
lstyle
=
0
;
NPlot
::
Line
(
false
,
pstyle
++
,
NPlot
::
Line
(
lstyle
,
fd
->
VS
[
j
].
x
,
fd
->
VS
[
j
].
y
,
e
->
Z
(
j
),
fd
->
VS
[
j
].
x
,
fd
->
VS
[
j
].
y
,
e
->
Z
(
j
),
e
->
P
()
->
xco
.
str
(),
e
->
P
()
->
yco
.
str
(),
e
->
P
()
->
xco
.
str
(),
e
->
P
()
->
yco
.
str
(),
"data file "
+
strg
(
k
)
+
" scan "
+
strg
(
j
)
);
"data file "
+
strg
(
k
)
+
" scan "
+
strg
(
j
)
);
}
}
...
@@ -1123,8 +1126,7 @@ void NEdif::Plot( bool add )
...
@@ -1123,8 +1126,7 @@ void NEdif::Plot( bool add )
xp
[
i
]
=
NPlot
::
X
.
R
.
plotcoord2value
(
xp
[
i
]
=
NPlot
::
X
.
R
.
plotcoord2value
(
NPlot
::
X
.
log
,
i
/
(
npts
-
1.0
)
);
NPlot
::
X
.
log
,
i
/
(
npts
-
1.0
)
);
fc
->
T
->
tree_curve_val_vec
(
&
yp
,
xp
,
k
,
j
);
fc
->
T
->
tree_curve_val_vec
(
&
yp
,
xp
,
k
,
j
);
lstyle
=
-
1
;
NPlot
::
Line
(
true
,
cstyle
++
,
xp
,
yp
,
e
->
Z
(
j
),
NPlot
::
Line
(
lstyle
,
xp
,
yp
,
e
->
Z
(
j
),
e
->
P
()
->
xco
.
str
(),
e
->
P
()
->
yco
.
str
(),
e
->
P
()
->
xco
.
str
(),
e
->
P
()
->
yco
.
str
(),
"curve file "
+
strg
(
k
)
+
" scan "
+
strg
(
j
)
);
"curve file "
+
strg
(
k
)
+
" scan "
+
strg
(
j
)
);
}
else
if
(
fc
)
{
}
else
if
(
fc
)
{
...
@@ -1153,7 +1155,6 @@ void NEdif::Plot( bool add )
...
@@ -1153,7 +1155,6 @@ void NEdif::Plot( bool add )
s
->
Clear
();
s
->
Clear
();
}
}
s
->
push_back
(
arg
,
val
);
s
->
push_back
(
arg
,
val
);
printf
(
"DEB %g %g %g %i
\n
"
,
pos
,
arg
,
val
,
SS
.
size
()
);
incr_pos
:
incr_pos
:
was_inside
=
is_inside
;
was_inside
=
is_inside
;
if
(
pos
>=
1
)
if
(
pos
>=
1
)
...
@@ -1162,13 +1163,13 @@ void NEdif::Plot( bool add )
...
@@ -1162,13 +1163,13 @@ void NEdif::Plot( bool add )
if
(
pos
>
1
)
if
(
pos
>
1
)
pos
=
1
;
pos
=
1
;
}
}
lstyle
=
-
1
;
for
(
int
iS
=
0
;
iS
<
SS
.
size
();
++
iS
){
for
(
int
iS
=
0
;
iS
<
SS
.
size
();
++
iS
){
NPlot
::
Line
(
l
style
,
SS
[
iS
].
x
,
SS
[
iS
].
y
,
e
->
Z
(
j
),
NPlot
::
Line
(
true
,
c
style
,
SS
[
iS
].
x
,
SS
[
iS
].
y
,
e
->
Z
(
j
),
e
->
P
()
->
xco
.
str
(),
e
->
P
()
->
yco
.
str
(),
e
->
P
()
->
xco
.
str
(),
e
->
P
()
->
yco
.
str
(),
"curve file "
+
strg
(
k
)
+
" scan "
+
strg
(
j
)
+
"curve file "
+
strg
(
k
)
+
" scan "
+
strg
(
j
)
+
" segment "
+
strg
(
iS
)
);
" segment "
+
strg
(
iS
)
);
}
}
cstyle
++
;
}
else
}
else
throw
string
(
"PROGRAM ERROR plot invalid *e"
);
throw
string
(
"PROGRAM ERROR plot invalid *e"
);
}
}
...
...
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