Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QuickSched
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
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
SWIFT
QuickSched
Commits
7564cf8c
Commit
7564cf8c
authored
10 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Simplified a bit the quadrupole calculation
parent
12232492
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/test_bh_sorted.c
+16
-18
16 additions, 18 deletions
examples/test_bh_sorted.c
with
16 additions
and
18 deletions
examples/test_bh_sorted.c
+
16
−
18
View file @
7564cf8c
...
...
@@ -226,36 +226,34 @@ static inline void multipole_add(struct multipole *d, const float *x, float mass
static
inline
void
multipole_iact
(
struct
multipole
*
d
,
const
float
*
x
,
float
*
a
)
{
int
k
;
float
r2
,
ir
,
w
,
dx
[
3
],
mu
[
3
];
float
Q_00
,
Q_11
,
Q_22
,
Q_01
,
Q_02
,
Q_12
;
float
r2
,
ir
,
w
,
dx
[
3
];
/* early abort */
if
(
d
->
mass
==
0
.)
return
;
float
inv_mass
=
1
.
/
d
->
mass
;
/* Construct CoM */
for
(
k
=
0
;
k
<
3
;
++
k
)
mu
[
k
]
=
d
->
mu
[
k
]
*
inv_mass
;
/* Temporary quantity */
dx
[
0
]
=
d
->
sigma_00
-
d
->
mass
*
mu
[
0
]
*
mu
[
0
];
/* Abusing a so far unused */
dx
[
1
]
=
d
->
sigma_11
-
d
->
mass
*
mu
[
1
]
*
mu
[
1
];
/* variable temporarily... */
dx
[
2
]
=
d
->
sigma_22
-
d
->
mass
*
mu
[
2
]
*
mu
[
2
];
dx
[
0
]
=
d
->
sigma_00
-
inv_
mass
*
d
->
mu
[
0
]
*
d
->
mu
[
0
];
/* Abusing a so far unused */
dx
[
1
]
=
d
->
sigma_11
-
inv_
mass
*
d
->
mu
[
1
]
*
d
->
mu
[
1
];
/* variable temporarily... */
dx
[
2
]
=
d
->
sigma_22
-
inv_
mass
*
d
->
mu
[
2
]
*
d
->
mu
[
2
];
/* Construct quadrupole matrix */
Q_00
=
2
.
f
*
dx
[
0
]
-
dx
[
1
]
-
dx
[
2
];
Q_11
=
2
.
f
*
dx
[
1
]
-
dx
[
0
]
-
dx
[
2
];
Q_22
=
2
.
f
*
dx
[
2
]
-
dx
[
0
]
-
dx
[
1
];
Q_01
=
d
->
sigma_01
-
d
->
mass
*
mu
[
0
]
*
mu
[
1
];
Q_02
=
d
->
sigma_02
-
d
->
mass
*
mu
[
0
]
*
mu
[
2
];
Q_12
=
d
->
sigma_12
-
d
->
mass
*
mu
[
1
]
*
mu
[
2
];
Q_01
*=
3
.
f
;
Q_02
*=
3
.
f
;
Q_12
*=
3
.
f
;
float
Q_00
=
2
.
0
f
*
dx
[
0
]
-
dx
[
1
]
-
dx
[
2
];
float
Q_11
=
2
.
0
f
*
dx
[
1
]
-
dx
[
0
]
-
dx
[
2
];
float
Q_22
=
Q_00
+
Q_11
;
/* Q_ij is traceless */
Q_22
*=
-
1
.
0
f
;
float
Q_01
=
d
->
sigma_01
-
inv_mass
*
d
->
mu
[
0
]
*
d
->
mu
[
1
];
float
Q_02
=
d
->
sigma_02
-
inv_mass
*
d
->
mu
[
0
]
*
d
->
mu
[
2
];
float
Q_12
=
d
->
sigma_12
-
inv_mass
*
d
->
mu
[
1
]
*
d
->
mu
[
2
];
Q_01
*=
3
.
0
f
;
Q_02
*=
3
.
0
f
;
Q_12
*=
3
.
0
f
;
/* Compute the distance to the CoM. */
for
(
r2
=
0
.
0
f
,
k
=
0
;
k
<
3
;
k
++
)
{
dx
[
k
]
=
x
[
k
]
-
mu
[
k
];
dx
[
k
]
=
x
[
k
]
-
d
->
mu
[
k
]
*
inv_mass
;
r2
+=
dx
[
k
]
*
dx
[
k
];
}
ir
=
1
.
0
f
/
sqrtf
(
r2
);
...
...
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