X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHOMARD%2FHOMARD_Iteration.cxx;h=0101bd91a0e2bf5acb07c5524dbf8822305e32bd;hb=refs%2Ftags%2FV9_13_0b1;hp=e9ec47322c0fc9fbd930775a9af3275e559dd6d2;hpb=1c6323738abcad71a526a610c347ffeb081cfa44;p=modules%2Fhomard.git diff --git a/src/HOMARD/HOMARD_Iteration.cxx b/src/HOMARD/HOMARD_Iteration.cxx index e9ec4732..0101bd91 100644 --- a/src/HOMARD/HOMARD_Iteration.cxx +++ b/src/HOMARD/HOMARD_Iteration.cxx @@ -1,11 +1,11 @@ // HOMARD HOMARD : implementation of HOMARD idl descriptions // -// Copyright (C) 2011-2013 CEA/DEN, EDF R&D +// Copyright (C) 2011-2024 CEA, EDF // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -19,7 +19,7 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // File : HOMARD_Iteration.cxx -// Author : Paul RASCLE, EDF +// Author : Gerald NICOLAS, EDF // Module : HOMARD // // Remarques : @@ -32,6 +32,7 @@ // Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier #include "HOMARD_Iteration.hxx" +#include "HOMARD.hxx" #include "utilities.h" //============================================================================= @@ -40,7 +41,7 @@ */ //============================================================================= HOMARD_Iteration::HOMARD_Iteration(): - _Name( "" ), _Etat( false ), + _Name( "" ), _Etat( 0 ), _NumIter( -1 ), _NomMesh( "" ), _MeshFile( "" ), _FieldFile( "" ), _TimeStep( -1 ), _Rank( -1 ), @@ -50,7 +51,7 @@ HOMARD_Iteration::HOMARD_Iteration(): _FileInfo( "" ), _MessInfo( 1 ) { - MESSAGE("HOMARD_Iter"); + MESSAGE("HOMARD_Iteration"); } //============================================================================= /*! @@ -91,30 +92,63 @@ std::string HOMARD_Iteration::GetDumpPython() const { aScript << "\t" << _Name << " = " << _IterParent << ".NextIteration(\"" << _Name << "\")\n"; } +// L'hypothese (doit etre au debut) + aScript << "\t" << _Name << ".AssociateHypo(\"" << _NomHypo << "\")\n"; // Le nom du maillage produit // MESSAGE (".. maillage produit " << _NomMesh ); aScript << "\t" << _Name << ".SetMeshName(\"" << _NomMesh << "\")\n" ; // Le fichier du maillage produit aScript << "\t" << _Name << ".SetMeshFile(\"" << _MeshFile << "\")\n"; -// Le fichier des champs, avec l'instant eventuel - if ( _FieldFile != "" ) { +// Le fichier des champs + if ( _FieldFile != "" ) + { aScript << "\t" << _Name << ".SetFieldFile(\"" << _FieldFile << "\")\n"; + } +// Si champ de pilotage, valeurs de pas de temps + MESSAGE (". champ de pilotage : _TimeStep = " << _TimeStep << ", _Rank : " << _Rank); + if ( _TimeStep != -1 ) + { if ( _TimeStep == -2 ) { aScript << "\t" << _Name << ".SetTimeStepRankLast()\n"; } else { - if ( ( _TimeStep != -1 ) and ( _Rank != -1 ) ) { - aScript << "\t" << _Name << ".SetTimeStepRank( " << _TimeStep << ", " << _Rank << " )\n"; + if ( _TimeStep != -1 ) + { + if ( _Rank == -1 ) + { + aScript << "\t" << _Name << ".SetTimeStep( " << _TimeStep << " )\n"; + } + else + { + aScript << "\t" << _Name << ".SetTimeStepRank( " << _TimeStep << ", " << _Rank << " )\n"; + } } } } +// Les instants d'interpolation + MESSAGE (". instants d'interpolation "); + std::list::const_iterator it = _ListFieldInterpTSR.begin() ; + while(it != _ListFieldInterpTSR.end()) + { + std::string FieldName = std::string((*it)) ; +// MESSAGE ("... FieldName = "<< FieldName); + (*it++); + std::string TimeStepstr = std::string((*it)) ; +// MESSAGE ("... TimeStepstr = "<< TimeStepstr); + (*it++); + std::string Rankstr = std::string((*it)) ; +// MESSAGE ("... Rankstr = "<< Rankstr); + (*it++); + aScript << "\t" << _Name << ".SetFieldInterpTimeStepRank( \"" << FieldName << "\"" ; + aScript << ", " << TimeStepstr ; + aScript << ", " << Rankstr << " )\n" ; + } -// MESSAGE (".. Hypothese " << _NomHypo ); - aScript << "\t" << _Name << ".AssociateHypo(\"" << _NomHypo << "\")\n"; - - if (_Etat == true) { aScript << "\tcodret = " <<_Name << ".Compute(1, 2)\n"; } - else { aScript << "\t#codret = " <<_Name << ".Compute(1, 2)\n"; } +// Compute + MESSAGE (". Compute "); + if ( _Etat == 2 ) { aScript << "\tcodret = " <<_Name << ".Compute(1, 1)\n"; } + else { aScript << "\t#codret = " <<_Name << ".Compute(1, 1)\n"; } // MESSAGE (". Fin de l ecriture de l iteration " << _Name ); return aScript.str(); @@ -184,6 +218,13 @@ std::string HOMARD_Iteration::GetFieldFile() const return _FieldFile; } //============================================================================= +// Instants pour le champ de pilotage +//============================================================================= +void HOMARD_Iteration::SetTimeStep( int TimeStep ) +{ + _TimeStep = TimeStep; +} +//============================================================================= void HOMARD_Iteration::SetTimeStepRank( int TimeStep, int Rank ) { _TimeStep = TimeStep; @@ -205,6 +246,56 @@ int HOMARD_Iteration::GetRank() const return _Rank; } //============================================================================= +// Instants pour un champ a interpoler +//============================================================================= +void HOMARD_Iteration::SetFieldInterpTimeStep( const char* FieldInterp, int TimeStep ) +{ + SetFieldInterpTimeStepRank( FieldInterp, TimeStep, TimeStep ) ; +} +//============================================================================= +void HOMARD_Iteration::SetFieldInterpTimeStepRank( const char* FieldInterp, int TimeStep, int Rank ) +{ + MESSAGE("Champ " << FieldInterp << ", hypothese " << _NomHypo ); +// Verification de la presence du champ dans l'hypothese + std::list::iterator it = find( _ListFieldInterp.begin(), _ListFieldInterp.end(), FieldInterp ); + if ( it == _ListFieldInterp.end() ) + { + INFOS("Champ " << FieldInterp << " ; hypothese " << _NomHypo ) + VERIFICATION("Le champ est inconnu dans l'hypothese associee a cette iteration." == 0); + } + +// . Nom du champ + _ListFieldInterpTSR.push_back( std::string( FieldInterp ) ); +// . Pas de temps + std::stringstream saux1 ; + saux1 << TimeStep ; + _ListFieldInterpTSR.push_back( saux1.str() ); +// . Numero d'ordre + std::stringstream saux2 ; + saux2 << Rank ; + _ListFieldInterpTSR.push_back( saux2.str() ); +} +//============================================================================= +const std::list& HOMARD_Iteration::GetFieldInterpsTimeStepRank() const +{ + return _ListFieldInterpTSR; +} +//============================================================================= +void HOMARD_Iteration::SetFieldInterp( const char* FieldInterp ) +{ + _ListFieldInterp.push_back( std::string( FieldInterp ) ); +} +//============================================================================= +const std::list& HOMARD_Iteration::GetFieldInterps() const +{ + return _ListFieldInterp; +} +//============================================================================= +void HOMARD_Iteration::SupprFieldInterps() +{ + _ListFieldInterp.clear(); +} +//============================================================================= void HOMARD_Iteration::SetLogFile( const char* LogFile ) { _LogFile = std::string( LogFile ); @@ -240,7 +331,7 @@ void HOMARD_Iteration::UnLinkNextIteration( const char* NomIteration ) if ( it != _mesIterFilles.end() ) { MESSAGE ("Dans UnLinkNextIteration pour " << NomIteration) ; - _mesIterFilles.erase( it ) ; + it = _mesIterFilles.erase( it ) ; } } //=============================================================================