// FICHIER : PentaL.h
// CLASSE : PentaL

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

/************************************************************************
 *     DATE:        23/01/97                                            *
 *                                                                $     *
 *     AUTEUR:      G RIO   (mailto:gerardrio56@free.fr)                *
 *                                                                $     *
 *     PROJET:      Herezh++                                            *
 *                                                                $     *
 ************************************************************************
 *     BUT:   La classe PentaL permet de declarer des elements          *
 * Pentaedriques Trilineaires  et de realiser                           *
 * le calcul du residu local et de la raideur locale pour une loi de    *
 * comportement donnee. La dimension de l'espace pour un tel element    *
 * est 3.                                                               *
 *                                                                      *
 * l'interpolation est trilineaire a 6 noeuds, le nombre de             *
 * point d'integration est  par défaut de 2.                            *
 *     ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''     *                                                                      *
 *     VERIFICATION:                                                    *
 *                                                                      *
 *     !  date  !   auteur   !       but                          !     *
 *     ------------------------------------------------------------     *
 *     !        !            !                                    !     *
 *                                                                $     *
 *     ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''     *
 *     MODIFICATIONS:                                                   *
 *     !  date  !   auteur   !       but                          !     *
 *     ------------------------------------------------------------     *
 *                                                                $     *
 ************************************************************************/
 
// -----------classe pour un calcul de mecanique---------



#ifndef PENTAL_H
#define PENTAL_H

#include "ParaGlob.h"
#include "ElemMeca.h"
#include "Met_abstraite.h"
#include "GeomQuadrangle.h"
#include "Noeud.h"
#include "UtilLecture.h"
#include "Tenseur.h"
#include "NevezTenseur.h"
#include "Deformation.h"
#include "PentaMemb.h"
#include "FrontTriaLine.h"
#include "FrontQuadLine.h"
#include "FrontSegLine.h"


/// @addtogroup groupe_des_elements_finis
///  @{
///


class PentaL : public PentaMemb
{
		
	public :
	
		// CONSTRUCTEURS :
		
		// Constructeur par defaut 
		PentaL ();
		
		// Constructeur  fonction  d'un numero
		// d'identification 
		PentaL (int num_mail,int num_id);
		
		// Constructeur fonction  d'un numero de maillage et d'identification et
		// du tableau de connexite des noeuds 
		PentaL (int num_mail,int num_id,const Tableau<Noeud *>& tab);
		
		// Constructeur de copie
		PentaL (const PentaL& Penta);
		
		
		// DESTRUCTEUR :
		~PentaL ();
				
		// création d'un élément de copie: utilisation de l'opérateur new et du constructeur de copie 
		// méthode virtuelle
  Element* Nevez_copie() const { Element * el= new PentaL(*this); return el;};

		// Surcharge de l'operateur = : realise l'egalite entre deux instances de PentaL
		PentaL& operator= (PentaL& Penta);
		
		// METHODES :
  // 1) derivant des virtuelles pures
                         
  // affichage dans la sortie transmise, des variables duales "nom"
  // aux differents points d'integration
  // dans le cas ou nom est vide, affichage de "toute" les variables
  void AfficheVarDual(ostream& sort, Tableau<string>& nom);
        
  // 2) derivant des virtuelles
  // 3) methodes propres a l'element

	protected :
	  
  // adressage des frontières linéiques et surfacique
  // définit dans les classes dérivées, et utilisées pour la construction des frontières
     // frontière linéique verticale (rectangle)
  ElFrontiere* new_frontiere_lin_rec(Tableau <Noeud *> & tab, DdlElement& ddelem)
    { return ((ElFrontiere*) (new FrontSegLine(tab,ddelem)));};
     // frontière linéique horizontale (triangle)
  ElFrontiere* new_frontiere_lin_tri(Tableau <Noeud *> & tab, DdlElement& ddelem)
    { return ((ElFrontiere*) (new FrontSegLine(tab,ddelem)));};
     // frontière surfacique verticale (rectangle)
  ElFrontiere* new_frontiere_surf_rec(Tableau <Noeud *> & tab, DdlElement& ddelem)
    { return ((ElFrontiere*) (new FrontQuadLine(tab,ddelem)));};
     // frontière surfacique horizontale (triangle)
  ElFrontiere* new_frontiere_surf_tri(Tableau <Noeud *> & tab, DdlElement& ddelem)
    { return ((ElFrontiere*) (new FrontTriaLine(tab,ddelem)));};
  
  // VARIABLES PRIVEES :
  // place memoire commune a tous les elements PentaL
  static PentaMemb::DonnComPenta * doCoPentaL;
  // idem mais pour les indicateurs qui servent pour l'initialisation
  static PentaMemb::UneFois  uneFois;

  class  NombresConstruirePentaL : public NombresConstruire
	     {  public: NombresConstruirePentaL(); 
	      };
  static NombresConstruirePentaL nombre_V; // les nombres propres à l'élément
	     		
  // GESTION AUTOMATIQUE D'AJOUT D'ELEMENT DANS LE PROGRAMME
  //ajout de l'element dans la liste : listTypeElemen, geree par la class Element
  class ConsPentaL : public ConstrucElement
    { public :  ConsPentaL ()
         { NouvelleTypeElement nouv(PENTAEDRE,LINEAIRE,MECA_SOLIDE_DEFORMABLE,this);
           if (ParaGlob::NiveauImpression() >= 4)
               cout << "\n initialisation PentaL" << endl;
           Element::listTypeElement.push_back(nouv);
          };
      Element * NouvelElement(int num_maill,int num) // un nouvel élément sans rien
         {Element * pt;
          pt  = new PentaL (num_maill,num) ;
          return pt;};
      // ramene true si la construction de l'element est possible en fonction
      // des variables globales actuelles: ex en fonction de la dimension
      bool Element_possible() { if (ParaGlob::Dimension() == 3) return true; else return false;};
     };
  static ConsPentaL consPentaL;
  static int bidon; // a virer lorsque l'on n'aura plus a declarer une instance dans herezh
};
/// @}  // end of group
#endif