// genDElement - An abstract data element library
// Copyright (C) 2013-2026 Eric Bechet, Frederic Duboeuf
//
// See the LICENSE file for license information.
// Please report all bugs and problems to <bechet@cadxfem.org> or <duboeuf@outlook.com>.
//
// Initial design: Frederic Duboeuf (rev.1501)


#ifndef _GEN_DELEMENT_TRAITS_H_
#define _GEN_DELEMENT_TRAITS_H_

#include "MElement.h"
#include "MVertex.h"
#include "MEdge.h"
#include "MFace.h"

template<class E> class DElementBase;
template<class E,class D1,class D2,class D3> class DElement;

class nothing {};

// Traits
template<class E, class D1=nothing, class D2=nothing, class D3=nothing> struct DElementTraits
{
  typedef DElementBase<E> DElementBaseType;
  typedef D1 Data1Type;
  typedef D2 Data2Type;
  typedef D3 Data3Type;
  typedef DElement<E,Data1Type,Data2Type,Data3Type> DElementType;
};


template<class DE> class nothingTemplate {};
template<class E, template<class DE1> class D1, template<class DE2> class D2, template<class DE3> class D3> struct DElementTraitsTemplate
{
  typedef DElementBase<E> DElementBaseType;
  typedef D1<E> Data1Type;
  typedef D2<E> Data2Type;
  typedef D3<E> Data3Type;
  typedef DElement<E,Data1Type,Data2Type,Data3Type> DElementType;
};
template<class E, template<class DE1> class D1, template<class DE2> class D2> struct DElementTraitsTemplate<E,D1,D2,nothingTemplate>
{
  typedef DElementBase<E> DElementBaseType;
  typedef D1<E> Data1Type;
  typedef D2<E> Data2Type;
  typedef nothing Data3Type;
  typedef DElement<E,Data1Type,Data2Type,Data3Type> DElementType;
};
template<class E, template<class DE1> class D1> struct DElementTraitsTemplate<E,D1,nothingTemplate,nothingTemplate>
{
  typedef DElementBase<E> DElementBaseType;
  typedef D1<E> Data1Type;
  typedef nothing Data2Type;
  typedef nothing Data3Type;
  typedef DElement<E,Data1Type,Data2Type,Data3Type> DElementType;
};


template<class E> struct ElementTraits
{
  typedef E VertexType;
  typedef E EdgeType;
  typedef E FaceType;
};

template<> struct ElementTraits<MElement>
{
  typedef MVertex VertexType;
  typedef MEdge EdgeType;
  typedef MFace FaceType;
};

#endif // _GEN_DELEMENT_TRAITS_H_