// GenFem - A high-level finite element library
// Copyright (C) 2010-2026 Eric Bechet
//
// See the LICENSE file for license information and contributions.
// Please report all bugs and problems to <bechet@cadxfem.org>.
//
// Initial design: Eric Bechet and Frederic Duboeuf (rev.1011)


#ifndef _GEN_TENSORINVERSE__H_
#define _GEN_TENSORINVERSE__H_

#include "genTensors.h"

template<class T> class InverseOp
{
  public :
  typedef T ValType;
  void operator() (const T &a, ValType &r) const =0;
};


template<class scalar,int N> class InverseOp<genTensor0<scalar,N> >
{
  public :
  typedef genTensor0<scalar,N> ValType;
  void operator() (const genTensor0<scalar,N> &a, ValType &r) const
  {
    r=1./a;
  }
};

template<class scalar,int N> class InverseOp<genTensor2<scalar,N> >
{
public :
  typedef genTensor2<scalar,N> ValType;
  void operator() (const genTensor2<scalar,N> &a, ValType &r) const
  {
    r=a.invert();
  }
};


#endif // _GEN_TENSORINVERSE__H_