// This file is part of the Herezh++ application.
//
// The finite element software Herezh++ is dedicated to the field
// of mechanics for large transformations of solid structures.
// It is developed by Gérard Rio (APP: IDDN.FR.010.0106078.000.R.P.2006.035.20600)
// INSTITUT DE RECHERCHE DUPUY DE LÔME (IRDL) <https://www.irdl.fr/>.
//
// Herezh++ is distributed under GPL 3 license ou ultérieure.
//
// Copyright (C) 1997-2022 Université Bretagne Sud (France)
// AUTHOR : Gérard Rio
// E-MAIL  : gerardrio56@free.fr
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
// For more information, please consult: <https://herezh.irdl.fr/>.

//#include "Debug.h"
# include "DeformationP2D.h"
# include "Met_pout2D.h"
#include "ConstMath.h" 
#include "ParaGlob.h"
#include "Util.h"


// ---------- constructeur----------------------------------------

DeformationP2D::DeformationP2D ()   // constructeur ne devant pas etre utilise
   {
     #ifdef MISE_AU_POINT	 	 
		{ cout << "\nErreur : le constructeur par defaut ne doit pa etre utilise !\n";
			  cout << "DeformationP2D::DeformationP2D () \n";
			  Sortie(1);
			};
     #endif
   };
// constructeur normal dans le cas d'un ou de plusieurs pt d'integration             	  
DeformationP2D::DeformationP2D (Met_abstraite & a,Tableau<Noeud *>& tabnoeud    
           ,Tableau <Mat_pleine>  const & tabDphiH,Tableau <Vecteur>  const & tabPhiH
           ,Tableau <Mat_pleine>  const & tabDphiS,Tableau <Vecteur>  const & tabPhiS
           ,Tableau <Vecteur>  const & taD2phi) :
   DeformationPP (a,tabnoeud,tabDphiH,tabPhiH,tabDphiS,tabPhiS ),tabD2phi()
   { tabD2phi = & taD2phi;
     };
   
// constructeur de copie
DeformationP2D::DeformationP2D ( const DeformationP2D& a) :
   DeformationPP(a) ,tabD2phi()
   { tabD2phi = a.tabD2phi;
    };
     
DeformationP2D::~DeformationP2D () 
   { }; 
   
//  ============      METHODES PUBLIQUES :  ==================
    // Surcharge de l'operateur = : realise l'affectation
    // fonction virtuelle, normalement ne devrait pas être utilisé
    // si c'est le cas -> affichage d'un message d'erreur
Deformation& DeformationP2D::operator= (const Deformation& )
  {	// normalement ne devrait pas être utilisé
    cout << "\n erreur , l operateur d affectation a utiliser  doit etre celui explicite "
         << " de la classe DeformationP2D \n"
         << " Deformation& DeformationP2D::operator= (const Deformation& def) \n";
    Sortie(1);     
    return (*this);	
   };
DeformationPP& DeformationP2D::operator= (const DeformationPP& )
  {	// normalement ne devrait pas être utilisé
    cout << "\n erreur , l operateur d affectation a utiliser  doit etre celui explicite "
         << " de la classe DeformationP2D \n"
         << " DeformationPP& DeformationP2D::operator= (const DeformationPP& def) \n";
    Sortie(1);     
    return (*this);	
   };
    // fonction normale
DeformationP2D& DeformationP2D::operator= (const DeformationP2D& def)
   {  tabD2phi = def.tabD2phi;
      (*this) =  DeformationPP::operator=(def);
      return (*this);	
    };
    // change les numeros d'integration de surface et d'epaisseur courant    
    void DeformationP2D::ChangeNumIntegSH
            (int nisurf, int niepaiss)
      { // appel de la fonction mère
       DeformationPP::ChangeNumIntegSH ( nisurf,niepaiss);
        // passage de la dérivée seconde
       Met_Pout2D* met_p = (Met_Pout2D*) metrique;
       met_p->DeriveeSeconde((*tabD2phi)(nisurf));  
       } ;