[Dune] GridFactory with UG collapses at 100000 nodes
Dominic Kempf
dominic.kempf at iwr.uni-heidelberg.de
Thu Mar 3 14:55:35 CET 2011
Hey Dune-Team!
I am using the Dune::GridFactory with UG to create large cube grids. But
there seems to be a bug, that makes grid generation extremly slow at
exactly 100000 inserted nodes. I ran a loop that creates cube grids on
the unit square with increasing number of nodes. The result was that
until 99000 the grid was instantly created, as soon as I passed the
100000, it takes around 10 seconds. Much larger grids are impossible to
create due to computing time. This doesnt seem to be a memory issue,
increasing UG's default heap size doesnt change a thing. I can still get
bigger grids by refinement in acceptable time, but this brings some
other issues with it for me.
This is the example code I extracted, that makes the issue obvious:
typedef Dune::UGGrid<2> Grid;
for (double n=95000; n<103000; n += 1000)
{
int m = (int)sqrt(n);
Dune::GridFactory<Grid> factory;
for (int j = 0; j < m+1; j++)
for (int i = 0; i < m+1; i++)
{
//set vertex position
Dune::FieldVector<Grid::ctype,2> pos;
pos[0] = ((double)i)/m;
pos[1] = ((double)j)/m;
factory.insertVertex(pos);
}
//get geometry type
const Dune::GeometryType gt(Dune::GeometryType::cube,2);
//insert elements
for (unsigned int i=0; i<m;i++)
for (unsigned int j=0; j<m;j++)
{
//set node positions
std::vector<unsigned int> pos;
pos.push_back(i+j*(m+1));
pos.push_back(i+1+j*(m+1));
pos.push_back(i+(j+1)*(m+1));
pos.push_back(i+1+(j+1)*(m+1));
factory.insertElement(gt,pos);
}
Grid* grid = factory.createGrid();
std::cout << "Grid with " << grid->size(2) << " vertices created!\n";
delete grid;
}
I hope somebody could help!
Thanks in advance!
Dominic
More information about the Dune
mailing list