mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -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:
@@ -52,6 +52,8 @@
|
|||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
|
std::optional<std::function<std::vector<int> (const Dune::CpGrid&)>> externalLoadBalancer;
|
||||||
|
|
||||||
template<class ElementMapper, class GridView, class Scalar>
|
template<class ElementMapper, class GridView, class Scalar>
|
||||||
EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::EclGenericCpGridVanguard()
|
EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::EclGenericCpGridVanguard()
|
||||||
{
|
{
|
||||||
@@ -102,7 +104,7 @@ void EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::doLoadBalance_(Dun
|
|||||||
const auto& gridView = grid_->leafGridView();
|
const auto& gridView = grid_->leafGridView();
|
||||||
unsigned numFaces = grid_->numFaces();
|
unsigned numFaces = grid_->numFaces();
|
||||||
std::vector<double> faceTrans;
|
std::vector<double> faceTrans;
|
||||||
int loadBalancerSet = externalLoadBalancer_.has_value();
|
int loadBalancerSet = externalLoadBalancer.has_value();
|
||||||
grid_->comm().broadcast(&loadBalancerSet, 1, 0);
|
grid_->comm().broadcast(&loadBalancerSet, 1, 0);
|
||||||
if (!loadBalancerSet){
|
if (!loadBalancerSet){
|
||||||
faceTrans.resize(numFaces, 0.0);
|
faceTrans.resize(numFaces, 0.0);
|
||||||
@@ -150,7 +152,7 @@ void EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::doLoadBalance_(Dun
|
|||||||
std::vector<int> parts;
|
std::vector<int> parts;
|
||||||
if (grid_->comm().rank() == 0)
|
if (grid_->comm().rank() == 0)
|
||||||
{
|
{
|
||||||
parts = (*externalLoadBalancer_)(*grid_);
|
parts = (*externalLoadBalancer)(*grid_);
|
||||||
}
|
}
|
||||||
parallelWells = std::get<1>(grid_->loadBalance(handle, parts, &wells, ownersFirst, false, 1));
|
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;
|
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
|
#if HAVE_DUNE_FEM
|
||||||
template class EclGenericCpGridVanguard<Dune::MultipleCodimMultipleGeomTypeMapper<
|
template class EclGenericCpGridVanguard<Dune::MultipleCodimMultipleGeomTypeMapper<
|
||||||
Dune::GridView<Dune::Fem::GridPart2GridViewTraits<Dune::Fem::AdaptiveLeafGridPart<Dune::CpGrid, Dune::PartitionIteratorType(4), false>>>,
|
Dune::GridView<Dune::Fem::GridPart2GridViewTraits<Dune::Fem::AdaptiveLeafGridPart<Dune::CpGrid, Dune::PartitionIteratorType(4), false>>>,
|
||||||
|
|||||||
@@ -34,6 +34,11 @@
|
|||||||
|
|
||||||
namespace Opm {
|
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>
|
template<class ElementMapper, class GridView, class Scalar>
|
||||||
class EclGenericCpGridVanguard {
|
class EclGenericCpGridVanguard {
|
||||||
protected:
|
protected:
|
||||||
@@ -82,7 +87,7 @@ public:
|
|||||||
/// The information is a vector of integers indication the partition index for each cell id.
|
/// 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)
|
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> cartesianIndexMapper_;
|
||||||
std::unique_ptr<CartesianIndexMapper> equilCartesianIndexMapper_;
|
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;
|
int mpiRank;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user