Skip to content
Snippets Groups Projects
Commit d0523b41 authored by Jonathan Youett's avatar Jonathan Youett
Browse files

Allow grids that are constructed from parameter file

parent 9a291e80
Branches
Tags
No related merge requests found
......@@ -17,6 +17,7 @@
#include <dune/fufem/estimators/fractionalmarking.hh>
#include <dune/fufem/estimators/refinementindicator.hh>
#include <dune/fufem/utilities/dirichletbcassembler.hh>
#include <dune/fufem/utilities/gridconstruction.hh>
#ifdef HAVE_IPOPT
#include <dune/solvers/solvers/quadraticipopt.hh>
......@@ -60,19 +61,28 @@ int main (int argc, char *argv[]) try
// read problem settings
std::string path = parameterSet.get<std::string>("path");
std::string resultPath = parameterSet.get<std::string>("resultPath");
std::string gridFile = parameterSet.get<std::string>("gridFile");
// /////////////////////////////
// Generate the grid
// /////////////////////////////
typedef UGGrid<dim> GridType;
GridType* grid = new GridType;
std::unique_ptr<GridType> grid;
if (parameterSet.hasKey("parFile")) {
std::string parFile = parameterSet.get<std::string>("parFile");
const auto& gridConfig = parameterSet.sub(parameterSet.get<std::string>("gridName"));
if (gridConfig.get<bool>("createGrid", false)) {
grid = GridConstruction<GridType,dim>::createGrid(gridConfig);
} else if (gridConfig.hasKey("amira_parFile")) {
#if HAVE_AMIRAMESH
auto gridFile = gridConfig.get<std::string>("gridFile");
auto parFile = gridConfig.get<std::string>("amira_parFile");
grid = AmiraMeshReader<GridType>::read(path + gridFile, PSurfaceBoundary<dim-1>::read(path + parFile));
} else
AmiraMeshReader<GridType>::read(*grid, path + gridFile);
#endif
} else {
#if HAVE_AMIRAMESH
grid = AmiraMeshReader<GridType>::read(path + gridConfig.get<std::string>("gridFile"));
#endif
}
// Read coarse Dirichlet boundary values
BitSetVector<dim> coarseDirichletNodes;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment