Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RBComb simulation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pascal Engeler
RBComb simulation
Commits
64c0b2eb
Commit
64c0b2eb
authored
5 years ago
by
Pascal Engeler
Browse files
Options
Downloads
Patches
Plain Diff
Added unit test for lattice generation
parent
bdb23026
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
unit_tests/main_lattice_generation.cpp
+40
-0
40 additions, 0 deletions
unit_tests/main_lattice_generation.cpp
unit_tests/plot_lattice.py
+11
-0
11 additions, 0 deletions
unit_tests/plot_lattice.py
with
51 additions
and
0 deletions
unit_tests/main_lattice_generation.cpp
0 → 100644
+
40
−
0
View file @
64c0b2eb
#include
<lattice_generator.hpp>
#include
<rbcomb_generator.hpp>
#include
<drum.hpp>
#include
<drum_parameters.hpp>
#include
<drum_variables.hpp>
#include
<rk4_buffer.hpp>
#include
<vector>
#include
<iostream>
int
main
()
{
using
value_t
=
double
;
using
drum_t
=
Drum
<
value_t
,
DrumParameters
,
DrumVariables
,
RK4Buffer
>
;
using
generator_t
=
LatticeGenerator
<
value_t
,
DrumParameters
,
DrumVariables
,
RK4Buffer
>
;
using
rbgen_t
=
RbcombGenerator
<
value_t
,
DrumParameters
,
DrumVariables
,
RK4Buffer
>
;
using
params_t
=
DrumVariables
<
value_t
>
;
DrumParameters
<
value_t
>
dp
(
800.
,
6.28318531E-03
,
10.
,
9.64930905E-01
,
10000.
,
1.0
,
1.16883395E-06
,
Vec2
<
value_t
>
(
0.
,
0.
),
'A'
);
std
::
vector
<
generator_t
*>
gen_vec
;
rbgen_t
rbgen
(
50
,
10
);
gen_vec
.
push_back
(
&
rbgen
);
std
::
pair
<
std
::
vector
<
drum_t
>
,
std
::
vector
<
std
::
vector
<
int
>
>
>
result_pair
=
gen_vec
[
0
]
->
operator
()(
dp
);
for
(
int
i
=
0
;
i
<
result_pair
.
second
.
size
();
++
i
){
for
(
int
j
=
0
;
j
<
result_pair
.
second
[
i
].
size
();
++
j
){
if
(
result_pair
.
second
[
i
][
j
]
!=
-
1
){
auto
drum1
=
result_pair
.
first
[
i
];
auto
drum2
=
result_pair
.
first
[
result_pair
.
second
[
i
][
j
]];
std
::
cout
<<
drum1
.
get_parameters
().
position
.
x
()
<<
" "
<<
drum1
.
get_parameters
().
position
.
y
()
<<
" "
<<
drum2
.
get_parameters
().
position
.
x
()
<<
" "
<<
drum2
.
get_parameters
().
position
.
y
()
<<
std
::
endl
;
}
}
}
return
0
;
}
This diff is collapsed.
Click to expand it.
unit_tests/plot_lattice.py
0 → 100644
+
11
−
0
View file @
64c0b2eb
import
matplotlib.pyplot
as
plt
import
numpy
as
np
lattice
=
np
.
loadtxt
(
'
lattice.txt
'
,
dtype
=
float
)
#plot row by row
for
i
in
range
(
len
(
lattice
[:,
0
])):
plt
.
plot
([
lattice
[
i
,
0
],
lattice
[
i
,
2
]],[
lattice
[
i
,
1
],
lattice
[
i
,
3
]])
plt
.
ylim
([
-
22000.
,
47000.
])
plt
.
savefig
(
'
lattice.pdf
'
,
dpi
=
500
)
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