Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
qpong
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
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Armin Co
qpong
Commits
9e78c11e
Commit
9e78c11e
authored
Nov 23, 2019
by
Armin Co
Browse files
Options
Downloads
Patches
Plain Diff
Fix GTK warning.
Removed a warning which apeared when the application started.
parent
0fbdfb4e
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
src/Particle.cpp
+12
-12
12 additions, 12 deletions
src/Particle.cpp
src/main.cpp
+1
-1
1 addition, 1 deletion
src/main.cpp
with
14 additions
and
13 deletions
.gitignore
+
1
−
0
View file @
9e78c11e
build
.vscode
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/Particle.cpp
+
12
−
12
View file @
9e78c11e
...
...
@@ -17,13 +17,13 @@ const Complex Ci(0.0, 1.0);
void
Particle
::
initImpulse
()
{
for
(
unsigned
long
iy
=
0
;
iy
<
ny
;
iy
++
)
for
(
unsigned
iy
=
0
;
iy
<
ny
;
iy
++
)
{
double
y
=
yAt
(
iy
);
for
(
unsigned
long
ix
=
0
;
ix
<
nx
;
ix
++
)
for
(
unsigned
ix
=
0
;
ix
<
nx
;
ix
++
)
{
double
x
=
xAt
(
ix
);
int
index
=
nx
*
iy
+
ix
;
unsigned
index
=
nx
*
iy
+
ix
;
m_psi
[
index
]
=
A0
*
exp
(
Ci
/
hbar
*
(
x
*
k_px0
+
y
*
k_py0
)
-
lambda
*
(
square
(
x
-
k_x0
)
+
square
(
y
-
k_y0
)));
}
}
...
...
@@ -54,15 +54,15 @@ Particle::~Particle()
void
Particle
::
propagate
()
{
#pragma omp parallel for
for
(
unsigned
long
iy
=
0
;
iy
<
ny
;
iy
++
)
for
(
unsigned
iy
=
0
;
iy
<
ny
;
iy
++
)
{
double
y
=
yAt
(
iy
);
for
(
unsigned
long
ix
=
0
;
ix
<
nx
;
ix
++
)
for
(
unsigned
ix
=
0
;
ix
<
nx
;
ix
++
)
{
constexpr
double
l
=
0.001
;
//lambda
double
x
=
xAt
(
ix
);
double
E
=
square
(
y
)
*
l
;
int
index
=
nx
*
iy
+
ix
;
unsigned
index
=
nx
*
iy
+
ix
;
m_psi
[
index
]
*=
exp
(
-
Ci
*
dt
/
hbar
*
E
);
}
}
...
...
@@ -70,10 +70,10 @@ void Particle::propagate()
fftw_execute
(
m_planForward
);
// transform into impulse repr.
#pragma omp parallel for
for
(
unsigned
long
iy
=
0
;
iy
<
ny
;
iy
++
)
for
(
unsigned
iy
=
0
;
iy
<
ny
;
iy
++
)
{
double
py
=
pyAt
(
iy
);
for
(
unsigned
long
ix
=
0
;
ix
<
nx
;
ix
++
)
for
(
unsigned
ix
=
0
;
ix
<
nx
;
ix
++
)
{
double
px
=
pxAt
(
ix
);
double
E
=
(
square
(
px
)
+
square
(
py
))
/
(
2.0
*
m
);
...
...
@@ -94,8 +94,8 @@ void Particle::updateImpulseImage()
std
::
array
<
Complex
,
valuesInArray
>
array
;
unsigned
px
=
0
;
unsigned
py
=
0
;
unsigned
long
impulse_index
=
0
;
unsigned
long
array_index
=
0
;
unsigned
impulse_index
=
0
;
unsigned
array_index
=
0
;
#pragma omp parallel for
for
(
unsigned
y
=
0
;
y
<
ny
;
y
++
)
{
...
...
@@ -129,9 +129,9 @@ void Particle::updateImpulseImage()
void
Particle
::
updateLocalImage
()
{
std
::
array
<
Complex
,
valuesInArray
>
array
;
for
(
unsigned
long
y
=
0
;
y
<
ny
;
y
++
)
for
(
unsigned
y
=
0
;
y
<
ny
;
y
++
)
{
for
(
unsigned
long
x
=
0
;
x
<
nx
;
x
++
)
for
(
unsigned
x
=
0
;
x
<
nx
;
x
++
)
{
int
index
=
y
*
nx
+
x
;
array
[
index
]
=
m_psi
[
index
];
...
...
This diff is collapsed.
Click to expand it.
src/main.cpp
+
1
−
1
View file @
9e78c11e
...
...
@@ -46,7 +46,7 @@ void render(ArrayCanvas &ac)
int
main
(
int
argc
,
char
*
argv
[])
{
// App and window
auto
app
=
Gtk
::
Application
::
create
(
argc
,
argv
,
"
An exmaple
"
);
auto
app
=
Gtk
::
Application
::
create
(
argc
,
argv
,
"
cvh.qpong
"
);
Gtk
::
Window
window
;
window
.
set_default_size
(
1024
,
512
);
...
...
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