1 | /******************************************************************************/ |
---|
2 | /* */ |
---|
3 | /* CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran) */ |
---|
4 | /* */ |
---|
5 | /* Copyright or or Copr. Laurent Debreu (Laurent.Debreu@imag.fr) */ |
---|
6 | /* Cyril Mazauric (Cyril_Mazauric@yahoo.fr) */ |
---|
7 | /* This software is governed by the CeCILL-C license under French law and */ |
---|
8 | /* abiding by the rules of distribution of free software. You can use, */ |
---|
9 | /* modify and/ or redistribute the software under the terms of the CeCILL-C */ |
---|
10 | /* license as circulated by CEA, CNRS and INRIA at the following URL */ |
---|
11 | /* "http://www.cecill.info". */ |
---|
12 | /* */ |
---|
13 | /* As a counterpart to the access to the source code and rights to copy, */ |
---|
14 | /* modify and redistribute granted by the license, users are provided only */ |
---|
15 | /* with a limited warranty and the software's author, the holder of the */ |
---|
16 | /* economic rights, and the successive licensors have only limited */ |
---|
17 | /* liability. */ |
---|
18 | /* */ |
---|
19 | /* In this respect, the user's attention is drawn to the risks associated */ |
---|
20 | /* with loading, using, modifying and/or developing or reproducing the */ |
---|
21 | /* software by the user in light of its specific status of free software, */ |
---|
22 | /* that may mean that it is complicated to manipulate, and that also */ |
---|
23 | /* therefore means that it is reserved for developers and experienced */ |
---|
24 | /* professionals having in-depth computer knowledge. Users are therefore */ |
---|
25 | /* encouraged to load and test the software's suitability as regards their */ |
---|
26 | /* requirements in conditions enabling the security of their systems and/or */ |
---|
27 | /* data to be ensured and, more generally, to use and operate it in the */ |
---|
28 | /* same conditions as regards security. */ |
---|
29 | /* */ |
---|
30 | /* The fact that you are presently reading this means that you have had */ |
---|
31 | /* knowledge of the CeCILL-C license and that you accept its terms. */ |
---|
32 | /******************************************************************************/ |
---|
33 | /* version 1.6 */ |
---|
34 | /******************************************************************************/ |
---|
35 | #include <stdio.h> |
---|
36 | #include <stdlib.h> |
---|
37 | #include <string.h> |
---|
38 | #include "decl.h" |
---|
39 | |
---|
40 | /******************************************************************************/ |
---|
41 | /* Add_NotGridDepend_Var_1 */ |
---|
42 | /******************************************************************************/ |
---|
43 | /* This subroutine is used to add a record into List_NotGridDepend_Var */ |
---|
44 | /* This variable is add only if it is not present in the list */ |
---|
45 | /* This variable is add at the end of the list */ |
---|
46 | /******************************************************************************/ |
---|
47 | /* _______ _______ _______ _______ _______ */ |
---|
48 | /* + not + + not + + not + + not + + + */ |
---|
49 | /* + grid +--->+ grid +--->+ grid +--->+ grid +--->+ NEW + */ |
---|
50 | /* +______+ +______+ +______+ +______+ +______+ */ |
---|
51 | /* */ |
---|
52 | /******************************************************************************/ |
---|
53 | void Add_NotGridDepend_Var_1 (char *name) |
---|
54 | { |
---|
55 | listvar *parcours; |
---|
56 | listvar *newvar; |
---|
57 | /* */ |
---|
58 | /* look in the List_NotGridDepend_Var if this variable exist */ |
---|
59 | parcours = List_NotGridDepend_Var; |
---|
60 | while (parcours) |
---|
61 | { |
---|
62 | if (!strcasecmp(parcours->var->v_nomvar,name)) |
---|
63 | { |
---|
64 | /* if this variable exist -> exit of the program */ |
---|
65 | printf(" The variable %s\n",name); |
---|
66 | printf(" has been declared twice \n"); |
---|
67 | printf(" as a non grid dependent variable \n"); |
---|
68 | exit(1); |
---|
69 | } |
---|
70 | parcours= parcours->suiv; |
---|
71 | } |
---|
72 | /* if variable does not exist, we add it */ |
---|
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; |
---|
81 | } |
---|
82 | |
---|
83 | /******************************************************************************/ |
---|
84 | /* VarIsNonGridDepend */ |
---|
85 | /******************************************************************************/ |
---|
86 | /* This subroutine is used to know if a variable has been declared as non */ |
---|
87 | /* grid dependent */ |
---|
88 | /******************************************************************************/ |
---|
89 | /* */ |
---|
90 | /* notgriddepend variable; -----------> VarIsNonGridDepend = 1 */ |
---|
91 | /* */ |
---|
92 | /* */ |
---|
93 | /******************************************************************************/ |
---|
94 | int VarIsNonGridDepend(char *name) |
---|
95 | { |
---|
96 | listvar *newvar; |
---|
97 | int out; |
---|
98 | |
---|
99 | newvar = List_NotGridDepend_Var; |
---|
100 | out=0; |
---|
101 | while (newvar && out == 0 ) |
---|
102 | { |
---|
103 | if ( !strcasecmp(newvar->var->v_nomvar,name) ) out = 1; |
---|
104 | else newvar = newvar->suiv; |
---|
105 | } |
---|
106 | return out; |
---|
107 | } |
---|