Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs-feliks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Feliks Kiszkurno
ogs-feliks
Commits
e0e20760
Commit
e0e20760
authored
3 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
[PL/TimeLoop] Readability: eps as a constexpr double.
parent
e0eff1da
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ProcessLib/TimeLoop.cpp
+7
-10
7 additions, 10 deletions
ProcessLib/TimeLoop.cpp
with
7 additions
and
10 deletions
ProcessLib/TimeLoop.cpp
+
7
−
10
View file @
e0e20760
...
@@ -311,6 +311,7 @@ double TimeLoop::computeTimeStepping(const double prev_dt, double& t,
...
@@ -311,6 +311,7 @@ double TimeLoop::computeTimeStepping(const double prev_dt, double& t,
bool
all_process_steps_accepted
=
true
;
bool
all_process_steps_accepted
=
true
;
// Get minimum time step size among step sizes of all processes.
// Get minimum time step size among step sizes of all processes.
double
dt
=
std
::
numeric_limits
<
double
>::
max
();
double
dt
=
std
::
numeric_limits
<
double
>::
max
();
constexpr
double
eps
=
std
::
numeric_limits
<
double
>::
epsilon
();
bool
const
is_initial_step
=
std
::
any_of
(
bool
const
is_initial_step
=
std
::
any_of
(
_per_process_data
.
begin
(),
_per_process_data
.
end
(),
_per_process_data
.
begin
(),
_per_process_data
.
end
(),
...
@@ -364,8 +365,7 @@ double TimeLoop::computeTimeStepping(const double prev_dt, double& t,
...
@@ -364,8 +365,7 @@ double TimeLoop::computeTimeStepping(const double prev_dt, double& t,
// In case of FixedTimeStepping, which makes
// In case of FixedTimeStepping, which makes
// timestep_algorithm->next(...) return false when the ending time
// timestep_algorithm->next(...) return false when the ending time
// is reached.
// is reached.
t
+
std
::
numeric_limits
<
double
>::
epsilon
()
<
t
+
eps
<
timestep_algorithm
->
end
())
timestep_algorithm
->
end
())
{
{
// Not all processes have accepted steps.
// Not all processes have accepted steps.
all_process_steps_accepted
=
false
;
all_process_steps_accepted
=
false
;
...
@@ -379,9 +379,8 @@ double TimeLoop::computeTimeStepping(const double prev_dt, double& t,
...
@@ -379,9 +379,8 @@ double TimeLoop::computeTimeStepping(const double prev_dt, double& t,
all_process_steps_accepted
=
false
;
all_process_steps_accepted
=
false
;
}
}
if
(
timestepper_dt
>
std
::
numeric_limits
<
double
>::
epsilon
()
||
if
(
timestepper_dt
>
eps
||
std
::
abs
(
t
-
timestep_algorithm
->
end
())
<
std
::
abs
(
t
-
timestep_algorithm
->
end
())
<
eps
)
std
::
numeric_limits
<
double
>::
epsilon
())
{
{
dt
=
std
::
min
(
timestepper_dt
,
dt
);
dt
=
std
::
min
(
timestepper_dt
,
dt
);
}
}
...
@@ -405,8 +404,7 @@ double TimeLoop::computeTimeStepping(const double prev_dt, double& t,
...
@@ -405,8 +404,7 @@ double TimeLoop::computeTimeStepping(const double prev_dt, double& t,
}
}
else
else
{
{
if
(
t
<
_end_time
||
std
::
abs
(
t
-
_end_time
)
<
if
(
t
<
_end_time
||
std
::
abs
(
t
-
_end_time
)
<
eps
)
std
::
numeric_limits
<
double
>::
epsilon
())
{
{
t
-=
prev_dt
;
t
-=
prev_dt
;
rejected_steps
++
;
rejected_steps
++
;
...
@@ -424,7 +422,7 @@ double TimeLoop::computeTimeStepping(const double prev_dt, double& t,
...
@@ -424,7 +422,7 @@ double TimeLoop::computeTimeStepping(const double prev_dt, double& t,
dt
=
NumLib
::
possiblyClampDtToNextFixedTime
(
t
,
dt
,
dt
=
NumLib
::
possiblyClampDtToNextFixedTime
(
t
,
dt
,
_output
->
getFixedOutputTimes
());
_output
->
getFixedOutputTimes
());
// Check whether the time stepping is stabilized
// Check whether the time stepping is stabilized
if
(
std
::
abs
(
dt
-
prev_dt
)
<
std
::
numeric_limits
<
double
>::
epsilon
()
)
if
(
std
::
abs
(
dt
-
prev_dt
)
<
eps
)
{
{
if
(
_last_step_rejected
)
if
(
_last_step_rejected
)
{
{
...
@@ -466,8 +464,7 @@ double TimeLoop::computeTimeStepping(const double prev_dt, double& t,
...
@@ -466,8 +464,7 @@ double TimeLoop::computeTimeStepping(const double prev_dt, double& t,
}
}
else
else
{
{
if
(
t
<
_end_time
||
std
::
abs
(
t
-
_end_time
)
<
if
(
t
<
_end_time
||
std
::
abs
(
t
-
_end_time
)
<
eps
)
std
::
numeric_limits
<
double
>::
epsilon
())
{
{
WARN
(
WARN
(
"Time step {:d} was rejected {:d} times and it will be "
"Time step {:d} was rejected {:d} times and it will be "
...
...
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