#ifndef __MESH_QUALITY_H
#define __MESH_QUALITY_H

#include <dolfin/constants.h>
#include <dolfin/Mesh.h>
#include <dolfin/MeshFunction.h>

namespace dolfin { namespace unicorn
{
//   void meshQuality(Mesh& mesh,
// 		   real& mu_min, real& mu_max,
// 		   real& h_min, real& h_max);

  class MeshQuality
  {
  public:
    
    /// Constructor
    MeshQuality(Mesh& mesh);

    bool isInverted(uint& first);
    real cellQuality(Cell& cell);
    void meshQuality(real& mu_min, real& mu_max, real& mu_avg,
		     real& h_min, real& h_max, real& h_avg);

    // Compute cell diameter
    static real myDiameter(Cell& cell);


    Mesh& mesh;
    MeshFunction<int> orientation;
  };


}}

#endif
