// thermal - A linear solver for elastic problems using FEM
// 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: Frederic Duboeuf (rev.2285)


#ifndef _THERMAL_DOMAIN_H_
#define _THERMAL_DOMAIN_H_

#include <string>
#include <vector>

#include "genSupports.h"
#include "genTerm.h"
#include "genTensors.h"
#include "genDataIO.h"
#include "genMatrix.h"
#include "savedGenTerm.h"

class ThermalDomain : public genSupport
{
public :
  genTerm<genTensor2<double>,0>::ConstHandle C; //thermal conductivity tensor

public :
  ThermalDomain(const genDomain &s)
  {
    dim=s.dim;
    tag=s.tag;
    const genMatrix<double> & mC=s.Tensors.find("C")->second;
    genTensor2<double> therm;
    FromVoigtNotation(mC,therm);
    C = genTerm<genTensor2<double>,0>::Handle(new ConstantField<genTensor2<double> >(therm));
  }
  ThermalDomain() : genSupport() {}
  virtual ~ThermalDomain() {};
};

class IsotropicThermalDomain : public ThermalDomain
{
public :
  double lambda; // specific thermal data (isotropic)

public :
  IsotropicThermalDomain(const genDomain &s)
  {
    dim=s.dim;
    tag=s.tag;
    lambda = s.Scalars.find("lambda")->second;
    update();
  }
  IsotropicThermalDomain () : ThermalDomain() {}
  ~IsotropicThermalDomain () {}
  void update ()
  {
    genTensor2<double>  thermal(lambda);
    C = genTerm<genTensor2<double>,0>::Handle(new ConstantField<genTensor2<double> >(thermal));
  }
};

#endif// _THERMAL_DOMAIN_H_