Skip to content
Snippets Groups Projects
Commit 6e30afcf authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

[PL] Replace easyBind with lambdas.

parent de521a3d
No related branches found
No related tags found
No related merge requests found
...@@ -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,
......
...@@ -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});
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment