// code fragment, which provides two conservative fluxes implementing the
// LDG-flux

// code by M. Kraenkel, 26.6.2006

static const double beta=-0.5;

// required typedefs: 

typedef .... DomainType;
typedef .... RangeType 

// uflux: computation of a conservative flux on an edge
//        which depends only on two values on both sides of the edge
//
//        parameters:
//        normal:    outer normal to the edge
//        phileft:   scalar value on inside of element
//        phiright:  scalar value on outside of element
//        tmp:       scalar return value

template<class argType>
void uflux(const DomainType& normal,const argType& phileft,
           const argType& phiright, argType & tmp)const
{
  DomainType v(0.0);
  v[0]=exp(1);
  v[1]=5.0;
  
  argType tmp2;
  tmp2=phileft-phiright;
  tmp2*=beta;
  tmp=phileft+phiright;
  tmp *= 0.5;
  if(v*normal > 0)
      tmp-=tmp2;
  else
      tmp+=tmp2;
}

// sigmaflux: computation of a conservative flux on an edge
//        which depends only on the values of phi and psi 
//        on both sides of the edge
//
//        parameters:
//        normal:    outer normal to the edge
//        psileft:   vector value on inside of element
//        psiright:  vector value on outside of element
//        phileft:   scalar value on inside of element
//        phiright:  scalar value on outside of element
//        ret:       scalar value \hat sigma*normal

template<class argType>
void sigmaflux(/*IntersectionIterator& it,*/
    const DomainType& normal,
    const argType& psileft,
    const argType& psiright,
    const RangeType& phileft,
    const RangeType& phiright,
    double& ret)const
{
  argType tmp;
  argType tmp2;
  DomainType v(1.0);
  tmp=psileft+psiright;
  //tmp *= 0.5;
  tmp *= 0.5;
  tmp2=psileft-psiright;
  tmp2*=beta;
  if(v*normal > 0)
      tmp+=tmp2;
  else
      tmp-=tmp2;
  
  ret=tmp*normal;
  
  double h_e=normal.two_norm();
  //double factor=normal*normal;
  double factor = (1/h_e);
  ret +=(phileft-phiright);
  
}


