Commit 3ea52558 authored by Lukas Riedel's avatar Lukas Riedel

grid creation will now throw an exception if the grid configuration does not...

grid creation will now throw an exception if the grid configuration does not support parallel execution
parent 1d8d0d29
......@@ -4,6 +4,19 @@
namespace Dune {
namespace Dorie {
/// Check if parallel execution is allowed
/** Currently, we only allow parallel execution on YaspGrid due to
* constraints imposed by the linear solver
*/
template<typename GridType>
void check_parallel_allowed (const Dune::MPIHelper& helper)
{
if(helper.rank() > 1
&& !std::is_same<YaspGrid<GridType::dimension>,GridType>::value) {
DUNE_THROW(Dune::Exception,"DORiE does not support parallel execution with this grid configuration!");
}
}
/// Specialized constructor for parallel YaspGrid construction
/** \param extensions Extensions of the grid
* \param elements Number of elements in each direction
......@@ -48,6 +61,8 @@ grid_cube_construction (const Dune::FieldVector<double,dim>& extensions,
template<class GridType>
std::shared_ptr<GridType> build_grid_gmsh (const Dune::ParameterTree& inifile, const Dune::MPIHelper& helper)
{
check_parallel_allowed<GridType>(helper);
Dune::Timer timer;
ios_base_all_saver restore(std::cout);
enum { dim = GridType::dimension };
......@@ -96,6 +111,8 @@ std::shared_ptr<GridType> build_grid_gmsh (const Dune::ParameterTree& inifile, c
template<class GridType>
std::shared_ptr<GridType> build_grid_cube (const Dune::ParameterTree& inifile, const Dune::MPIHelper& helper)
{
check_parallel_allowed<GridType>(helper);
Dune::Timer timer;
ios_base_all_saver restore(std::cout);
enum { dim = GridType::dimension };
......
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