Commit db7e5135 authored by Praetorius, Simon's avatar Praetorius, Simon

Merge branch 'issue/gridtransfer_basis_update' into 'develop'

Move calls to basis.update inbetween adapt and postAdapt calls

See merge request !81
parents 42a8634f 036d7618
Pipeline #1734 passed with stage
in 29 minutes and 52 seconds
......@@ -36,12 +36,14 @@ namespace AMDiS
* Takes a grid as argument. Marking of the grid needs to be performed prior to calling this.
* Returns true if the grid changed during adaptation.
**/
template <class Grid>
static bool adapt(Grid& grid)
template <class Grid, class ...Bases>
static bool adapt(Grid& grid, Bases&... bases)
{
auto gridTransfer = GridTransferManager::gridTransfer(grid);
bool adapted = gridTransfer.preAdapt();
adapted |= gridTransfer.adapt();
// call basis.update(basis.gridView()) on all bases
(void)std::initializer_list<int>({0, (bases.update(bases.gridView()),0)...});
gridTransfer.postAdapt();
return adapted;
}
......
......@@ -365,8 +365,7 @@ globalCoarsen(int n)
for (const auto& element : elements(grid_->leafGridView()))
grid_->mark(-1, element);
adapted |= GridTransferManager::adapt(*grid_);
globalBasis_->update(gridView());
adapted |= GridTransferManager::adapt(*grid_, *globalBasis_);
}
msg("globalCoarsen needed {} seconds", t.elapsed());
......@@ -386,6 +385,7 @@ globalRefine(int refCount)
bool adapted = false;
Dune::Hybrid::ifElse(Dune::Std::is_detected<HasGlobalRefineADHI, Grid>{},
/*then*/ [&](auto id) {
// TODO(FM): Add a way to pass a GridTransfer as ADH with *globalBasis_ argument
id(grid_)->globalRefine(refCount, GridTransferManager::gridTransfer(*grid_));
globalBasis_->update(this->gridView());
},
......@@ -395,8 +395,7 @@ globalRefine(int refCount)
for (const auto& element : elements(grid_->leafGridView()))
grid_->mark(1, element);
adapted |= GridTransferManager::adapt(*id(grid_));
globalBasis_->update(this->gridView());
adapted |= GridTransferManager::adapt(*id(grid_), *id(globalBasis_));
}
});
......@@ -411,8 +410,7 @@ adaptGrid(AdaptInfo& adaptInfo)
{
Dune::Timer t;
bool adapted = GridTransferManager::adapt(*grid_);
globalBasis_->update(gridView());
bool adapted = GridTransferManager::adapt(*grid_, *globalBasis_);
msg("adaptGrid needed {} seconds", t.elapsed());
return adapted ? MESH_ADAPTED : Flag(0);
......
......@@ -74,7 +74,7 @@ int main(int argc, char** argv)
test_dofvector(basis, vec1);
for (auto const& e : elements(gridView))
grid.mark(1, e);
GridTransferManager::adapt(grid);
GridTransferManager::adapt(grid, basis);
AMDIS_TEST_EQ(vec1.size(), basis.dimension());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment