Skip to content
Snippets Groups Projects
Commit ef0cf6ea authored by Oliver Sander's avatar Oliver Sander Committed by sander
Browse files

Allow to set all grid parameters at run-time

In particular whether the grid is structured or not,
and the bounding box and element numbers in the former
case.

[[Imported from SVN: r9272]]
parent e5db1034
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,7 @@
#include <dune/grid/io/file/amirameshreader.hh>
#include <dune/grid/io/file/amirameshwriter.hh>
#include <dune/grid/io/file/gmshreader.hh>
#include <dune/fufem/boundarypatch.hh>
......@@ -134,14 +135,19 @@ int main (int argc, char *argv[]) try
// Create the grid
// ///////////////////////////////////////
typedef std::conditional<dim==1,OneDGrid,UGGrid<dim> >::type GridType;
array<unsigned int,dim> elements;
elements.fill(1);
elements[0] = 10;
FieldVector<double,dim> upper(1);
upper[0] = 10;
shared_ptr<GridType> grid = StructuredGridFactory<GridType>::createCubeGrid(FieldVector<double,dim>(0),
upper,
elements);
shared_ptr<GridType> grid;
FieldVector<double,dim> lower = parameterSet.get<FieldVector<double,dim> >("lower");
FieldVector<double,dim> upper = parameterSet.get<FieldVector<double,dim> >("upper");
if (parameterSet.get<bool>("structuredGrid")) {
array<unsigned int,dim> elements = parameterSet.get<array<unsigned int,dim> >("elements");
grid = StructuredGridFactory<GridType>::createCubeGrid(lower, upper, elements);
} else
grid = shared_ptr<GridType>(GmshReader<GridType>::read(gridFile));
grid->globalRefine(numLevels-1);
......
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