UtilNotGridDep.c 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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.7 */
  34. /******************************************************************************/
  35. #include <stdio.h>
  36. #include <stdlib.h>
  37. #include <string.h>
  38. #include "decl.h"
  39. /******************************************************************************/
  40. /* Add_NotGridDepend_Var_1 */
  41. /******************************************************************************/
  42. /* This subroutine is used to add a record into List_NotGridDepend_Var */
  43. /* This variable is add only if it is not present in the list */
  44. /* This variable is add at the end of the list */
  45. /******************************************************************************/
  46. /* _______ _______ _______ _______ _______ */
  47. /* + not + + not + + not + + not + + + */
  48. /* + grid +--->+ grid +--->+ grid +--->+ grid +--->+ NEW + */
  49. /* +______+ +______+ +______+ +______+ +______+ */
  50. /* */
  51. /******************************************************************************/
  52. void Add_NotGridDepend_Var_1 (char *name)
  53. {
  54. listvar *parcours;
  55. listvar *newvar;
  56. /* */
  57. /* look in the List_NotGridDepend_Var if this variable exist */
  58. parcours = List_NotGridDepend_Var;
  59. while (parcours)
  60. {
  61. if (!strcasecmp(parcours->var->v_nomvar,name))
  62. {
  63. /* if this variable exist -> exit of the program */
  64. printf(" The variable %s\n",name);
  65. printf(" has been declared twice \n");
  66. printf(" as a non grid dependent variable \n");
  67. exit(1);
  68. }
  69. parcours= parcours->suiv;
  70. }
  71. /* if variable does not exist, we add it */
  72. newvar=(listvar *)calloc(1,sizeof(listvar));
  73. newvar->var=(variable *)calloc(1,sizeof(variable));
  74. strcpy(newvar->var->v_nomvar,name);
  75. strcpy(newvar->var->v_commoninfile,cur_filename);
  76. strcpy(newvar->var->v_subroutinename,subroutinename);
  77. newvar->var->v_notgrid = 1 ;
  78. newvar->suiv = List_NotGridDepend_Var;
  79. List_NotGridDepend_Var = newvar;
  80. }
  81. /******************************************************************************/
  82. /* VarIsNonGridDepend */
  83. /******************************************************************************/
  84. /* This subroutine is used to know if a variable has been declared as non */
  85. /* grid dependent */
  86. /******************************************************************************/
  87. /* */
  88. /* notgriddepend variable; -----------> VarIsNonGridDepend = 1 */
  89. /* */
  90. /* */
  91. /******************************************************************************/
  92. int VarIsNonGridDepend(char *name)
  93. {
  94. listvar *newvar;
  95. int out;
  96. newvar = List_NotGridDepend_Var;
  97. out=0;
  98. while (newvar && out == 0 )
  99. {
  100. if ( !strcasecmp(newvar->var->v_nomvar,name) ) out = 1;
  101. else newvar = newvar->suiv;
  102. }
  103. return out;
  104. }