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 ...@@ -36,12 +36,14 @@ namespace AMDiS
* Takes a grid as argument. Marking of the grid needs to be performed prior to calling this. * 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. * Returns true if the grid changed during adaptation.
**/ **/
template <class Grid> template <class Grid, class ...Bases>
static bool adapt(Grid& grid) static bool adapt(Grid& grid, Bases&... bases)
{ {
auto gridTransfer = GridTransferManager::gridTransfer(grid); auto gridTransfer = GridTransferManager::gridTransfer(grid);
bool adapted = gridTransfer.preAdapt(); bool adapted = gridTransfer.preAdapt();
adapted |= gridTransfer.adapt(); adapted |= gridTransfer.adapt();
// call basis.update(basis.gridView()) on all bases
(void)std::initializer_list<int>({0, (bases.update(bases.gridView()),0)...});
gridTransfer.postAdapt(); gridTransfer.postAdapt();
return adapted; return adapted;
} }
......
...@@ -365,8 +365,7 @@ globalCoarsen(int n) ...@@ -365,8 +365,7 @@ globalCoarsen(int n)
for (const auto& element : elements(grid_->leafGridView())) for (const auto& element : elements(grid_->leafGridView()))
grid_->mark(-1, element); grid_->mark(-1, element);
adapted |= GridTransferManager::adapt(*grid_); adapted |= GridTransferManager::adapt(*grid_, *globalBasis_);
globalBasis_->update(gridView());
} }
msg("globalCoarsen needed {} seconds", t.elapsed()); msg("globalCoarsen needed {} seconds", t.elapsed());
...@@ -386,6 +385,7 @@ globalRefine(int refCount) ...@@ -386,6 +385,7 @@ globalRefine(int refCount)
bool adapted = false; bool adapted = false;
Dune::Hybrid::ifElse(Dune::Std::is_detected<HasGlobalRefineADHI, Grid>{}, Dune::Hybrid::ifElse(Dune::Std::is_detected<HasGlobalRefineADHI, Grid>{},
/*then*/ [&](auto id) { /*then*/ [&](auto id) {
// TODO(FM): Add a way to pass a GridTransfer as ADH with *globalBasis_ argument
id(grid_)->globalRefine(refCount, GridTransferManager::gridTransfer(*grid_)); id(grid_)->globalRefine(refCount, GridTransferManager::gridTransfer(*grid_));
globalBasis_->update(this->gridView()); globalBasis_->update(this->gridView());
}, },
...@@ -395,8 +395,7 @@ globalRefine(int refCount) ...@@ -395,8 +395,7 @@ globalRefine(int refCount)
for (const auto& element : elements(grid_->leafGridView())) for (const auto& element : elements(grid_->leafGridView()))
grid_->mark(1, element); grid_->mark(1, element);
adapted |= GridTransferManager::adapt(*id(grid_)); adapted |= GridTransferManager::adapt(*id(grid_), *id(globalBasis_));
globalBasis_->update(this->gridView());
} }
}); });
...@@ -411,8 +410,7 @@ adaptGrid(AdaptInfo& adaptInfo) ...@@ -411,8 +410,7 @@ adaptGrid(AdaptInfo& adaptInfo)
{ {
Dune::Timer t; Dune::Timer t;
bool adapted = GridTransferManager::adapt(*grid_); bool adapted = GridTransferManager::adapt(*grid_, *globalBasis_);
globalBasis_->update(gridView());
msg("adaptGrid needed {} seconds", t.elapsed()); msg("adaptGrid needed {} seconds", t.elapsed());
return adapted ? MESH_ADAPTED : Flag(0); return adapted ? MESH_ADAPTED : Flag(0);
......
...@@ -74,7 +74,7 @@ int main(int argc, char** argv) ...@@ -74,7 +74,7 @@ int main(int argc, char** argv)
test_dofvector(basis, vec1); test_dofvector(basis, vec1);
for (auto const& e : elements(gridView)) for (auto const& e : elements(gridView))
grid.mark(1, e); grid.mark(1, e);
GridTransferManager::adapt(grid); GridTransferManager::adapt(grid, basis);
AMDIS_TEST_EQ(vec1.size(), basis.dimension()); 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