* TOPOSAUV PROCEDUR FD218221 25/12/18 21:15:14 12429 ************************************************************************ ** Procedure called by TOPOPTIM for saving some data for restart and ** user-requested outputs. ** ** Author: ** Guenhael Le Quilliec (LaMe - Polytech Tours) ** ** Version: ** 4.0 2025/11/17 Made compatible with TOPOPTIM V4.0 ** 3.0 2021/04/15 Made compatible with TOPOPTIM V3.0 ** 2.0 2018/02/09 Always save the last cycle data in case of early ** stop of the optimization process for safe restart ** and delete the previous cycle data if it did not need ** to be saved ** 1.0 2017/04/18 Initial version ************************************************************************ * TODO sauver X et TOPO dans les tables utilisateur et dans RTABLE * Input data * ********** Wtab = tab.'WTABLE' ; Ltab = Wtab.'LOGIQUE' ; * Initialize restart table if it does not exists FINS ; Rtab = tab.'RTABLE' ; * Base model modB = Wtab.'MODELE_B' ; * Current cycle number cyc = Wtab.'CYCLE' ; * Number of cycles since the last call to TOPOPTIM nbritr = Wtab.'ITERATION' ; * Fixed zone LF = Ltab.'ZONE_FIGEE' ; SI LF ; uniF = Wtab.'UNIT_F' ; FINS ; * Update output evolutions * ************************ * Table of evolutions lstevo = tab.'EVOLUTIONS' ; * Value name * Get its value var = FAUX ; var = Wtab.varnam ; SINO ; var = tab.varnam ; FINS ; FINS ; * Update its value if it is 'FRACTION_VOLUME' or 'TEMPS_CYCLE' SI (EGA varnam 'FRACTION_VOLUME') ; modD = Wtab.'MODELE_D' ; matD = Wtab.'CARACTERISTIQUES_D' ; Wtab.'VOLUME_TOTAL_D' ; FINS ; var = Wtab.'FRACTION_VOLUME' ; FINS ; SI (EGA varnam 'TEMPS_CYCLE') ; Wtab.'TEMPS_CYCLE' = var ; FINS ; * If value exists * Initialize the corresponding evolutions if they do not already exist FINS ; * Update evolution evo = lstevo.varnam ; tmp3 = Wtab.'EVOLUTIONS_COULEUR'.varnam ; FINS ; SINO ; ' inconnue. Son evolution n''a pas ete sauvegardee.') ; FINS ; FIN itr ; * Save restart data * ***************** * Save in a "restart table", any data that would be needed to * restart the optimization exactly where it was previously stopped. * Using this table, the final result should be exactly the same as * if the user didn't change any input data between the two calls. * Output fields are defined on B, not on D, as F may evolve between * tow successive calls to TOPOPTIM. * Remark: the user is not supposed to change anything in this table. * Reset restart table Rtab = tab.'RTABLE' ; * Restart save SI tab.'SAUVEGARDE_DE_REPRISE' ; * Save next cycle design variables Rtab.'X_B' = Wtab.'X_D' ; SI LF ; * Combine the X field on D with the unitary field on F * This creates a 2-zone field merged into a single zone * field, preserving the original element order using REDU FINS ; * Save next cycle intermediate densities Rtab.'S_B' = Wtab.'S_D' ; SI LF ; * Combine the X field on D with the unitary field on F * This creates a 2-zone field merged into a single zone * field, preserving the original element order using REDU FINS ; * Save next cycle physical densities Rtab.'Y_B' = Wtab.'Y_D' ; SI LF ; * Combine the Y field on D with the unitary field on F * This creates a 2-zone field merged into a single zone * field, preserving the original element order using REDU FINS ; * As any call to MFIL to get the hat filter matrix can be time * consuming, we always save any existing hat filter matrix to allow * reusing it without recalculating it. Rtab.'FILTRE_CHAPEAU_NORMALISE' = Wtab.'FILTRE_CHAPEAU_NORMALISE' ; * If FILTRE_CHAPEAU_NORMALISE exists, then FILTRE_CHAPEAU_MODIFIE might also * exist and should be saved too. Rtab.'FILTRE_CHAPEAU_MODIFIE' = Wtab.'FILTRE_CHAPEAU_MODIFIE' ; FINS ; * Save their corresponding identification extra data that will * later be used to know if the hat filter matrices need to be * updated (i.e., if one of those corresponding parameters has * changed) Rtab.'FILTRE_CHAPEAU_ID' = Wtab.'FILTRE_CHAPEAU_ID' ; FINS ; * Copy loading and mechanism for modification detection res = Wtab.'RESOLUTION_B' ; ldg = res.'CHARGEMENT' ; SINO ; Rtab.'CHARGEMENT' = ldg ; FINS ; SI Ltab.'MECANISME' ; ldg1 = tab.'MECANISME' ; SINO ; Rtab.'MECANISME' = ldg1 ; FINS ; FINS ; * MMA data Rtab.'MMA' = Wtab.'MMA' ; FINS ; * Projection data SI Ltab.'PROJECTION_VOLUME_CONSTANT' ; Rtab.'PROJECTION_SEUIL' = Wtab.'PROJECTION_SEUIL' ; FINS ; SINO ; * Delete RTABLE from tab ; OTER tab 'RTABLE' ; FINS ; * Save user requested data * ************************ * If this cycle has to be saved or if it is the final cycle * Save the design variables (X) SI tab.'MES_SAUVEGARDES'.'X' ; * Copy X from Rtab except if it is the first cycle as X in Rtab may * differe from the actual initial design variables tab.'X'.cyc = Rtab.'X_B' ; SINO ; tab.'X'.cyc = Wtab.'X_D_PRECED' ; SI LF ; * Combine the X field on D with the unitary field on F * This creates a 2-zone field merged into a single zone * field, preserving the original element order using REDU FINS ; FINS ; FINS ; * Save the intermediate densities (S) SI tab.'MES_SAUVEGARDES'.'X_FILTRE' ; * Copy S from Rtab except if it is the first cycle as X in Rtab may * differe from the actual initial design variables tab.'X_FILTRE'.cyc = Rtab.'S_B' ; SINO ; tab.'X_FILTRE'.cyc = Wtab.'S_D_PRECED' ; SI LF ; * Combine the X field on D with the unitary field on F * This creates a 2-zone field merged into a single zone * field, preserving the original element order using REDU FINS ; FINS ; FINS ; * Save the physical densities (Y) SI tab.'MES_SAUVEGARDES'.'TOPOLOGIE' ; * Copy Y from Rtab except if it is the first cycle as Y in Rtab may * differe from the actual initial design variables tab.'TOPOLOGIE'.cyc = Rtab.'Y_B' ; SINO ; tab.'TOPOLOGIE'.cyc = Wtab.'Y_D_PRECED' ; SI LF ; * Combine the Y field on D with the unitary field on F * This creates a 2-zone field merged into a single zone * field, preserving the original element order using REDU FINS ; FINS ; FINS ; * Save the mesh SI tab.'MES_SAUVEGARDES'.'MAILLAGE' ; tab.'MAILLAGE'.cyc = Wtab.'MAILLAGE_A' ; FINS ; * Save the resolution data SI tab.'MES_SAUVEGARDES'.'RESOLUTION' ; tab.'RESOLUTION'.cyc = Wtab.'RESOLUTION_A' ; FINS ; FINS ; * Save next cycle design variables, intermediate densities and physical densities * ******************************************************************************* * Save X and Y of the next cycle if the current cycle is the final one, * as the user may want to access them. SI (tab.'MES_SAUVEGARDES'.'X' ET Ltab.'STOP') ; SI tab.'SAUVEGARDE_DE_REPRISE' ; tab.'X'.(cyc + 1) = Rtab.'X_B' ; SINO ; tab.'X'.(cyc + 1) = Wtab.'X_D' ; SI LF ; * Combine the X field on D with the unitary field on F * This creates a 2-zone field merged into a single zone * field, preserving the original element order using REDU FINS ; FINS ; FINS ; SI (tab.'MES_SAUVEGARDES'.'X_FILTRE' ET Ltab.'STOP') ; SI tab.'SAUVEGARDE_DE_REPRISE' ; tab.'X_FILTRE'.(cyc + 1) = Rtab.'S_B' ; SINO ; tab.'X_FILTRE'.(cyc + 1) = Wtab.'S_D' ; SI LF ; * Combine the X field on D with the unitary field on F * This creates a 2-zone field merged into a single zone * field, preserving the original element order using REDU FINS ; FINS ; FINS ; SI (tab.'MES_SAUVEGARDES'.'TOPOLOGIE' ET Ltab.'STOP') ; SI tab.'SAUVEGARDE_DE_REPRISE' ; tab.'TOPOLOGIE'.(cyc + 1) = Rtab.'Y_B' ; SINO ; tab.'TOPOLOGIE'.(cyc + 1) = Wtab.'Y_D' ; SI LF ; * Combine the Y field on D with the unitary field on F * This creates a 2-zone field merged into a single zone * field, preserving the original element order using REDU FINS ; FINS ; FINS ; * And delete them from the previous cycle * - if it is not 0 as this cycle can't exists and * - if it is not in CYCLES_SAUVES oldcyc = cyc - 1 ; FINS ; FINS ; FINS ; FINS ; FINS ; FINS ; * Save data in a file * ******************* * Save the current cycle data if requested * Save design variables SI tab.'MES_SAUVEGARDES'.'X' ; OUBL tab.'X' cyc ; FINS ; * Save intermediate densities SI tab.'MES_SAUVEGARDES'.'X_FILTRE' ; OUBL tab.'X_FILTRE' cyc ; FINS ; * Save physical densities SI tab.'MES_SAUVEGARDES'.'TOPOLOGIE' ; OUBL tab.'TOPOLOGIE' cyc ; FINS ; * Save active mesh SI tab.'MES_SAUVEGARDES'.'MAILLAGE' ; OUBL tab.'MAILLAGE' cyc ; FINS ; * Save resolution SI tab.'MES_SAUVEGARDES'.'RESOLUTION' ; OUBL tab.'RESOLUTION' cyc ; FINS ; FINS ; FINS ; FINP ;
© Cast3M 2003 - Tous droits réservés.
Mentions légales