mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-16 20:24:48 -06:00
changed: make externalLoadBalancer a namespace scoped symbol
clang get confused and claims there's no explicit instantation when it's a template member.
This commit is contained in:
parent
a7507cf544
commit
59d02d42c9
@ -52,6 +52,8 @@
|
||||
|
||||
namespace Opm {
|
||||
|
||||
std::optional<std::function<std::vector<int> (const Dune::CpGrid&)>> externalLoadBalancer;
|
||||
|
||||
template<class ElementMapper, class GridView, class Scalar>
|
||||
EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::EclGenericCpGridVanguard()
|
||||
{
|
||||
@ -102,7 +104,7 @@ void EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::doLoadBalance_(Dun
|
||||
const auto& gridView = grid_->leafGridView();
|
||||
unsigned numFaces = grid_->numFaces();
|
||||
std::vector<double> faceTrans;
|
||||
int loadBalancerSet = externalLoadBalancer_.has_value();
|
||||
int loadBalancerSet = externalLoadBalancer.has_value();
|
||||
grid_->comm().broadcast(&loadBalancerSet, 1, 0);
|
||||
if (!loadBalancerSet){
|
||||
faceTrans.resize(numFaces, 0.0);
|
||||
@ -150,7 +152,7 @@ void EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::doLoadBalance_(Dun
|
||||
std::vector<int> parts;
|
||||
if (grid_->comm().rank() == 0)
|
||||
{
|
||||
parts = (*externalLoadBalancer_)(*grid_);
|
||||
parts = (*externalLoadBalancer)(*grid_);
|
||||
}
|
||||
parallelWells = std::get<1>(grid_->loadBalance(handle, parts, &wells, ownersFirst, false, 1));
|
||||
}
|
||||
@ -367,10 +369,6 @@ Scalar EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::computeCellThick
|
||||
return zz2-zz1;
|
||||
}
|
||||
|
||||
template<class ElementMapper, class GridView, class Scalar>
|
||||
std::optional<std::function<std::vector<int> (const Dune::CpGrid&)>>
|
||||
EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::externalLoadBalancer_;
|
||||
|
||||
#if HAVE_DUNE_FEM
|
||||
template class EclGenericCpGridVanguard<Dune::MultipleCodimMultipleGeomTypeMapper<
|
||||
Dune::GridView<Dune::Fem::GridPart2GridViewTraits<Dune::Fem::AdaptiveLeafGridPart<Dune::CpGrid, Dune::PartitionIteratorType(4), false>>>,
|
||||
|
@ -34,6 +34,11 @@
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/// \brief optional functor returning external load balancing information
|
||||
///
|
||||
/// If it is set then this will be used during loadbalance.
|
||||
extern std::optional<std::function<std::vector<int> (const Dune::CpGrid&)>> externalLoadBalancer;
|
||||
|
||||
template<class ElementMapper, class GridView, class Scalar>
|
||||
class EclGenericCpGridVanguard {
|
||||
protected:
|
||||
@ -82,7 +87,7 @@ public:
|
||||
/// The information is a vector of integers indication the partition index for each cell id.
|
||||
static void setExternalLoadBalancer(const std::function<std::vector<int> (const Dune::CpGrid&)>& loadBalancer)
|
||||
{
|
||||
externalLoadBalancer_ = loadBalancer;
|
||||
externalLoadBalancer = loadBalancer;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -131,10 +136,6 @@ protected:
|
||||
std::unique_ptr<CartesianIndexMapper> cartesianIndexMapper_;
|
||||
std::unique_ptr<CartesianIndexMapper> equilCartesianIndexMapper_;
|
||||
|
||||
/// \brief optional functor returning external load balancing information
|
||||
///
|
||||
/// If it is set then this will be used during loadbalance.
|
||||
static std::optional<std::function<std::vector<int> (const Dune::CpGrid&)>> externalLoadBalancer_;
|
||||
int mpiRank;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user