// 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)


#include "genDElement.h"
#include "genDElementManager.h"
#include "genDataGroup.h"

template<class E> void DElementBase<E>::addToManager(const Key &key)
{
  KeyManagerBase<E>::getInstance()->addDElement(key,this);
}

template<class E> std::ostream & operator<<(std::ostream &os, const DElementBase<E> &de)
{
  std::streamsize width = os.width();
  os.width(width); os <<"";
  os << "DElement[" << de.getDim() << "D," << de.getNum() << "] : ";
  if(de.get()) os << de.get();
  os << "\n";
  Key key;
  de.getKey(key);
  os.width(width+2);
  os << key;
  genDataGroup* datas = de.getDatas();
  if (datas)
  {
    os.width(width+2);
    os << *datas;
  }
  return os;
}
