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 @@ ...@@ -15,6 +15,7 @@
#include <dune/grid/io/file/amirameshreader.hh> #include <dune/grid/io/file/amirameshreader.hh>
#include <dune/grid/io/file/amirameshwriter.hh> #include <dune/grid/io/file/amirameshwriter.hh>
#include <dune/grid/io/file/gmshreader.hh>
#include <dune/fufem/boundarypatch.hh> #include <dune/fufem/boundarypatch.hh>
...@@ -134,14 +135,19 @@ int main (int argc, char *argv[]) try ...@@ -134,14 +135,19 @@ int main (int argc, char *argv[]) try
// Create the grid // Create the grid
// /////////////////////////////////////// // ///////////////////////////////////////
typedef std::conditional<dim==1,OneDGrid,UGGrid<dim> >::type GridType; typedef std::conditional<dim==1,OneDGrid,UGGrid<dim> >::type GridType;
array<unsigned int,dim> elements;
elements.fill(1); shared_ptr<GridType> grid;
elements[0] = 10;
FieldVector<double,dim> upper(1); FieldVector<double,dim> lower = parameterSet.get<FieldVector<double,dim> >("lower");
upper[0] = 10; FieldVector<double,dim> upper = parameterSet.get<FieldVector<double,dim> >("upper");
shared_ptr<GridType> grid = StructuredGridFactory<GridType>::createCubeGrid(FieldVector<double,dim>(0),
upper, if (parameterSet.get<bool>("structuredGrid")) {
elements);
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); 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