12#include <matplot/matplot.h> 
   17#include <dune/geometry/dimension.hh> 
   30template <
typename Gr
idView>
 
   31void draw(
const GridView& gridView, 
bool forever = 
false) {
 
   32  using namespace matplot;
 
   33  auto f  = figure(
true);
 
   36  constexpr int edgeCodim = GridView::dimension - 1;
 
   37  for (
auto&& element : elements(gridView)) {
 
   38    std::array<std::array<double, 2>, GridView::dimensionworld> edgeCoords{};
 
   39    for (
size_t edgeIndex = 0; edgeIndex < element.subEntities(edgeCodim); ++edgeIndex) {
 
   40      auto edge = element.template subEntity<edgeCodim>(edgeIndex);
 
   41      for (
int i = 0; i < 2; ++i) {
 
   42        const auto vertCoords = edge.geometry().corner(i);
 
   43        for (
int j = 0; j < GridView::dimensionworld; ++j)
 
   44          edgeCoords[j][i] = vertCoords[j];
 
   46      if constexpr (GridView::dimensionworld == 3) {
 
   47        auto l = ax->plot3(edgeCoords[0], edgeCoords[1], edgeCoords[2], 
"-o");
 
   51        l->marker_face_color(
"red");
 
   53        auto l = ax->plot(edgeCoords[0], edgeCoords[1], 
"-o");
 
   57        l->marker_face_color(
"red");
 
   66    using namespace std::chrono_literals;
 
   67    std::this_thread::sleep_for(5s);
 
void draw(const GridView &gridView, bool forever=false)
Draw function for visualizing the elements of a DUNE grid view.
Definition: griddrawer.hh:31