
// 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-2021 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 "MotCle.h"
#include "string.h"

    // CONSTRUCTEURS :
   MotCle::MotCle ( const Tableau<string>& TsousMot) : 
       lesmotscles(),tabSous(TsousMot),TabSous_taille(TsousMot.Taille())
       {
       
         lesmotscles.push_back("dynamique_implicite");        lesmotscles.push_back("dynamique_explicite");
         lesmotscles.push_back("dynamique_explicite_tchamwa");lesmotscles.push_back("dynamique_explicite_chung_lee");
         lesmotscles.push_back("dynamique_explicite_zhai");   lesmotscles.push_back("dynamique_Runge_Kutta");
         lesmotscles.push_back("non_dynamique");              lesmotscles.push_back("non_dynamique_avec_contact");
         lesmotscles.push_back("flambement_lineaire_en_implicite_non_dynamique");
         lesmotscles.push_back("informations");
         lesmotscles.push_back("utilitaires");                lesmotscles.push_back("def_schema_xml");
         lesmotscles.push_back("umat_abaqus");                lesmotscles.push_back("dynamique_explicite_bonelli");
         lesmotscles.push_back("dynamique_relaxation_dynam"); lesmotscles.push_back("mixte_statique_dynamique_explicite");
         lesmotscles.push_back("combiner");
         lesmotscles.push_back("TYPE_DE_CALCUL");             lesmotscles.push_back("PARA_TYPE_DE_CALCUL");
         lesmotscles.push_back("==PARA_SPECIFIQUE_SOUS_ALGO==");
         lesmotscles.push_back("==FIN_PARA_SPECIFIQUE_SOUS_ALGO_==");
         lesmotscles.push_back("domaine_esclave");            lesmotscles.push_back("pas_de_sortie_finale_");
         lesmotscles.push_back("nom_maillage");               lesmotscles.push_back("mvt_maitre");
         lesmotscles.push_back("les_courbes_1D");             lesmotscles.push_back("les_fonctions_nD");
         lesmotscles.push_back("choix_materiaux");            lesmotscles.push_back("materiaux");
         lesmotscles.push_back("epaisseurs");                 lesmotscles.push_back("largeurs");
         lesmotscles.push_back("inerties");                   lesmotscles.push_back("sections");
         lesmotscles.push_back("variation_section");
         lesmotscles.push_back("integrale_sur_volume_");
         lesmotscles.push_back("integrale_sur_vol_et_temps_");
         lesmotscles.push_back("orthotropie");                lesmotscles.push_back("reperes_locaux");
         lesmotscles.push_back("statistique_sur_RefNoeuds_");
         lesmotscles.push_back("statistique_sur_RefNoeuds_et_temps_");
         lesmotscles.push_back("charges");                    lesmotscles.push_back("blocages");
         lesmotscles.push_back("masse_addi");                 lesmotscles.push_back("initialisation");
         lesmotscles.push_back("typecharge");                 lesmotscles.push_back("controle");
         lesmotscles.push_back("controle_contact");           lesmotscles.push_back("noeuds");
         lesmotscles.push_back("elements");                   lesmotscles.push_back("resultats");
         lesmotscles.push_back("nom_maillage");               lesmotscles.push_back("flotExterne"); 
         lesmotscles.push_back("para_syteme_lineaire");       lesmotscles.push_back("para_pilotage_equi_global");         
         lesmotscles.push_back("para_dedies_dynamique");      lesmotscles.push_back("para_affichage");
         lesmotscles.push_back("masse_volumique");            lesmotscles.push_back("dilatation_thermique");
         lesmotscles.push_back("para_contact");               lesmotscles.push_back("def_mouvement_solide_initiaux_");
         lesmotscles.push_back("zone_contact");               lesmotscles.push_back("auto_contact");
         lesmotscles.push_back("glue_contact");               lesmotscles.push_back("contact_solide_deformable");
         lesmotscles.push_back("para_calculs_geometriques");  lesmotscles.push_back("para_energie");
         lesmotscles.push_back("condition_limite_lineaire_"); lesmotscles.push_back("renumerotation_tous_maillages_");
         lesmotscles.push_back("renumerotation_des_noeuds_"); lesmotscles.push_back("hourglass_gestion_");
         lesmotscles.push_back("stabilisation_transvers_membrane_biel_");
         lesmotscles.push_back("suppression_noeud_non_references_");
         lesmotscles.push_back("fusion_avec_le_maillage_precedent_");
         lesmotscles.push_back("def_auto_ref_frontiere_");    lesmotscles.push_back("_suite_point_info_");
         lesmotscles.push_back("_fin_point_info_");           lesmotscles.push_back("_pause_point_info_");
         lesmotscles.push_back("repere_anisotropie_");         lesmotscles.push_back("Constantes_utilisateurs_");
         lesmotscles.push_back("Mise_A_jour_Constantes_utilisateurs_");
         lesmotscles_taille=lesmotscles.size(); // la taille  
         itdeb=lesmotscles.begin(); itfin=lesmotscles.end();  
        };												      


bool MotCle::SimotCle(char* tabcar)
  { // recherche dans les mots cles principaux
    for (it=itdeb ; it != itfin; it++)
     {//string  toto = (*it);
//      if(strstr(tabcar,(*it))!=NULL)
      if(strstr(tabcar,((char*) (*it).c_str())) != NULL)
        {
//         #ifdef MISE_AU_POINT
//         if (ParaGlob::NiveauImpression() > 7)
//           { cout << "\n MotCle::SimotCle(... "
//                  << "\n tabcar= "<<tabcar
//                  << "\n ((char*) (*it).c_str())= "<<((char*) (*it).c_str())
//                  << flush;
//           };
//         #endif
         return true;
        }
     };
    // recherche dans les sous mot cle
    for (int i=1;i<=TabSous_taille;i++)
//       if(strstr(tabcar,tabSous(i))!=NULL) 
       if(strstr(tabcar,((char*) (tabSous(i).c_str())))!=NULL) 
            return true;
    return false; 
  } 
          
