message: Added debugging code for quadrature maps, everything looks ok
diff: using namespace mfem::internal;
  +// #define MFEM_DEBUG_MOONOLITH
  +
  namespace mfem
  {
  @@ -93,6 +95,25 @@ protected:
  return ok;
  }
  + static void ConvertQRule(const IntegrationRule &ir, Quadrature_t &result)
  + {
  + const int size = ir.Size();
  +
  + result.resize(size);
  +
  + for (int k = 0; k < size; ++k)
  + {
  + auto &qp = ir[k];
  + result.points[k][0] = qp.x;
  + result.points[k][1] = qp.y;
  + if constexpr (Dim == 3) {
  + result.points[k][12] = qp.z;
  + }
  +
  + result.weights[k] = qp.weight;
  + }
  + }
  +
  inline const Polytope & from() const { return from_; }
  inline const Polytope & to() const { return to_; }
  @@ -192,6 +213,27 @@ bool CutGeneric<Polytope>::BuildQuadrature(const FiniteElementSpace &from_space,
  return false;
  }
  +
  +#ifdef MFEM_DEBUG_MOONOLITH
  +
  + {
  + static int counter = 0;
  +
  + moonolith::MatlabScripter script;
  + script.hold_on();
  + script.plot(from_, "\'g-\'");
  + script.plot(from_, "\'g.\'");
  + script.plot(to_, "\'r-\'");
  + script.plot(to_, "\'r.\'");
  + script.plot(physical_quadrature_.points, "\'*b\'");
  +
  + std::cout << "measure(" << counter << "): " << moonolith::measure(physical_quadrature_) << "\n";
  +
  + script.save("out_" + std::to_string(counter++) + ".m");
  + }
  +
  +#endif //MFEM_DEBUG_MOONOLITH
  +
  int from_type = from_space.GetFE(from_elem_idx)->GetGeomType();
  int to_type = to_space.GetFE(to_elem_idx)->GetGeomType();
  @@ -233,6 +275,30 @@ bool CutGeneric<Polytope>::BuildQuadrature(const FiniteElementSpace &from_space,
  assert(IsValidQPoint(to_quadrature[qp]));
  }
  +#ifdef MFEM_DEBUG_MOONOLITH
  +
  + {
  + static int counter = 0;
  +
  + moonolith::MatlabScripter script;
  + script.hold_on();
  + script.plot(from_, "\'g-\'");
  + script.plot(from_, "\'g.\'");
  + script.plot(to_, "\'r-\'");
  + script.plot(to_, "\'r.\'");
  +
  + Quadrature_t q_to;
  + ConvertQRule(to_quadrature, q_to);
  + script.close_all();
  + script.plot(q_to.points, "\'*b\'");
  +
  + std::cout << "to_measure(" << counter << "): " << moonolith::measure(q_to) << "\n";
  +
  + script.save("ref_to_" + std::to_string(counter++) + ".m");
  + }
  +
  +#endif //MFEM_DEBUG_MOONOLITH
  +
  return true;
  }
  