Liebe Gitlab-Nutzer, lieber Gitlab-Nutzer,
es ist nun möglich sich mittels des ZIH-Logins/LDAP an unserem Dienst anzumelden. Die Konten der externen Nutzer:innen sind über den Reiter "Standard" erreichbar.
Die Administratoren


Dear Gitlab user,
it is now possible to log in to our service using the ZIH login/LDAP. The accounts of external users can be accessed via the "Standard" tab.
The administrators

Commit b661c013 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

add function globalRefine and globalCoarsen to ProblemStat

parent 32e77c49
...@@ -58,6 +58,18 @@ namespace AMDiS ...@@ -58,6 +58,18 @@ namespace AMDiS
return 0; return 0;
} }
/// Implementation of \ref ProblemStatBase::globalCoarsen().
virtual Flag globalCoarsen(int n) override
{
return 0;
}
/// Implementation of \ref ProblemStatBase::globalRefine().
virtual Flag globalRefine(int n) override
{
return 0;
}
/// Implementation of \ref ProblemTimeInterface::closeTimestep(). /// Implementation of \ref ProblemTimeInterface::closeTimestep().
virtual void closeTimestep(AdaptInfo&) override { /* do nothing */ } virtual void closeTimestep(AdaptInfo&) override { /* do nothing */ }
......
...@@ -429,6 +429,11 @@ namespace AMDiS ...@@ -429,6 +429,11 @@ namespace AMDiS
/// Implementation of \ref ProblemStatBase::markElements. /// Implementation of \ref ProblemStatBase::markElements.
virtual Flag markElements(AdaptInfo& adaptInfo) override; virtual Flag markElements(AdaptInfo& adaptInfo) override;
/// Uniform global grid coarsening by up to n level
virtual Flag globalCoarsen(int n) override;
/// Uniform global refinement by n level
virtual Flag globalRefine(int n) override;
private: private:
/// Name of this problem. /// Name of this problem.
......
...@@ -354,6 +354,57 @@ markElements(AdaptInfo& adaptInfo) ...@@ -354,6 +354,57 @@ markElements(AdaptInfo& adaptInfo)
} }
template <class Traits>
Flag ProblemStat<Traits>::
globalCoarsen(int n)
{
Dune::Timer t;
bool adapted = false;
for (int i = 0; i < n; ++i) {
// mark all entities for grid refinement
for (const auto& element : elements(grid_->leafGridView()))
grid_->mark(-1, element);
adapted |= GridTransferManager::adapt(*grid_);
globalBasis_->update(gridView());
}
msg("globalCoarsen needed {} seconds", t.elapsed());
return adapted ? MESH_ADAPTED : Flag(0);
}
// grid has globalRefine(int, AdaptDataHandleInterface&)
template <class G>
using HasGlobalRefineADHI = decltype(std::declval<G>().globalRefine(1,std::declval<GridTransfer<G>&>()));
template <class Traits>
Flag ProblemStat<Traits>::
globalRefine(int refCount)
{
Dune::Timer t;
bool adapted = false;
Dune::Hybrid::ifElse(Dune::Std::is_detected<HasGlobalRefineADHI, Grid>{},
/*then*/ [&](auto id) {
id(grid_)->globalRefine(refCount, GridTransferManager::gridTransfer(*grid_));
globalBasis_->update(this->gridView());
},
/*else*/ [&](auto id) {
for (int i = 0; i < refCount; ++i) {
// mark all entities for grid refinement
for (const auto& element : elements(grid_->leafGridView()))
grid_->mark(1, element);
adapted |= GridTransferManager::adapt(*id(grid_));
globalBasis_->update(this->gridView());
}
});
msg("globalRefine needed {} seconds", t.elapsed());
return adapted ? MESH_ADAPTED : Flag(0);
}
template <class Traits> template <class Traits>
Flag ProblemStat<Traits>:: Flag ProblemStat<Traits>::
adaptGrid(AdaptInfo& adaptInfo) adaptGrid(AdaptInfo& adaptInfo)
......
...@@ -74,6 +74,14 @@ namespace AMDiS ...@@ -74,6 +74,14 @@ namespace AMDiS
/// Refinement/coarsening of the grid. /// Refinement/coarsening of the grid.
virtual Flag adaptGrid(AdaptInfo& adaptInfo) = 0; virtual Flag adaptGrid(AdaptInfo& adaptInfo) = 0;
/// Uniform global grid coarsening by up to n level.
/// Returns MESH_ADAPTED if grid was changed
virtual Flag globalCoarsen(int n) = 0;
/// Uniform global refinement by n level
/// Returns MESH_ADAPTED if grid was changed
virtual Flag globalRefine(int n) = 0;
/** \brief /** \brief
* Solves the assembled system. The result is an approximative solution. * Solves the assembled system. The result is an approximative solution.
* The last two boolean arguments can be used to controll successive * The last two boolean arguments can be used to controll successive
......
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