Changeset 663 for trunk/AGRIF/LIB/UtilNotGridDep.c
- Timestamp:
- 2007-05-25T18:00:33+02:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AGRIF/LIB/UtilNotGridDep.c
r530 r663 3 3 /* CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran) */ 4 4 /* */ 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) */ 7 7 /* This software is governed by the CeCILL-C license under French law and */ 8 8 /* abiding by the rules of distribution of free software. You can use, */ … … 31 31 /* knowledge of the CeCILL-C license and that you accept its terms. */ 32 32 /******************************************************************************/ 33 /* version 1. 0*/33 /* version 1.6 */ 34 34 /******************************************************************************/ 35 35 #include <stdio.h> … … 39 39 40 40 /******************************************************************************/ 41 /* ajoutenotgriddep*/41 /* Add_NotGridDepend_Var_1 */ 42 42 /******************************************************************************/ 43 /* This subroutine is used to add a record into listenotgriddepend*/43 /* This subroutine is used to add a record into List_NotGridDepend_Var */ 44 44 /* This variable is add only if it is not present in the list */ 45 45 /* This variable is add at the end of the list */ … … 51 51 /* */ 52 52 /******************************************************************************/ 53 void ajoutenotgriddep(char *name)53 void Add_NotGridDepend_Var_1 (char *name) 54 54 { 55 listvar *parcours; 56 listvar *newvar; 55 57 /* */ 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) 63 61 { 64 if (!strcasecmp( listvartempo->var->nomvar,name))62 if (!strcasecmp(parcours->var->v_nomvar,name)) 65 63 { 66 64 /* if this variable exist -> exit of the program */ … … 70 68 exit(1); 71 69 } 72 listvartempo= listvartempo->suiv;70 parcours= parcours->suiv; 73 71 } 74 72 /* 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; 160 81 } 161 82 … … 176 97 int out; 177 98 178 newvar = listenotgriddepend;99 newvar = List_NotGridDepend_Var; 179 100 out=0; 180 101 while (newvar && out == 0 ) 181 102 { 182 if ( !strcasecmp(newvar->var-> nomvar,name) ) out = 1;103 if ( !strcasecmp(newvar->var->v_nomvar,name) ) out = 1; 183 104 else newvar = newvar->suiv; 184 105 } 185 106 return out; 186 107 } 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.