Commit 614da570 authored by Timo Koch's avatar Timo Koch Committed by Dennis Gläser
Browse files

[test] Add test with nonoverlapping grid manager that cannot communicate

parent 82abd943
......@@ -145,3 +145,11 @@ dumux_add_test(NAME test_1p_incompressible_mpfa_extrude_distorted
-Problem.CheckIsConstantVelocity true
-Problem.EnableGravity false
-Grid.File ./grids/randomlydistorted.dgf)
# check grids without communicate method (using box and numeric differentiation)
dumux_add_test(NAME test_1p_incompressible_box_numdiff_no_communicate
LABELS porousmediumflow 1p
SOURCES main.cc
COMPILE_DEFINITIONS TYPETAG=OnePIncompressibleBox NUMDIFFMETHOD=DiffMethod::numeric GRIDTYPE=Dumux::NoCommunicateGrid<2>
COMMAND ./test_1p_incompressible_box_numdiff_no_communicate
CMD_ARGS -Grid.Overlap 0)
......@@ -149,6 +149,9 @@ int main(int argc, char** argv)
// output result to vtk
vtkWriter.write(1.0);
// output residual norm (test assembler interface)
std::cout << "Residual norm: " << assembler->residualNorm(x) << std::endl;
timer.stop();
const bool checkIsConstantVelocity = getParam<bool>("Problem.CheckIsConstantVelocity", false);
......
......@@ -50,6 +50,67 @@
#define GRIDTYPE Dune::YaspGrid<2>
#endif
////////////////////////////////////////////////////
// A fake grid that cannot communicate. //
// Can be used to make sure that compilation and //
// sequential execution also work for such grids. //
////////////////////////////////////////////////////
namespace Dumux {
template<int dim>
class NoCommunicateGrid;
template<int dim>
class NoCommunicateGridLeafGridView
: public Dune::YaspGrid<dim>::LeafGridView
{
using ParentType = typename Dune::YaspGrid<dim>::LeafGridView;
public:
using ParentType::ParentType;
struct Traits : public ParentType::Traits
{ using Grid = NoCommunicateGrid<dim>; };
};
template<int dim>
class NoCommunicateGrid : public Dune::YaspGrid<dim>
{
using ParentType = Dune::YaspGrid<dim>;
public:
using ParentType::ParentType;
struct Traits : public ParentType::Traits
{ using LeafGridView = NoCommunicateGridLeafGridView<dim>; };
using LeafGridView = NoCommunicateGridLeafGridView<dim>;
typename Traits::LeafGridView leafGridView() const
{ return NoCommunicateGridLeafGridView<dim>(*this); }
private:
using ParentType::communicate;
using ParentType::communicateCodim;
};
template<int dim>
class GridManager<NoCommunicateGrid<dim>> : public GridManager<Dune::YaspGrid<dim>>
{
using ParentType = GridManager<Dune::YaspGrid<dim>>;
public:
using ParentType::ParentType;
using Grid = NoCommunicateGrid<dim>;
Grid& grid() { return static_cast<NoCommunicateGrid<dim>&>(ParentType::grid()); }
};
} // end namespace Dumux
namespace Dune::Capabilities {
template<int dim, int codim>
struct canCommunicate<Dumux::NoCommunicateGrid<dim>, codim>
{ static constexpr bool v = false; };
} // end namespace Dune::Capabilities
/////////////////////////////////////////
namespace Dumux::Properties {
// Create new type tags
namespace TTag {
......
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