Skip to content
Snippets Groups Projects
Commit c25dcdd8 authored by Timo Koch's avatar Timo Koch
Browse files

[test] Small readability improvement in 2d growth test

parent b6d4dfeb
No related branches found
No related tags found
1 merge request!23[refelement] Get copies as references are deprecated upstream
......@@ -20,19 +20,21 @@ void checkGridElementGrowth(Grid& grid)
enum { dim = Grid::dimension };
// the vertex mapper
Dune::LeafMultipleCodimMultipleGeomTypeMapper<Grid,Dune::MCMGVertexLayout> mapper(grid);
LeafMultipleCodimMultipleGeomTypeMapper<Grid, MCMGVertexLayout> mapper(grid);
// let the top element grow
for (const auto& element : elements(grid.leafGridView()))
{
const auto refElement = ReferenceElements<double,dim>::general(element.type());
for (const auto& intersection : intersections(grid.leafGridView(), element))
{
if(intersection.boundary() && intersection.geometry().center()[1] > 0.5)
{
const auto refElement = ReferenceElements<double,dim>::general(element.type());
auto&& v0 = element.template subEntity<dim>(refElement.subEntity(intersection.indexInInside(), dim-1, 0, dim));
auto&& v1 = element.template subEntity<dim>(refElement.subEntity(intersection.indexInInside(), dim-1, 1, dim));
// calculate new vertex position
Dune::FieldVector<double, dimworld> newVertex = v0.geometry().center();
auto newVertex = v0.geometry().center();
newVertex += v1.geometry().center(); newVertex /= 2.0;
newVertex[1] += 0.5;
......@@ -42,6 +44,8 @@ void checkGridElementGrowth(Grid& grid)
// insert the element
grid.insertElement(element.type(), {mapper.index(v0), mapper.index(v1), vIdx});
}
}
}
std::size_t numBoundarySegments = grid.numBoundarySegments();
std::cout << std::endl<< "numBoundarySegments before growth: " << numBoundarySegments << std::endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment