Commit 90f422fb authored by Lukas Riedel's avatar Lukas Riedel

grid_cube_construction: extracting dim from GridType template parameter

parent 3ea52558
......@@ -22,17 +22,17 @@ void check_parallel_allowed (const Dune::MPIHelper& helper)
* \param elements Number of elements in each direction
* \return Shared pointer to the grid
*/
template<typename GridType, int dim>
template<typename GridType>
std::enable_if_t<
std::is_same<YaspGrid<dim>,GridType>::value,
std::shared_ptr<YaspGrid<dim>> >
grid_cube_construction (const Dune::FieldVector<double,dim>& extensions,
const std::array<unsigned int,dim>& elements)
std::is_same<YaspGrid<GridType::dimension>,GridType>::value,
std::shared_ptr<YaspGrid<GridType::dimension>> >
grid_cube_construction (const Dune::FieldVector<double,GridType::dimension>& extensions,
const std::array<unsigned int,GridType::dimension>& elements)
{
std::array<int,dim> elements_;
std::array<int,GridType::dimension> elements_;
std::copy(elements.cbegin(),elements.cend(),elements_.begin());
return std::make_shared<YaspGrid<dim>>(extensions,elements_);
return std::make_shared<YaspGrid<GridType::dimension>>(extensions,elements_);
}
/// Default rectangular grid constructor. Call StructuredGridFactory
......@@ -40,14 +40,14 @@ grid_cube_construction (const Dune::FieldVector<double,dim>& extensions,
* \param elements Number of elements in each direction
* \return Shared pointer to the grid
*/
template<typename GridType, int dim>
template<typename GridType>
std::enable_if_t<
!std::is_same<YaspGrid<dim>,GridType>::value,
!std::is_same<YaspGrid<GridType::dimension>,GridType>::value,
std::shared_ptr<GridType> >
grid_cube_construction (const Dune::FieldVector<double,dim>& extensions,
const std::array<unsigned int,dim>& elements)
grid_cube_construction (const Dune::FieldVector<double,GridType::dimension>& extensions,
const std::array<unsigned int,GridType::dimension>& elements)
{
const Dune::FieldVector<double,dim> origin(.0);
const Dune::FieldVector<double,GridType::dimension> origin(.0);
return Dune::StructuredGridFactory<GridType>::createCubeGrid(origin,extensions,elements);
}
......@@ -122,7 +122,7 @@ std::shared_ptr<GridType> build_grid_cube (const Dune::ParameterTree& inifile, c
const Dune::FieldVector<double,dim> upperRight = inifile.get<Dune::FieldVector<double,dim>>("grid.extensions");
const Dune::array<unsigned int,dim> elements = inifile.get<Dune::array<unsigned int,dim>>("grid.cells");
auto grid = grid_cube_construction<GridType,dim>(upperRight,elements);
auto grid = grid_cube_construction<GridType>(upperRight,elements);
grid->globalRefine(level);
grid->loadBalance();
......
Markdown is supported
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