New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 663 for trunk/AGRIF/LIB/UtilNotGridDep.c – NEMO

Ignore:
Timestamp:
2007-05-25T18:00:33+02:00 (17 years ago)
Author:
opalod
Message:

RB: update CONV

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/AGRIF/LIB/UtilNotGridDep.c

    r530 r663  
    33/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */ 
    44/*                                                                            */ 
    5 /* Copyright or © or Copr. Laurent Debreu (Laurent.Debreu@imag.fr)            */ 
    6 /*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */ 
     5/* Copyright or   or Copr. Laurent Debreu (Laurent.Debreu@imag.fr)            */ 
     6/*                        Cyril Mazauric (Cyril_Mazauric@yahoo.fr)            */ 
    77/* This software is governed by the CeCILL-C license under French law and     */ 
    88/* abiding by the rules of distribution of free software.  You can  use,      */ 
     
    3131/* knowledge of the CeCILL-C license and that you accept its terms.           */ 
    3232/******************************************************************************/ 
    33 /* version 1.0                                                                */ 
     33/* version 1.6                                                                */ 
    3434/******************************************************************************/ 
    3535#include <stdio.h> 
     
    3939 
    4040/******************************************************************************/ 
    41 /*                        ajoutenotgriddep                                    */ 
     41/*                     Add_NotGridDepend_Var_1                                */ 
    4242/******************************************************************************/ 
    43 /* This subroutine is used to add a record into listenotgriddepend            */ 
     43/* This subroutine is used to add a record into List_NotGridDepend_Var        */ 
    4444/*    This variable is add only if it is not present in the list              */ 
    4545/*    This variable is add at the end of the list                             */ 
     
    5151/*                                                                            */ 
    5252/******************************************************************************/ 
    53 void ajoutenotgriddep (char *name) 
     53void Add_NotGridDepend_Var_1 (char *name) 
    5454{ 
     55   listvar *parcours; 
     56   listvar *newvar; 
    5557   /*                                                                         */ 
    56    variabletempo =(variable *)NULL; 
    57    listvartempo=(listvar *)NULL; 
    58    /* create the record                                                       */ 
    59    variabletempo=createvar(name,NULL); 
    60    /* look in the listenotgriddepend if this variable exist                   */ 
    61    listvartempo = listenotgriddepend; 
    62    while (listvartempo) 
     58   /* look in the List_NotGridDepend_Var if this variable exist               */ 
     59   parcours = List_NotGridDepend_Var; 
     60   while (parcours) 
    6361   { 
    64      if (!strcasecmp(listvartempo->var->nomvar,name)) 
     62     if (!strcasecmp(parcours->var->v_nomvar,name)) 
    6563     { 
    6664        /* if this variable exist -> exit of the program                      */ 
     
    7068        exit(1); 
    7169     } 
    72       listvartempo= listvartempo->suiv; 
     70     parcours= parcours->suiv; 
    7371   } 
    7472   /* if variable does not exist, we add it                                   */ 
    75    listvartempo = insertvar(listenotgriddepend,variabletempo); 
    76    listenotgriddepend = listvartempo; 
    77 } 
    78  
    79 /******************************************************************************/ 
    80 /*                           RemoveNotgriddependFromGlobliste                 */ 
    81 /******************************************************************************/ 
    82 /* This subroutine is used to remove from the globliste all variables         */ 
    83 /* which are not grid dependent                                               */ 
    84 /******************************************************************************/ 
    85 /*        _______     _______     _______     _______     _______             */ 
    86 /*       +      +    +      +    +      +    +      +    +      +             */ 
    87 /*       + glob +--->+ glob +--->+ glob +--->+ glob +--->+ glob +             */ 
    88 /*       +______+    +______+    +______+    +______+    +______+             */ 
    89 /*                                          not grid                          */ 
    90 /*                                            remove                          */ 
    91 /*                                                                            */ 
    92 /******************************************************************************/ 
    93 void RemoveNotgriddependFromGlobliste() 
    94 { 
    95    listvar  *newvarglobliste; 
    96    listvar  *newvargloblistePrec; 
    97    listvar  *newvarnotgriddepend; 
    98    listvar  *newvarnotgriddependPrec; 
    99    int      Out; 
    100    int      Out1; 
    101     
    102    if ( listenotgriddepend ) 
    103    { 
    104       newvargloblistePrec = (listvar *)NULL; 
    105       newvarnotgriddependPrec = (listvar *)NULL; 
    106       /* Read of the globliste                                                */ 
    107       newvarglobliste = globliste; 
    108       Out1 = 1 ; 
    109       while ( newvarglobliste && Out1 == 1 ) 
    110       { 
    111          newvarnotgriddepend = listenotgriddepend; 
    112     Out = 1 ; 
    113          /* Read of the notgriddepend                                         */ 
    114     while ( newvarnotgriddepend && Out == 1 ) 
    115     { 
    116             /* If the variable is in the notgriddepend list                   */ 
    117        if ( ! strcasecmp(newvarglobliste->var->nomvar, 
    118                                              newvarnotgriddepend->var->nomvar) ) 
    119        { 
    120                /* We should go out of the loop so Out = 0                     */ 
    121                Out = 0 ; 
    122           /* We remove the variable from the globliste                   */ 
    123           /* If we are at the beginning of the globliste                 */ 
    124                if ( newvarglobliste == globliste ) 
    125                { 
    126                   globliste = globliste->suiv;           
    127                } 
    128                else 
    129                { 
    130                   newvargloblistePrec->suiv = newvarglobliste->suiv; 
    131                   newvarglobliste = newvargloblistePrec; 
    132                } 
    133                /* We remove the variable from the notgriddepend list          */ 
    134               if ( newvarnotgriddepend == listenotgriddepend ) 
    135               { 
    136                  listenotgriddepend = listenotgriddepend->suiv;            
    137               } 
    138               else 
    139               { 
    140                  newvarnotgriddependPrec->suiv = newvarnotgriddepend->suiv; 
    141                  newvarnotgriddepend = newvarnotgriddependPrec; 
    142                } 
    143        } 
    144             /* If the variable is not in the notgriddepend list               */ 
    145        else 
    146        { 
    147           newvarnotgriddependPrec = newvarnotgriddepend; 
    148           newvarnotgriddepend = newvarnotgriddepend->suiv; 
    149        } 
    150     } 
    151     /* If the notgriddepend list is empty we go out of this subroutine   */ 
    152     if ( !listenotgriddepend ) 
    153     { 
    154        Out1 = 0; 
    155     } 
    156     newvargloblistePrec = newvarglobliste; 
    157     newvarglobliste = newvarglobliste->suiv; 
    158       } 
    159    } 
     73   newvar=(listvar *)malloc(sizeof(listvar)); 
     74   newvar->var=(variable *)malloc(sizeof(variable)); 
     75   strcpy(newvar->var->v_nomvar,name); 
     76   strcpy(newvar->var->v_commoninfile,mainfile); 
     77   strcpy(newvar->var->v_subroutinename,subroutinename); 
     78   newvar->var->v_notgrid = 1 ; 
     79   newvar->suiv = List_NotGridDepend_Var; 
     80   List_NotGridDepend_Var = newvar; 
    16081} 
    16182 
     
    17697   int out; 
    17798 
    178    newvar = listenotgriddepend; 
     99   newvar = List_NotGridDepend_Var; 
    179100   out=0; 
    180101   while (newvar && out == 0 ) 
    181102   { 
    182       if ( !strcasecmp(newvar->var->nomvar,name) ) out = 1; 
     103      if ( !strcasecmp(newvar->var->v_nomvar,name) ) out = 1; 
    183104      else newvar = newvar->suiv; 
    184105   } 
    185106   return out; 
    186107} 
    187  
    188  
    189 /******************************************************************************/ 
    190 /*                       NonGridDepDeclaration_0                              */ 
    191 /******************************************************************************/ 
    192 /* Firstpass 0                                                                */ 
    193 /* We should modify this declaration in the file fortranout                   */ 
    194 /******************************************************************************/ 
    195 void NonGridDepDeclaration_0(listvar *listtomodify) 
    196 { 
    197    if ( (aftercontainsdeclare == 0 && VariableIsParameter == 0) ) 
    198    { 
    199       if (firstpass == 0) 
    200       { 
    201          pos_end = setposcur(); 
    202          RemoveWordSET_0(fortranout,pos_cur, 
    203                                pos_end-pos_cur); 
    204          /* Modifications of declarations */ 
    205          NonGridDepDeclaration(listtomodify); 
    206       } 
    207    } 
    208 } 
Note: See TracChangeset for help on using the changeset viewer.