Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
N Body Simulation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
This server has been upgraded to GitLab release
17.10
.
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Armin Damon Riess
N Body Simulation
Commits
fbe7d378
Commit
fbe7d378
authored
2 years ago
by
Armin Damon Riess
Browse files
Options
Downloads
Patches
Plain Diff
sligthly improved efficiency (~2.5 sec)
parent
30115a72
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
data/output.txt
+43823
-43823
43823 additions, 43823 deletions
data/output.txt
lib/nBodySim.cpp
+1
-1
1 addition, 1 deletion
lib/nBodySim.cpp
main.cpp
+2
-1
2 additions, 1 deletion
main.cpp
with
43826 additions
and
43825 deletions
data/output.txt
+
43823
−
43823
View file @
fbe7d378
Source diff could not be displayed: it is too large. Options to address this:
view the blob
.
This diff is collapsed.
Click to expand it.
lib/nBodySim.cpp
+
1
−
1
View file @
fbe7d378
...
...
@@ -68,7 +68,7 @@ void nBodySim::calculateForces() {
forces_
[
i
]
=
0.0
;
}
// loop over each pair of particles and calculate the force between them
#pragma omp parallel for schedule(guided)
#pragma omp parallel for
//
schedule(guided)
for
(
unsigned
i
=
0
;
i
<
nParticles_
;
i
++
)
{
double
mi
=
masses_
[
i
];
double
s
=
softening_
[
i
];
...
...
This diff is collapsed.
Click to expand it.
main.cpp
+
2
−
1
View file @
fbe7d378
...
...
@@ -36,7 +36,8 @@ int main(int argc, char** argv) {
try
{
auto
start
=
std
::
chrono
::
high_resolution_clock
::
now
();
sim
.
calculateForces
();
// for (unsigned i=0; i<100; ++i)
sim
.
calculateForces
();
auto
stop
=
std
::
chrono
::
high_resolution_clock
::
now
();
auto
duration
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
microseconds
>
(
stop
-
start
);
...
...
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