EclProblem: use of alugrid is known at compile time

use the proper define, no need for type gymnastics
This commit is contained in:
Arne Morten Kvarving 2022-11-14 15:10:03 +01:00
parent 73b6c9fdf8
commit 4bbb9656b0

View File

@ -888,15 +888,11 @@ public:
// Re-ordering in case of ALUGrid
std::function<unsigned int(unsigned int)> gridToEquilGrid;
#ifdef HAVE_DUNE_ALUGRID
using Grid = GetPropType<TypeTag, Properties::Grid>;
typename std::is_same<Grid, Dune::ALUGrid<3, 3, Dune::cube, Dune::nonconforming>>::type isAlugrid;
if constexpr (isAlugrid) {
gridToEquilGrid = [&simulator](unsigned int i) {
return simulator.vanguard().gridIdxToEquilGridIdx(i);
};
}
#endif // HAVE_DUNE_ALUGRID
#if USE_ALUGRID
gridToEquilGrid = [&simulator](unsigned int i) {
return simulator.vanguard().gridIdxToEquilGridIdx(i);
};
#endif // USE_ALUGRID
transmissibilities_.finishInit(gridToEquilGrid);
const auto& initconfig = eclState.getInitConfig();
@ -973,13 +969,11 @@ public:
// Re-ordering in case of ALUGrid
std::function<unsigned int(unsigned int)> equilGridToGrid;
#ifdef HAVE_DUNE_ALUGRID
if (isAlugrid) {
equilGridToGrid = [&simulator](unsigned int i) {
return simulator.vanguard().gridEquilIdxToGridIdx(i);
};
}
#endif // HAVE_DUNE_ALUGRID
#if USE_ALUGRID
equilGridToGrid = [&simulator](unsigned int i) {
return simulator.vanguard().gridEquilIdxToGridIdx(i);
};
#endif // USE_ALUGRID
eclWriter_->writeInit(equilGridToGrid);
}
@ -1068,16 +1062,11 @@ public:
// Re-ordering in case of ALUGrid
std::function<unsigned int(unsigned int)> equilGridToGrid;
#ifdef HAVE_DUNE_ALUGRID
using Grid = GetPropType<TypeTag, Properties::Grid>;
typename std::is_same<Grid, Dune::ALUGrid<3, 3, Dune::cube,
Dune::nonconforming>>::type isAlugrid;
if constexpr (isAlugrid) {
equilGridToGrid = [&simulator](unsigned int i) {
return simulator.vanguard().gridEquilIdxToGridIdx(i);
};
}
#endif // HAVE_DUNE_ALUGRID
#if USE_ALUGRID
equilGridToGrid = [&simulator](unsigned int i) {
return simulator.vanguard().gridEquilIdxToGridIdx(i);
};
#endif // USE_ALUGRID
// re-compute all quantities which may possibly be affected.
transmissibilities_.update(true, equilGridToGrid);
@ -1219,15 +1208,11 @@ public:
// Re-ordering in case of Alugrid
std::function<unsigned int(unsigned int)> gridToEquilGrid;
#ifdef HAVE_DUNE_ALUGRID
using Grid = GetPropType<TypeTag, Properties::Grid>;
typename std::is_same<Grid, Dune::ALUGrid<3, 3, Dune::cube, Dune::nonconforming>>::type isAlugrid;
if constexpr (isAlugrid) {
gridToEquilGrid = [&simulator](unsigned int i) {
return simulator.vanguard().gridIdxToEquilGridIdx(i);
};
}
#endif // HAVE_DUNE_ALUGRID
#if USE_ALUGRID
gridToEquilGrid = [&simulator](unsigned int i) {
return simulator.vanguard().gridIdxToEquilGridIdx(i);
};
#endif // USE_ALUGRID
std::function<void(bool)> transUp =
[this,gridToEquilGrid](bool global) {