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.
WorkWithParameterlist.c in trunk/AGRIF/LIB – NEMO

source: trunk/AGRIF/LIB/WorkWithParameterlist.c @ 396

Last change on this file since 396 was 396, checked in by opalod, 18 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.8 KB
Line 
1/******************************************************************************/
2/*                                                                            */
3/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
4/*                                                                            */
5/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
6/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
7/*                                                                            */
8/*     This program is free software; you can redistribute it and/or modify   */
9/*    it                                                                      */
10/*                                                                            */
11/*    This program is distributed in the hope that it will be useful,         */
12/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
13/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
14/*    GNU General Public License for more details.                            */
15/*                                                                            */
16/******************************************************************************/
17#include <stdio.h>
18#include <stdlib.h>
19#include <string.h>
20#include "decl.h"
21
22/******************************************************************************/
23/*                       COM_1_AddvartoParamlist                              */
24/******************************************************************************/
25/*  This subroutines is used to add the variable defined in common in the     */
26/******************************************************************************/
27/*                                                                            */
28/******************************************************************************/
29void COM_1_AddvartoParamlist(listvar *listin)
30{
31   listvar *parcours;
32   
33   if ( firstpass == 1 )
34   {
35      if ( !parameterlist )
36      {
37         parameterlist = listin;
38      }
39      else
40      {
41         parcours = parameterlist;
42         while (parcours->suiv) parcours=parcours->suiv;
43     
44         parcours->suiv = listin;
45      }
46   }
47}
48
49/******************************************************************************/
50/*                   COM_1_UpdateparameterlistWithlistvarindoloop             */
51/******************************************************************************/
52/*  This subroutines is used to add the variable defined in common in the     */
53/******************************************************************************/
54/*                                                                            */
55/******************************************************************************/
56void COM_1_UpdateparameterlistWithlistvarindoloop()
57{
58   listvar *parcours;
59   listvar *parcours2;
60   listvar *parcours3;
61   listvar *parcoursprec;
62   int out;
63   
64   parcours = parameterlist;
65   while ( parcours )
66   {
67   if ( !strcasecmp(parcours->var->subroutinename,subroutinename) )
68   { 
69      /* We should look in the listvarindoloop if this variable is present    */
70      parcours2=listvarindoloop;
71      out=0;
72      while( parcours2 && out == 0 )
73      {
74         if ( !strcasecmp(parcours->var->nomvar,parcours2->var->nomvar) &&
75              !strcasecmp(parcours->var->subroutinename,
76                                            parcours2->var->modulename) 
77            )
78         {
79            parcours->var->VariableIsParameter = 1;
80            /* we should find in the globliste the type of this variable      */
81            parcours3 = globliste;
82            while ( parcours3 && out == 0 )
83            {
84               if ( !strcasecmp(parcours3->var->nomvar,parcours->var->nomvar) )
85               {
86                  out = 1 ;
87                  strcpy(parcours->var->typevar,parcours3->var->typevar);
88               }
89               else
90               {
91                  parcours3 = parcours3->suiv;
92               }
93            }           
94            out = 1 ;
95         }
96         else
97         {
98            parcours2 = parcours2->suiv;
99         }
100      }
101      if ( out == 0 )
102      {
103         /* we did not find it                                                */
104         /* we should remove the variable from the globliste                  */
105         if ( parcours ==  parameterlist)
106         {
107            parameterlist = parameterlist->suiv;
108            parcours = parameterlist;
109         }
110         else
111         {
112            parcoursprec->suiv = parcours->suiv;
113            parcours = parcoursprec->suiv;
114         }
115      }
116      else
117      {
118         parcoursprec = parcours;
119         parcours = parcours->suiv;
120      }
121   }
122   else
123   {
124      parcoursprec = parcours;
125      parcours = parcours->suiv;
126   }
127   }
128}
Note: See TracBrowser for help on using the repository browser.