Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
SWIFTsim
Commits
f724e5d0
Commit
f724e5d0
authored
8 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Added script to generate the multipole_equal() function of any order
parent
d2eb344d
No related branches found
No related tags found
1 merge request
!328
Gravity multi dt
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theory/Multipoles/multipoles.py
+39
-0
39 additions, 0 deletions
theory/Multipoles/multipoles.py
with
39 additions
and
0 deletions
theory/Multipoles/multipoles.py
+
39
−
0
View file @
f724e5d0
...
@@ -101,6 +101,45 @@ if order > 0:
...
@@ -101,6 +101,45 @@ if order > 0:
print
""
print
""
print
"
-------------------------------------------------
"
print
"
-------------------------------------------------
"
print
"
gravity_multipole_equal():
"
print
"
-------------------------------------------------
\n
"
if
order
>
0
:
print
"
#if SELF_GRAVITY_MULTIPOLE_ORDER > %d
"
%
(
order
-
1
)
# Create all the terms relevent for this order
print
"
/* Manhattan Norm of %s order terms */
"
%
ordinal
(
order
)
print
"
const float order%d_norm =
"
%
order
,
first
=
True
for
i
in
range
(
order
+
1
):
for
j
in
range
(
order
+
1
):
for
k
in
range
(
order
+
1
):
if
i
+
j
+
k
==
order
:
if
first
:
first
=
False
else
:
print
"
+
"
,
print
"
fabsf(ma->M_%d%d%d)
"
%
(
i
,
j
,
k
),
print
"
+ fabsf(mb->M_%d%d%d)
"
%
(
i
,
j
,
k
),
print
"
;
\n
"
print
"
/* Compare %s order terms above 1%% of norm */
"
%
ordinal
(
order
)
for
i
in
range
(
order
+
1
):
for
j
in
range
(
order
+
1
):
for
k
in
range
(
order
+
1
):
if
i
+
j
+
k
==
order
:
print
"
if (fabsf(ma->M_%d%d%d + mb->M_%d%d%d) > order%d_norm &&
"
%
(
i
,
j
,
k
,
i
,
j
,
k
,
order
)
print
"
fabsf(ma->M_%d%d%d - mb->M_%d%d%d) / fabsf(ma->M_%d%d%d + mb->M_%d%d%d) > tolerance) {
"
%
(
i
,
j
,
k
,
i
,
j
,
k
,
i
,
j
,
k
,
i
,
j
,
k
)
print
"
message(
\"
M_%d%d%d term different
\"
);
"
%
(
i
,
j
,
k
)
print
"
return 0;
"
print
"
}
"
if
order
>
0
:
print
"
#endif
"
print
""
print
"
-------------------------------------------------
"
print
"
gravity_P2M(): (loop)
"
print
"
gravity_P2M(): (loop)
"
print
"
-------------------------------------------------
\n
"
print
"
-------------------------------------------------
\n
"
...
...
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