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

Merge branch 'feature/move_init_to_meshcreator' into 'master'

Move initial refine/loadbalance to MeshCreator

See merge request !183
parents f5575719 aa871e37
......@@ -86,6 +86,15 @@ namespace AMDiS
// decide by inspecting the grid type how to create the grid
gridPtr = create_by_gridtype<HostGrid>(Dune::PriorityTag<42>{});
}
// Perform initial refinement and load balance if requested in the initfile
auto globalRefinements = Parameters::get<int>(name_ + "->global refinements");
if (globalRefinements)
gridPtr->globalRefine(globalRefinements.value());
auto loadBalance = Parameters::get<bool>(name_ + "->load balance");
if (loadBalance && loadBalance.value())
gridPtr->loadBalance();
return construct(std::move(gridPtr));
}
......
......@@ -47,21 +47,6 @@ void ProblemStat<Traits>::initialize(
if (!grid_)
warning("no grid created");
if (initFlag.isSet(INIT_MESH)) {
int globalRefinements = 0;
Parameters::get(gridName_ + "->global refinements", globalRefinements);
if (globalRefinements > 0)
grid_->globalRefine(globalRefinements);
bool loadBalance = false;
Parameters::get(gridName_ + "->load balance", loadBalance);
if (loadBalance)
loadBalance = grid_->loadBalance();
if (globalBasis_ && (globalRefinements > 0 || loadBalance))
globalBasis_->update(globalBasis_->gridView());
}
// create fespace
if (globalBasis_) {
warning("globalBasis already created");
......@@ -180,11 +165,6 @@ void ProblemStat<Traits>::createGrid()
MeshCreator<Grid> creator(gridName_);
grid_ = creator.create();
Dune::Timer t;
bool loadBalance = grid_->loadBalance();
if (loadBalance)
info(2,"load balance needed {} seconds", t.elapsed());
boundaryManager_ = std::make_shared<BoundaryManager<Grid>>(grid_);
if (!creator.boundaryIds().empty())
boundaryManager_->setBoundaryIds(creator.boundaryIds());
......
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