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
4c165d61
Commit
4c165d61
authored
8 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
print x/y/hSetCoord
parent
c77ca108
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/lib/special.cpp
+20
-1
20 additions, 1 deletion
pub/lib/special.cpp
pub/trivia/vector_ops.hpp
+16
-1
16 additions, 1 deletion
pub/trivia/vector_ops.hpp
with
36 additions
and
2 deletions
pub/lib/special.cpp
+
20
−
1
View file @
4c165d61
...
...
@@ -126,13 +126,32 @@ void NSpecial::export_p2d(bool allow_overwrite)
throw
"file "
+
outfnam
+
" exists, use flag ! to overwrite"
;
std
::
ofstream
ofs
;
ofs
.
open
(
outfnam
,
std
::
ofstream
::
out
);
// determine and print bin limits
vector
<
double
>
zval
=
f
->
zvec
(
0
)
->
to_rvec
();
vector
<
double
>
zlim
=
triv
::
histogram_limits
(
zval
);
vector
<
double
>
xlim
=
triv
::
histogram_limits
(
f
->
VS
(
0
)
->
x
);
double
xinf
=
xlim
.
front
();
double
xsup
=
xlim
.
back
();
double
yinf
,
ysup
;
triv
::
getMinMax
(
f
->
VS
(
0
)
->
y
,
yinf
,
ysup
);
for
(
size_t
j
=
1
;
j
<
m
;
++
j
)
{
xlim
=
triv
::
histogram_limits
(
f
->
VS
(
j
)
->
x
);
xinf
=
std
::
min
(
xinf
,
xlim
.
front
());
xsup
=
std
::
max
(
xsup
,
xlim
.
back
());
double
yyinf
,
yysup
;
triv
::
getMinMax
(
f
->
VS
(
j
)
->
y
,
yyinf
,
yysup
);
yinf
=
std
::
min
(
yinf
,
yyinf
);
ysup
=
std
::
max
(
ysup
,
yysup
);
}
ofs
<<
(
format
(
"0 %13.7g %13.7g xSetCoord
\n
"
)
%
xinf
%
xsup
);
ofs
<<
(
format
(
"0 %13.7g %13.7g ySetCoord
\n
"
)
%
zlim
.
front
()
%
zlim
.
back
()
);
ofs
<<
(
format
(
"0 %13.7g %13.7g hSetCoord
\n
"
)
%
yinf
%
ysup
);
// print bins
for
(
size_t
j
=
0
;
j
<
m
;
++
j
)
{
const
CSpec
*
s
=
f
->
VS
(
j
);
vector
<
double
>
xlim
=
triv
::
histogram_limits
(
s
->
x
);
for
(
size_t
i
=
0
;
i
<
s
->
size
();
++
i
)
ofs
<<
(
format
(
"%13.7g wx %13.7g wx %13.7g w
z
%13.7g w
z
%13.7g w
y
p2d
\n
"
)
ofs
<<
(
format
(
"%13.7g wx %13.7g wx %13.7g w
y
%13.7g w
y
%13.7g w
h
p2d
\n
"
)
%
xlim
[
i
]
%
xlim
[
i
+
1
]
%
zlim
[
j
]
%
zlim
[
j
+
1
]
%
s
->
y
[
i
]
);
ofs
<<
"
\n
"
;
}
...
...
This diff is collapsed.
Click to expand it.
pub/trivia/vector_ops.hpp
+
16
−
1
View file @
4c165d61
...
...
@@ -10,10 +10,10 @@
#include
<vector>
#include
<functional>
#include
<algorithm>
namespace
triv
{
void
insert_in_sorted
(
std
::
vector
<
double
>*
V
,
double
val
);
void
make_unique
(
std
::
vector
<
double
>*
V
,
double
tolabs
=
1e-100
,
double
tolrel
=
1e-10
);
bool
is_ascending
(
const
std
::
vector
<
double
>&
V
);
...
...
@@ -24,6 +24,7 @@ namespace triv
void
increment_indices
(
std
::
vector
<
int
>&
v
,
int
incr
,
int
siz
);
std
::
string
indices_to_s
(
const
std
::
vector
<
int
>&
v
);
template
<
class
T
>
void
getMinMax
(
const
std
::
vector
<
T
>&
v
,
T
&
minval
,
T
&
maxval
);
template
<
class
T
>
bool
contains
(
const
std
::
vector
<
T
>&
v
,
const
T
e
);
template
<
class
T
,
class
Pred
>
std
::
vector
<
T
>
merge_sorted
(
const
std
::
vector
<
T
>&
a
,
const
std
::
vector
<
T
>&
b
,
Pred
a_before_b
);
...
...
@@ -31,6 +32,20 @@ namespace triv
//**************************************************************************************************
// Template implementation
//**************************************************************************************************
template
<
class
T
>
void
getMinMax
(
const
std
::
vector
<
T
>&
v
,
T
&
minval
,
T
&
maxval
)
{
if
(
v
.
size
()
==
0
)
throw
"BUG: attempt to determine min and max of empty vector"
;
minval
=
v
.
front
();
maxval
=
v
.
front
();
for
(
auto
t
=
v
.
begin
()
+
1
;
t
<
v
.
end
();
++
t
)
{
minval
=
std
::
min
(
minval
,
*
t
);
maxval
=
std
::
max
(
maxval
,
*
t
);
}
}
template
<
class
T
>
bool
contains
(
const
std
::
vector
<
T
>&
v
,
const
T
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