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
37b049de
Commit
37b049de
authored
9 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Documentation
parent
8c4afc4a
No related branches found
No related tags found
1 merge request
!167
Kick task for fixdt and proper treatment of conserved quantities
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/timestep.h
+21
-1
21 additions, 1 deletion
src/timestep.h
with
21 additions
and
1 deletion
src/timestep.h
+
21
−
1
View file @
37b049de
...
@@ -26,6 +26,14 @@
...
@@ -26,6 +26,14 @@
#include
"const.h"
#include
"const.h"
#include
"debug.h"
#include
"debug.h"
/**
* @brief Compute a valid integer time-step form a given time-step
*
* @param new_dt The time-step to convert.
* @param ti_begin The (integer) start of the previous time-step.
* @param ti_end The (integer) end of the previous time-step.
* @param timeBase_inv The inverse of the system's minimal time-step.
*/
__attribute__
((
always_inline
))
INLINE
static
int
get_integer_timestep
(
__attribute__
((
always_inline
))
INLINE
static
int
get_integer_timestep
(
float
new_dt
,
int
ti_begin
,
int
ti_end
,
double
timeBase_inv
)
{
float
new_dt
,
int
ti_begin
,
int
ti_end
,
double
timeBase_inv
)
{
...
@@ -41,7 +49,6 @@ __attribute__((always_inline)) INLINE static int get_integer_timestep(
...
@@ -41,7 +49,6 @@ __attribute__((always_inline)) INLINE static int get_integer_timestep(
/* Put this timestep on the time line */
/* Put this timestep on the time line */
int
dti_timeline
=
max_nr_timesteps
;
int
dti_timeline
=
max_nr_timesteps
;
while
(
new_dti
<
dti_timeline
)
dti_timeline
/=
2
;
while
(
new_dti
<
dti_timeline
)
dti_timeline
/=
2
;
new_dti
=
dti_timeline
;
new_dti
=
dti_timeline
;
/* Make sure we are allowed to increase the timestep size */
/* Make sure we are allowed to increase the timestep size */
...
@@ -52,6 +59,12 @@ __attribute__((always_inline)) INLINE static int get_integer_timestep(
...
@@ -52,6 +59,12 @@ __attribute__((always_inline)) INLINE static int get_integer_timestep(
return
new_dti
;
return
new_dti
;
}
}
/**
* @brief Compute the new (integer) time-step of a given #gpart
*
* @param gp The #gpart.
* @param e The #engine (used to get some constants).
*/
__attribute__
((
always_inline
))
INLINE
static
int
get_gpart_timestep
(
__attribute__
((
always_inline
))
INLINE
static
int
get_gpart_timestep
(
const
struct
gpart
*
gp
,
const
struct
engine
*
e
)
{
const
struct
gpart
*
gp
,
const
struct
engine
*
e
)
{
...
@@ -73,6 +86,13 @@ __attribute__((always_inline)) INLINE static int get_gpart_timestep(
...
@@ -73,6 +86,13 @@ __attribute__((always_inline)) INLINE static int get_gpart_timestep(
return
new_dti
;
return
new_dti
;
}
}
/**
* @brief Compute the new (integer) time-step of a given #part
*
* @param p The #part.
* @param xp The #xpart partner of p.
* @param e The #engine (used to get some constants).
*/
__attribute__
((
always_inline
))
INLINE
static
int
get_part_timestep
(
__attribute__
((
always_inline
))
INLINE
static
int
get_part_timestep
(
const
struct
part
*
p
,
const
struct
xpart
*
xp
,
const
struct
engine
*
e
)
{
const
struct
part
*
p
,
const
struct
xpart
*
xp
,
const
struct
engine
*
e
)
{
...
...
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