Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynamic
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
MostafaMollaali
dynamic
Commits
6e30afcf
Commit
6e30afcf
authored
5 years ago
by
Dmitri Naumov
Browse files
Options
Downloads
Patches
Plain Diff
[PL] Replace easyBind with lambdas.
parent
de521a3d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ProcessLib/SmallDeformation/SmallDeformationProcess.cpp
+18
-21
18 additions, 21 deletions
ProcessLib/SmallDeformation/SmallDeformationProcess.cpp
ProcessLib/TES/TESProcess.cpp
+15
-7
15 additions, 7 deletions
ProcessLib/TES/TESProcess.cpp
with
33 additions
and
28 deletions
ProcessLib/SmallDeformation/SmallDeformationProcess.cpp
+
18
−
21
View file @
6e30afcf
...
@@ -13,7 +13,6 @@
...
@@ -13,7 +13,6 @@
#include
<cassert>
#include
<cassert>
#include
<nlohmann/json.hpp>
#include
<nlohmann/json.hpp>
#include
"BaseLib/Functional.h"
#include
"ProcessLib/Output/IntegrationPointWriter.h"
#include
"ProcessLib/Output/IntegrationPointWriter.h"
#include
"ProcessLib/Process.h"
#include
"ProcessLib/Process.h"
#include
"ProcessLib/SmallDeformation/CreateLocalAssemblers.h"
#include
"ProcessLib/SmallDeformation/CreateLocalAssemblers.h"
...
@@ -143,38 +142,36 @@ void SmallDeformationProcess<DisplacementDim>::initializeConcreteProcess(
...
@@ -143,38 +142,36 @@ void SmallDeformationProcess<DisplacementDim>::initializeConcreteProcess(
auto
const
num_components
=
internal_variable
.
num_components
;
auto
const
num_components
=
internal_variable
.
num_components
;
DBUG
(
"Registering internal variable %s."
,
name
.
c_str
());
DBUG
(
"Registering internal variable %s."
,
name
.
c_str
());
auto
getIntPtValues
=
BaseLib
::
easyBind
(
auto
getIntPtValues
=
[
fct
,
num_components
](
[
fct
,
num_components
](
LocalAssemblerInterface
const
&
loc_asm
,
LocalAssemblerInterface
const
&
loc_asm
,
const
double
/*t*/
,
const
double
/*t*/
,
GlobalVector
const
&
/*current_solution*/
,
GlobalVector
const
&
/*current_solution*/
,
NumLib
::
LocalToGlobalIndexMap
const
&
/*dof_table*/
,
NumLib
::
LocalToGlobalIndexMap
const
&
/*dof_table*/
,
std
::
vector
<
double
>&
cache
)
->
std
::
vector
<
double
>
const
&
{
std
::
vector
<
double
>&
cache
)
->
std
::
vector
<
double
>
const
&
{
const
unsigned
num_int_pts
=
const
unsigned
num_int_pts
=
loc_asm
.
getNumberOfIntegrationPoints
();
loc_asm
.
getNumberOfIntegrationPoints
();
cache
.
clear
();
cache
.
clear
();
auto
cache_mat
=
MathLib
::
createZeroedMatrix
<
Eigen
::
Matrix
<
auto
cache_mat
=
MathLib
::
createZeroedMatrix
<
Eigen
::
Matrix
<
double
,
Eigen
::
Dynamic
,
Eigen
::
Dynamic
,
Eigen
::
RowMajor
>>
(
double
,
Eigen
::
Dynamic
,
Eigen
::
Dynamic
,
Eigen
::
RowMajor
>>
(
cache
,
num_components
,
num_int_pts
);
cache
,
num_components
,
num_int_pts
);
// TODO avoid the heap allocation (one per finite element)
// TODO avoid the heap allocation (one per finite element)
std
::
vector
<
double
>
cache_column
(
num_int_pts
);
std
::
vector
<
double
>
cache_column
(
num_int_pts
);
for
(
unsigned
i
=
0
;
i
<
num_int_pts
;
++
i
)
for
(
unsigned
i
=
0
;
i
<
num_int_pts
;
++
i
)
{
{
auto
const
&
state
=
loc_asm
.
getMaterialStateVariablesAt
(
i
);
auto
const
&
state
=
loc_asm
.
getMaterialStateVariablesAt
(
i
);
auto
const
&
int_pt_values
=
fct
(
state
,
cache_column
);
auto
const
&
int_pt_values
=
fct
(
state
,
cache_column
);
assert
(
int_pt_values
.
size
()
==
num_components
);
assert
(
int_pt_values
.
size
()
==
num_components
);
auto
const
int_pt_values_vec
=
auto
const
int_pt_values_vec
=
MathLib
::
toVector
(
int_pt_values
);
MathLib
::
toVector
(
int_pt_values
);
cache_mat
.
col
(
i
).
noalias
()
=
int_pt_values_vec
;
cache_mat
.
col
(
i
).
noalias
()
=
int_pt_values_vec
;
}
}
return
cache
;
return
cache
;
})
;
}
;
_secondary_variables
.
addSecondaryVariable
(
_secondary_variables
.
addSecondaryVariable
(
name
,
name
,
...
...
This diff is collapsed.
Click to expand it.
ProcessLib/TES/TESProcess.cpp
+
15
−
7
View file @
6e30afcf
...
@@ -9,7 +9,6 @@
...
@@ -9,7 +9,6 @@
*/
*/
#include
"TESProcess.h"
#include
"TESProcess.h"
#include
"BaseLib/Functional.h"
#include
"NumLib/DOF/DOFTableUtil.h"
#include
"NumLib/DOF/DOFTableUtil.h"
#include
"ProcessLib/Utils/CreateLocalAssemblers.h"
#include
"ProcessLib/Utils/CreateLocalAssemblers.h"
...
@@ -189,15 +188,24 @@ void TESProcess::initializeSecondaryVariables()
...
@@ -189,15 +188,24 @@ void TESProcess::initializeSecondaryVariables()
"reaction_damping_factor"
,
"reaction_damping_factor"
,
makeEx
(
1
,
&
TESLocalAssemblerInterface
::
getIntPtReactionDampingFactor
));
makeEx
(
1
,
&
TESLocalAssemblerInterface
::
getIntPtReactionDampingFactor
));
add2nd
(
add2nd
(
"vapour_partial_pressure"
,
"vapour_partial_pressure"
,
{
1
,
{
1
,
BaseLib
::
easyBind
(
&
TESProcess
::
computeVapourPartialPressure
,
this
),
[
&
](
auto
&&
...
args
)
->
GlobalVector
const
&
{
nullptr
});
return
computeVapourPartialPressure
(
args
...);
},
nullptr
});
namespace
PH
=
std
::
placeholders
;
add2nd
(
"relative_humidity"
,
add2nd
(
"relative_humidity"
,
{
1
,
BaseLib
::
easyBind
(
&
TESProcess
::
computeRelativeHumidity
,
this
),
{
1
,
[
&
](
auto
&&
...
args
)
->
GlobalVector
const
&
{
return
computeRelativeHumidity
(
args
...);
},
nullptr
});
nullptr
});
add2nd
(
"equilibrium_loading"
,
add2nd
(
"equilibrium_loading"
,
{
1
,
BaseLib
::
easyBind
(
&
TESProcess
::
computeEquilibriumLoading
,
this
),
{
1
,
[
&
](
auto
&&
...
args
)
->
GlobalVector
const
&
{
return
computeEquilibriumLoading
(
args
...);
},
nullptr
});
nullptr
});
}
}
...
...
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