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
Chaofan Chen
ogs
Commits
c8df5cd0
Commit
c8df5cd0
authored
2 years ago
by
Christoph Lehmann
Committed by
Dmitri Naumov
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[PL] Make extrapolator via non-member function ip data access
parent
b4af3789
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
ProcessLib/Output/SecondaryVariable.h
+60
-4
60 additions, 4 deletions
ProcessLib/Output/SecondaryVariable.h
with
60 additions
and
4 deletions
ProcessLib/Output/SecondaryVariable.h
+
60
−
4
View file @
c8df5cd0
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#include
"BaseLib/Algorithm.h"
#include
"BaseLib/Algorithm.h"
#include
"NumLib/Extrapolation/ExtrapolatableElementCollection.h"
#include
"NumLib/Extrapolation/ExtrapolatableElementCollection.h"
#include
"NumLib/Extrapolation/Extrapolator.h"
#include
"NumLib/Extrapolation/Extrapolator.h"
#include
"ProcessLib/Utils/TransposeInPlace.h"
namespace
NumLib
namespace
NumLib
{
{
...
@@ -174,8 +175,9 @@ SecondaryVariableFunctions makeExtrapolator(
...
@@ -174,8 +175,9 @@ SecondaryVariableFunctions makeExtrapolator(
const
double
t
,
const
double
t
,
std
::
vector
<
GlobalVector
*>
const
&
x
,
std
::
vector
<
GlobalVector
*>
const
&
x
,
std
::
vector
<
NumLib
::
LocalToGlobalIndexMap
const
*>
const
&
dof_table
,
std
::
vector
<
NumLib
::
LocalToGlobalIndexMap
const
*>
const
&
dof_table
,
std
::
unique_ptr
<
GlobalVector
>
&
/*result_cache*/
std
::
unique_ptr
<
GlobalVector
>&
/*result_cache*/
)
->
GlobalVector
const
&
{
)
->
GlobalVector
const
&
{
auto
const
extrapolatables
=
NumLib
::
makeExtrapolatable
(
auto
const
extrapolatables
=
NumLib
::
makeExtrapolatable
(
local_assemblers
,
integration_point_values_method
);
local_assemblers
,
integration_point_values_method
);
extrapolator
.
extrapolate
(
num_components
,
extrapolatables
,
t
,
x
,
extrapolator
.
extrapolate
(
num_components
,
extrapolatables
,
t
,
x
,
...
@@ -189,8 +191,9 @@ SecondaryVariableFunctions makeExtrapolator(
...
@@ -189,8 +191,9 @@ SecondaryVariableFunctions makeExtrapolator(
const
double
t
,
const
double
t
,
std
::
vector
<
GlobalVector
*>
const
&
x
,
std
::
vector
<
GlobalVector
*>
const
&
x
,
std
::
vector
<
NumLib
::
LocalToGlobalIndexMap
const
*>
const
&
dof_table
,
std
::
vector
<
NumLib
::
LocalToGlobalIndexMap
const
*>
const
&
dof_table
,
std
::
unique_ptr
<
GlobalVector
>
&
/*result_cache*/
std
::
unique_ptr
<
GlobalVector
>&
/*result_cache*/
)
->
GlobalVector
const
&
{
)
->
GlobalVector
const
&
{
auto
const
extrapolatables
=
NumLib
::
makeExtrapolatable
(
auto
const
extrapolatables
=
NumLib
::
makeExtrapolatable
(
local_assemblers
,
integration_point_values_method
);
local_assemblers
,
integration_point_values_method
);
extrapolator
.
calculateResiduals
(
num_components
,
extrapolatables
,
t
,
x
,
extrapolator
.
calculateResiduals
(
num_components
,
extrapolatables
,
t
,
x
,
...
@@ -200,4 +203,57 @@ SecondaryVariableFunctions makeExtrapolator(
...
@@ -200,4 +203,57 @@ SecondaryVariableFunctions makeExtrapolator(
return
{
num_components
,
eval_field
,
eval_residuals
};
return
{
num_components
,
eval_field
,
eval_residuals
};
}
}
//! A variant that takes an \c accessor function as a callback.
//!
//! The \c accessor must take a local assembler by const reference as its only
//! argument and must return a <tt>std::vector\<double\></tt> of integration
//! point data. The data returned by the accessor must be in "integration point
//! writer order", which is transposed compared to "extrapolator order".
template
<
typename
LocalAssemblerCollection
,
typename
IPDataAccessor
>
SecondaryVariableFunctions
makeExtrapolator2
(
const
unsigned
num_components
,
NumLib
::
Extrapolator
&
extrapolator
,
LocalAssemblerCollection
const
&
local_assemblers
,
IPDataAccessor
&&
accessor
)
{
using
LocalAssemblerInterface
=
std
::
remove_cvref_t
<
decltype
(
*
std
::
declval
<
LocalAssemblerCollection
>
()[
0
])
>
;
static_assert
(
std
::
is_invocable_r_v
<
std
::
vector
<
double
>
,
IPDataAccessor
,
LocalAssemblerInterface
const
&>
);
if
(
num_components
==
1
)
{
auto
method_wrapped
=
[
accessor
](
LocalAssemblerInterface
const
&
loc_asm
,
const
double
/*t*/
,
std
::
vector
<
GlobalVector
*>
const
&
/*x*/
,
std
::
vector
<
NumLib
::
LocalToGlobalIndexMap
const
*>
const
&
/*dof_table*/
,
std
::
vector
<
double
>&
cache
)
->
std
::
vector
<
double
>
const
&
{
cache
=
accessor
(
loc_asm
);
return
cache
;
};
return
makeExtrapolator
(
num_components
,
extrapolator
,
local_assemblers
,
method_wrapped
);
}
auto
method_wrapped
=
[
accessor
,
num_components
](
LocalAssemblerInterface
const
&
loc_asm
,
const
double
/*t*/
,
std
::
vector
<
GlobalVector
*>
const
&
/*x*/
,
std
::
vector
<
NumLib
::
LocalToGlobalIndexMap
const
*>
const
&
/*dof_table*/
,
std
::
vector
<
double
>&
cache
)
->
std
::
vector
<
double
>
const
&
{
cache
=
accessor
(
loc_asm
);
transposeInPlace
(
cache
,
cache
.
size
()
/
num_components
);
return
cache
;
};
return
makeExtrapolator
(
num_components
,
extrapolator
,
local_assemblers
,
method_wrapped
);
}
}
// namespace ProcessLib
}
// namespace ProcessLib
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