Commit 5a326c86 authored by Kilian Weishaupt's avatar Kilian Weishaupt Committed by Timo Koch
Browse files

[test] Use new grid managers

parent 82be40dc
......@@ -21,8 +21,8 @@
* \ingroup Common
* \brief Provides a few default main functions for convenience.
*/
#ifndef DUMUX_START_HH
#define DUMUX_START_HH
#ifndef DUMUX_COMMON_START_HH
#define DUMUX_COMMON_START_HH
#include <ctime>
#include <iostream>
......@@ -34,6 +34,7 @@
#include <dumux/common/parameters.hh>
#include <dumux/common/dumuxmessage.hh>
#include <dumux/common/defaultusagemessage.hh>
#include <dumux/io/grid/gridmanager.hh>
#warning "start.hh is deprecated. Use new style main files see e.g. /test/porousmediumflow/1p."
......@@ -64,7 +65,6 @@ int start_(int argc,
{
// some aliases for better readability
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator);
using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
using TimeManager = typename GET_PROP_TYPE(TypeTag, TimeManager);
......@@ -86,8 +86,8 @@ int start_(int argc,
// try to create a grid (from the given grid file or the input file)
/////////////////////////////////////////////////////////////////////
GridCreator::makeGrid();
GridCreator::loadBalance();
GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager;
gridManager.init();
//////////////////////////////////////////////////////////////////////
// run the simulation
......@@ -108,7 +108,7 @@ int start_(int argc,
// instantiate and run the problem
TimeManager timeManager;
Problem problem(timeManager, GridCreator::grid());
Problem problem(timeManager, gridManager.grid());
timeManager.init(problem, restartTime, dt, tEnd, restart);
timeManager.run();
......
......@@ -3,6 +3,8 @@ add_subdirectory(staggered)
install(FILES
fluxvariables.hh
indices.hh
kepsilonncmodel.hh
komegancmodel.hh
localresidual.hh
lowrekepsilonncmodel.hh
navierstokesncmodel.hh
......
......@@ -5,7 +5,6 @@ fluxvariables.hh
indices.hh
localresidual.hh
model.hh
models.hh
problem.hh
volumevariables.hh
vtkoutputfields.hh
......
add_subdirectory(grid)
install(FILES
adaptivegridrestart.hh
cakegridcreator.hh
container.hh
cpgridcreator.hh
defaultvtkoutputfields.hh
gnuplotinterface.hh
gridcreator.hh
......@@ -13,7 +13,6 @@ plotthermalconductivitymodel.hh
pointcloudvtkwriter.hh
restart.hh
staggeredvtkoutputmodule.hh
subgridgridcreator.hh
vtkfunction.hh
vtkmultiwriter.hh
vtknestedfunction.hh
......
install(FILES
cakegridcreator.hh
cpgridcreator.hh
gmshgriddatahandle.hh
griddata.hh
gridmanager.hh
subgridgridcreator.hh
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/io/grid)
......@@ -58,7 +58,7 @@ public:
/*!
* \brief Make the grid.
*/
static void makeGrid(const std::string& modelParamGroup = "")
void init(const std::string& modelParamGroup = "")
{
static_assert(dim == 2 || dim == 3, "The CakeGridCreator is only implemented for 2D and 3D.");
......@@ -70,6 +70,7 @@ public:
createVectors(polarCoordinates, indices, modelParamGroup, verbose);
gridPtr() = createCakeGrid(polarCoordinates, indices, modelParamGroup, verbose);
loadBalance();
}
/*!
......@@ -264,10 +265,10 @@ public:
* \param polarCoordinates Vector containing radial, angular and axial coordinates (in this order)
* \param indices Indices specifing the radial, angular and axial direction (in this order)
*/
static std::shared_ptr<Grid> createCakeGrid(std::array<std::vector<Scalar>, dim> &polarCoordinates,
Dune::FieldVector<int, dim> &indices,
const std::string& modelParamGroup,
bool verbose = false)
std::unique_ptr<Grid> createCakeGrid(std::array<std::vector<Scalar>, dim> &polarCoordinates,
Dune::FieldVector<int, dim> &indices,
const std::string& modelParamGroup,
bool verbose = false)
{
std::vector<Scalar> dR = polarCoordinates[0];
std::vector<Scalar> dA = polarCoordinates[1];
......@@ -446,14 +447,13 @@ public:
}
}
// return the grid pointer
return std::shared_ptr<Grid>(gridFactory.createGrid());
return std::unique_ptr<Grid>(gridFactory.createGrid());
}
/*!
* \brief Returns a reference to the grid.
*/
static Grid &grid()
Grid& grid()
{
return *gridPtr();
}
......@@ -462,19 +462,23 @@ public:
* \brief Distributes the grid on all processes of a parallel
* computation.
*/
static void loadBalance()
void loadBalance()
{
gridPtr()->loadBalance();
}
protected:
/*!
* \brief Returns a reference to the shared pointer to the grid.
*/
static GridPointer &gridPtr()
GridPointer& gridPtr()
{
static GridPointer cakeGrid;
return cakeGrid;
return cakeGrid_;
}
private:
GridPointer cakeGrid_;
};
} // end namespace Dumux
......
......@@ -24,6 +24,8 @@
#ifndef DUMUX_ANGELI_TEST_PROBLEM_HH
#define DUMUX_ANGELI_TEST_PROBLEM_HH
#include <dune/grid/yaspgrid.hh>
#include <dumux/material/fluidsystems/1pliquid.hh>
#include <dumux/material/components/constant.hh>
......
......@@ -24,6 +24,8 @@
#ifndef DUMUX_CHANNEL_TEST_PROBLEM_HH
#define DUMUX_CHANNEL_TEST_PROBLEM_HH
#include <dune/grid/yaspgrid.hh>
#include <dumux/material/fluidsystems/1pliquid.hh>
#include <dumux/material/components/simpleh2o.hh>
#include <dumux/material/components/constant.hh>
......
......@@ -24,6 +24,8 @@
#ifndef DUMUX_CLOSEDSYSTEM_TEST_PROBLEM_HH
#define DUMUX_CLOSEDSYSTEM_TEST_PROBLEM_HH
#include <dune/grid/yaspgrid.hh>
#include <dumux/material/fluidsystems/1pliquid.hh>
#include <dumux/material/components/constant.hh>
......
......@@ -24,6 +24,8 @@
#ifndef DUMUX_DONEA_TEST_PROBLEM_HH
#define DUMUX_DONEA_TEST_PROBLEM_HH
#include <dune/grid/yaspgrid.hh>
#include <dumux/material/fluidsystems/1pliquid.hh>
#include <dumux/material/components/constant.hh>
......
......@@ -24,6 +24,8 @@
#ifndef DUMUX_KOVASZNAY_TEST_PROBLEM_HH
#define DUMUX_KOVASZNAY_TEST_PROBLEM_HH
#include <dune/grid/yaspgrid.hh>
#include <dumux/material/fluidsystems/1pliquid.hh>
#include <dumux/material/components/constant.hh>
......
......@@ -26,6 +26,8 @@
#ifndef DUMUX_DONEA_TEST_PROBLEM_HH
#define DUMUX_DONEA_TEST_PROBLEM_HH
#include <dune/grid/yaspgrid.hh>
#include <dumux/material/components/constant.hh>
#include <dumux/material/fluidsystems/1pliquid.hh>
......
......@@ -28,6 +28,8 @@
#ifndef DUMUX_3D_CHANNEL_PROBLEM_HH
#define DUMUX_3D_CHANNEL_PROBLEM_HH
#include <dune/grid/yaspgrid.hh>
#include <dumux/material/fluidsystems/1pliquid.hh>
#include <dumux/material/components/constant.hh>
......
......@@ -50,6 +50,7 @@
#include <dumux/discretization/methods.hh>
#include <dumux/io/staggeredvtkoutputmodule.hh>
#include <dumux/io/grid/gridmanager.hh>
/*!
* \brief Provides an interface for customizing error messages associated with
......@@ -101,16 +102,15 @@ int main(int argc, char** argv) try
Parameters::init(argc, argv, usage);
// try to create a grid (from the given grid file or the input file)
using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator);
GridCreator::makeGrid();
GridCreator::loadBalance();
GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager;
gridManager.init();
////////////////////////////////////////////////////////////
// run instationary non-linear problem on this grid
////////////////////////////////////////////////////////////
// we compute on the leaf grid view
const auto& leafGridView = GridCreator::grid().leafGridView();
const auto& leafGridView = gridManager.grid().leafGridView();
// create the finite volume grid geometry
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
......
......@@ -49,6 +49,7 @@
#include <dumux/discretization/methods.hh>
#include <dumux/io/staggeredvtkoutputmodule.hh>
#include <dumux/io/grid/gridmanager.hh>
#include <dumux/freeflow/navierstokes/staggered/fluxoversurface.hh>
......@@ -102,16 +103,15 @@ int main(int argc, char** argv) try
Parameters::init(argc, argv, usage);
// try to create a grid (from the given grid file or the input file)
using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator);
GridCreator::makeGrid();
GridCreator::loadBalance();
GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager;
gridManager.init();
////////////////////////////////////////////////////////////
// run instationary non-linear problem on this grid
////////////////////////////////////////////////////////////
// we compute on the leaf grid view
const auto& leafGridView = GridCreator::grid().leafGridView();
const auto& leafGridView = gridManager.grid().leafGridView();
// create the finite volume grid geometry
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
......
......@@ -49,6 +49,7 @@
#include <dumux/discretization/methods.hh>
#include <dumux/io/staggeredvtkoutputmodule.hh>
#include <dumux/io/grid/gridmanager.hh>
/*!
* \brief Provides an interface for customizing error messages associated with
......@@ -100,16 +101,15 @@ int main(int argc, char** argv) try
Parameters::init(argc, argv, usage);
// try to create a grid (from the given grid file or the input file)
using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator);
GridCreator::makeGrid();
GridCreator::loadBalance();
GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager;
gridManager.init();
////////////////////////////////////////////////////////////
// run instationary non-linear problem on this grid
////////////////////////////////////////////////////////////
// we compute on the leaf grid view
const auto& leafGridView = GridCreator::grid().leafGridView();
const auto& leafGridView = gridManager.grid().leafGridView();
// create the finite volume grid geometry
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
......
......@@ -51,6 +51,7 @@
#include <dumux/discretization/methods.hh>
#include <dumux/io/staggeredvtkoutputmodule.hh>
#include <dumux/io/grid/gridmanager.hh>
#include <dumux/io/grid/gridmanager.hh>
......@@ -104,18 +105,16 @@ int main(int argc, char** argv) try
Parameters::init(argc, argv, usage);
// try to create a grid (from the given grid file or the input file)
using GridManager = Dumux::GridManager<typename GET_PROP_TYPE(TypeTag, Grid), GET_PROP_TYPE(TypeTag, FVGridGeometry)::discMethod>;
GridManager gridMgr;
gridMgr.makeGrid();
const auto& grid = gridMgr.grid();
gridMgr.loadBalance();
using GridManager = Dumux::GridManager<typename GET_PROP_TYPE(TypeTag, Grid)>;
GridManager gridManager;
gridManager.init();
////////////////////////////////////////////////////////////
// run instationary non-linear problem on this grid
////////////////////////////////////////////////////////////
// we compute on the leaf grid view
const auto& leafGridView = grid.leafGridView();
const auto& leafGridView = gridManager.grid().leafGridView();
// create the finite volume grid geometry
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
......
......@@ -50,6 +50,7 @@
#include <dumux/discretization/methods.hh>
#include <dumux/io/staggeredvtkoutputmodule.hh>
#include <dumux/io/grid/gridmanager.hh>
/*!
* \brief Provides an interface for customizing error messages associated with
......@@ -101,16 +102,15 @@ int main(int argc, char** argv) try
Parameters::init(argc, argv, usage);
// try to create a grid (from the given grid file or the input file)
using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator);
GridCreator::makeGrid();
GridCreator::loadBalance();
GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager;
gridManager.init();
////////////////////////////////////////////////////////////
// run instationary non-linear problem on this grid
////////////////////////////////////////////////////////////
// we compute on the leaf grid view
const auto& leafGridView = GridCreator::grid().leafGridView();
const auto& leafGridView = gridManager.grid().leafGridView();
// create the finite volume grid geometry
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment