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

[PL] Resolve circular dep. HTBHE<->BC.

Passing the bhe type to the BCs is not necessary, just a callback.
parent b8976eea
No related branches found
No related tags found
No related merge requests found
...@@ -11,18 +11,18 @@ ...@@ -11,18 +11,18 @@
#include "BoundaryCondition.h" #include "BoundaryCondition.h"
#include "NumLib/IndexValueVector.h" #include "NumLib/IndexValueVector.h"
#include "ProcessLib/HeatTransportBHE/BHE/BHETypes.h"
namespace ProcessLib namespace ProcessLib
{ {
template <typename BHEType> template <typename BHEUpdateCallback>
class BHEInflowDirichletBoundaryCondition final : public BoundaryCondition class BHEInflowDirichletBoundaryCondition final : public BoundaryCondition
{ {
public: public:
BHEInflowDirichletBoundaryCondition( BHEInflowDirichletBoundaryCondition(
std::pair<GlobalIndexType, GlobalIndexType>&& in_out_global_indices, std::pair<GlobalIndexType, GlobalIndexType>&& in_out_global_indices,
BHEType& bhe) BHEUpdateCallback bhe_update_callback)
: _in_out_global_indices(std::move(in_out_global_indices)), _bhe(bhe) : _in_out_global_indices(std::move(in_out_global_indices)),
_bhe_update_callback(bhe_update_callback)
{ {
} }
...@@ -36,19 +36,19 @@ public: ...@@ -36,19 +36,19 @@ public:
bc_values.ids[0] = _in_out_global_indices.first; bc_values.ids[0] = _in_out_global_indices.first;
// here call the corresponding BHE functions // here call the corresponding BHE functions
auto const T_out = x[_in_out_global_indices.second]; auto const T_out = x[_in_out_global_indices.second];
bc_values.values[0] = _bhe.updateFlowRateAndTemperature(T_out, t); bc_values.values[0] = _bhe_update_callback(T_out, t);
} }
private: private:
std::pair<GlobalIndexType, GlobalIndexType> const _in_out_global_indices; std::pair<GlobalIndexType, GlobalIndexType> const _in_out_global_indices;
BHEType& _bhe; BHEUpdateCallback _bhe_update_callback;
}; };
template <typename BHEType> template <typename BHEUpdateCallback>
std::unique_ptr<BHEInflowDirichletBoundaryCondition<BHEType>> std::unique_ptr<BHEInflowDirichletBoundaryCondition<BHEUpdateCallback>>
createBHEInflowDirichletBoundaryCondition( createBHEInflowDirichletBoundaryCondition(
std::pair<GlobalIndexType, GlobalIndexType>&& in_out_global_indices, std::pair<GlobalIndexType, GlobalIndexType>&& in_out_global_indices,
BHEType& bhe) BHEUpdateCallback bhe_update_callback)
{ {
DBUG("Constructing BHEInflowDirichletBoundaryCondition."); DBUG("Constructing BHEInflowDirichletBoundaryCondition.");
...@@ -71,7 +71,8 @@ createBHEInflowDirichletBoundaryCondition( ...@@ -71,7 +71,8 @@ createBHEInflowDirichletBoundaryCondition(
} }
#endif // USE_PETSC #endif // USE_PETSC
return std::make_unique<BHEInflowDirichletBoundaryCondition<BHEType>>( return std::make_unique<
std::move(in_out_global_indices), bhe); BHEInflowDirichletBoundaryCondition<BHEUpdateCallback>>(
std::move(in_out_global_indices), bhe_update_callback);
} }
} // namespace ProcessLib } // namespace ProcessLib
...@@ -244,7 +244,9 @@ void HeatTransportBHEProcess::createBHEBoundaryConditionTopBottom( ...@@ -244,7 +244,9 @@ void HeatTransportBHEProcess::createBHEBoundaryConditionTopBottom(
ProcessLib::createBHEInflowDirichletBoundaryCondition( ProcessLib::createBHEInflowDirichletBoundaryCondition(
get_global_bhe_bc_indices(bc_top_node_id, get_global_bhe_bc_indices(bc_top_node_id,
in_out_component_id), in_out_component_id),
bhe)); [&bhe](double const T, double const t) {
return bhe.updateFlowRateAndTemperature(T, t);
}));
// Bottom, outflow. // Bottom, outflow.
bcs.addBoundaryCondition( bcs.addBoundaryCondition(
......
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