source: branches/2015/dev_r5021_UKMO1_CICE_coupling/NEMOGCM/EXTERNAL/AGRIF/LIB/UtilNotGridDep.c @ 5445

Last change on this file since 5445 was 5445, checked in by davestorkey, 5 years ago

Clear SVN keywords from 2015/dev_r5021_UKMO1_CICE_coupling branch.

File size: 6.1 KB
Line 
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/******************************************************************************/
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/******************************************************************************/
53void 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   Save_Length(name,4);
77   strcpy(newvar->var->v_commoninfile,mainfile);
78   Save_Length(mainfile,10);
79   strcpy(newvar->var->v_subroutinename,subroutinename);
80   Save_Length(subroutinename,11);
81   newvar->var->v_notgrid = 1 ;
82   newvar->suiv = List_NotGridDepend_Var;
83   List_NotGridDepend_Var = newvar;
84}
85
86/******************************************************************************/
87/*                      VarIsNonGridDepend                                    */
88/******************************************************************************/
89/* This subroutine is used to know if a variable has been declared as non     */
90/* grid dependent                                                             */
91/******************************************************************************/
92/*                                                                            */
93/*  notgriddepend variable;    ----------->  VarIsNonGridDepend = 1           */
94/*                                                                            */
95/*                                                                            */
96/******************************************************************************/
97int VarIsNonGridDepend(char *name)
98{
99   listvar *newvar;
100   int out;
101
102   newvar = List_NotGridDepend_Var;
103   out=0;
104   while (newvar && out == 0 )
105   {
106      if ( !strcasecmp(newvar->var->v_nomvar,name) ) out = 1;
107      else newvar = newvar->suiv;
108   }
109   return out;
110}
Note: See TracBrowser for help on using the repository browser.