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