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
f3049018
Commit
f3049018
authored
8 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
a working version with formal refinement loop
parent
f6f1194b
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/plot.cpp
+3
-0
3 additions, 0 deletions
pub/lib/plot.cpp
pub/trivia/vector_ops.hpp
+9
-8
9 additions, 8 deletions
pub/trivia/vector_ops.hpp
with
12 additions
and
8 deletions
pub/lib/plot.cpp
+
3
−
0
View file @
f3049018
...
...
@@ -294,6 +294,8 @@ int plot_curve_refine(CPlot* plot, const COlc* fc, int k, int j, int cstyle)
}
return
ret
;
};
auto
pt_order
=
[](
const
CPt
a
,
const
CPt
b
)
->
bool
{
return
a
.
xd
<=
b
.
xd
;
};
vector
<
CPt
>
pp
;
// start with equidistant grid:
...
...
@@ -305,6 +307,7 @@ int plot_curve_refine(CPlot* plot, const COlc* fc, int k, int j, int cstyle)
// refinement loop:
for
(
int
iref
=
0
;
iref
<
20
;
++
iref
)
{
vector
<
CPt
>
pnew
=
x2p
(
xnew
);
pp
=
triv
::
merge_sorted
(
pp
,
pnew
,
pt_order
);
}
// divide into segments, and plot
...
...
This diff is collapsed.
Click to expand it.
pub/trivia/vector_ops.hpp
+
9
−
8
View file @
f3049018
...
...
@@ -25,9 +25,8 @@ namespace triv
std
::
string
indices_to_s
(
const
std
::
vector
<
int
>&
v
);
template
<
class
T
>
bool
contains
(
const
std
::
vector
<
T
>&
v
,
const
T
e
);
template
<
class
T
>
std
::
vector
<
T
>
merge_sorted
(
const
std
::
vector
<
T
>&
a
,
const
std
::
vector
<
T
>&
b
,
std
::
function
<
bool
(
const
T
,
const
T
)
>
a_before_b
);
template
<
class
T
,
class
Pred
>
std
::
vector
<
T
>
merge_sorted
(
const
std
::
vector
<
T
>&
a
,
const
std
::
vector
<
T
>&
b
,
Pred
a_before_b
);
//**************************************************************************************************
// Template implementation
...
...
@@ -38,16 +37,18 @@ namespace triv
return
std
::
find
(
v
.
begin
(),
v
.
end
(),
e
)
!=
v
.
end
();
}
template
<
class
T
>
std
::
vector
<
T
>
merge_sorted
(
const
std
::
vector
<
T
>&
a
,
const
std
::
vector
<
T
>&
b
,
std
::
function
<
bool
(
const
T
,
const
T
)
>
a_before_b
)
template
<
class
T
,
class
Pred
>
std
::
vector
<
T
>
merge_sorted
(
const
std
::
vector
<
T
>&
a
,
const
std
::
vector
<
T
>&
b
,
Pred
a_before_b
)
{
std
::
vector
<
T
>
ret
;
auto
ia
=
a
.
begin
();
auto
ib
=
b
.
begin
();
for
(;
;
ia
!=
a
.
end
()
||
ib
!=
i
b
.
end
())
for
(;
ia
!=
a
.
end
()
&&
ib
!=
b
.
end
()
;
)
ret
.
push_back
(
a_before_b
(
*
ia
,
*
ib
)
?
*
(
ia
++
)
:
*
(
ib
++
)
);
for
(;
ia
!=
a
.
end
();)
ret
.
push_back
(
*
(
ia
++
)
);
for
(;
ib
!=
b
.
end
();)
ret
.
push_back
(
*
(
ib
++
)
);
return
ret
;
}
}
...
...
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