Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Özgür Ozan Sen
ogs
Commits
f6a32cda
Commit
f6a32cda
authored
1 year ago
by
Christoph Lehmann
Committed by
Dmitri Naumov
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
[PL] Changed lambda to separate method
parent
4037b590
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ProcessLib/TimeLoop.cpp
+29
-29
29 additions, 29 deletions
ProcessLib/TimeLoop.cpp
ProcessLib/TimeLoop.h
+2
-0
2 additions, 0 deletions
ProcessLib/TimeLoop.h
with
31 additions
and
29 deletions
ProcessLib/TimeLoop.cpp
+
29
−
29
View file @
f6a32cda
...
@@ -284,40 +284,13 @@ std::pair<double, bool> TimeLoop::computeTimeStepping(
...
@@ -284,40 +284,13 @@ std::pair<double, bool> TimeLoop::computeTimeStepping(
[](
auto
const
&
ppd
)
->
bool
[](
auto
const
&
ppd
)
->
bool
{
return
ppd
->
timestep_current
.
timeStepNumber
()
==
0
;
});
{
return
ppd
->
timestep_current
.
timeStepNumber
()
==
0
;
});
auto
computeSolutionError
=
[
this
,
t
](
auto
const
i
)
->
double
{
auto
const
&
ppd
=
*
_per_process_data
[
i
];
const
auto
&
timestep_algorithm
=
ppd
.
timestep_algorithm
;
if
(
!
timestep_algorithm
->
isSolutionErrorComputationNeeded
())
{
return
0.0
;
}
if
(
t
==
timestep_algorithm
->
begin
())
{
// Always accepts the zeroth step
return
0.0
;
}
auto
const
&
x
=
*
_process_solutions
[
i
];
auto
const
&
x_prev
=
*
_process_solutions_prev
[
i
];
auto
const
&
conv_crit
=
ppd
.
conv_crit
;
const
MathLib
::
VecNormType
norm_type
=
(
conv_crit
)
?
conv_crit
->
getVectorNormType
()
:
MathLib
::
VecNormType
::
NORM2
;
const
double
solution_error
=
NumLib
::
computeRelativeChangeFromPreviousTimestep
(
x
,
x_prev
,
norm_type
);
return
solution_error
;
};
for
(
std
::
size_t
i
=
0
;
i
<
_per_process_data
.
size
();
i
++
)
for
(
std
::
size_t
i
=
0
;
i
<
_per_process_data
.
size
();
i
++
)
{
{
auto
&
ppd
=
*
_per_process_data
[
i
];
auto
&
ppd
=
*
_per_process_data
[
i
];
const
auto
&
timestep_algorithm
=
ppd
.
timestep_algorithm
;
const
auto
&
timestep_algorithm
=
ppd
.
timestep_algorithm
;
const
double
solution_error
=
computeSolutionError
(
i
);
const
double
solution_error
=
computeRelativeSolutionChangeFromPreviousTimestep
(
t
,
i
);
ppd
.
timestep_current
.
setAccepted
(
ppd
.
timestep_current
.
setAccepted
(
ppd
.
nonlinear_solver_status
.
error_norms_met
);
ppd
.
nonlinear_solver_status
.
error_norms_met
);
...
@@ -903,4 +876,31 @@ TimeLoop::~TimeLoop()
...
@@ -903,4 +876,31 @@ TimeLoop::~TimeLoop()
}
}
}
}
double
TimeLoop
::
computeRelativeSolutionChangeFromPreviousTimestep
(
double
const
t
,
std
::
size_t
process_index
)
const
{
auto
const
&
ppd
=
*
_per_process_data
[
process_index
];
const
auto
&
timestep_algorithm
=
ppd
.
timestep_algorithm
;
if
(
!
timestep_algorithm
->
isSolutionErrorComputationNeeded
())
{
return
0.0
;
}
if
(
t
==
timestep_algorithm
->
begin
())
{
// Always accepts the zeroth step
return
0.0
;
}
auto
const
&
x
=
*
_process_solutions
[
process_index
];
auto
const
&
x_prev
=
*
_process_solutions_prev
[
process_index
];
auto
const
&
conv_crit
=
ppd
.
conv_crit
;
const
MathLib
::
VecNormType
norm_type
=
(
conv_crit
)
?
conv_crit
->
getVectorNormType
()
:
MathLib
::
VecNormType
::
NORM2
;
const
double
solution_error
=
NumLib
::
computeRelativeChangeFromPreviousTimestep
(
x
,
x_prev
,
norm_type
);
return
solution_error
;
};
}
// namespace ProcessLib
}
// namespace ProcessLib
This diff is collapsed.
Click to expand it.
ProcessLib/TimeLoop.h
+
2
−
0
View file @
f6a32cda
...
@@ -131,6 +131,8 @@ private:
...
@@ -131,6 +131,8 @@ private:
private
:
private
:
std
::
vector
<
std
::
function
<
double
(
double
,
double
)
>>
std
::
vector
<
std
::
function
<
double
(
double
,
double
)
>>
generateOutputTimeStepConstraints
(
std
::
vector
<
double
>&&
fixed_times
)
const
;
generateOutputTimeStepConstraints
(
std
::
vector
<
double
>&&
fixed_times
)
const
;
double
computeRelativeSolutionChangeFromPreviousTimestep
(
double
const
t
,
std
::
size_t
process_index
)
const
;
std
::
vector
<
GlobalVector
*>
_process_solutions
;
std
::
vector
<
GlobalVector
*>
_process_solutions
;
std
::
vector
<
GlobalVector
*>
_process_solutions_prev
;
std
::
vector
<
GlobalVector
*>
_process_solutions_prev
;
std
::
vector
<
Output
>
_outputs
;
std
::
vector
<
Output
>
_outputs
;
...
...
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