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.
WorkWithAllocatelist.c in tags/nemo_v2_3_beta/AGRIF/LIB – NEMO

source: tags/nemo_v2_3_beta/AGRIF/LIB/WorkWithAllocatelist.c @ 7041

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

RB: update of the conv for IOM and NEC MPI library

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.2 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@imag.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.0                                                                */
34/******************************************************************************/
35#include <stdio.h>
36#include <stdlib.h>
37#include <string.h>
38#include "decl.h"
39
40
41/******************************************************************************/
42/*                            AddIdentToTheAllocateList_1                     */
43/******************************************************************************/
44/* Firstpass 1                                                                */
45/******************************************************************************/
46/*                                                                            */
47/******************************************************************************/
48void AddIdentToTheAllocateList_1(char *nom)
49{
50   listallocate *newvar;
51   listallocate *parcours;
52   int out;
53
54   if ( firstpass == 1 ) 
55   {
56      if ( !AllocateList )
57      {
58         newvar = (listallocate *)malloc(sizeof(listallocate));
59         strcpy(newvar->nomvar,nom);
60         strcpy(newvar->subroutine,subroutinename);
61         strcpy(newvar->module,curmodulename);
62         newvar->suiv = NULL;
63         AllocateList = newvar;
64      }
65      else
66      {
67         parcours = AllocateList;
68         out = 0 ; 
69         while ( parcours->suiv && out == 0 )
70         {
71            if (  !strcasecmp(parcours->nomvar,nom) &&
72                  !strcasecmp(parcours->subroutine,subroutinename) &&
73                  !strcasecmp(parcours->module,curmodulename) ) out = 1;
74            else
75               parcours=parcours->suiv;               
76         }
77         if ( out == 0 ) 
78         {
79            if (  !strcasecmp(parcours->nomvar,nom) &&
80                  !strcasecmp(parcours->subroutine,subroutinename) &&
81                  !strcasecmp(parcours->module,curmodulename) ) out = 1;
82            else
83            {
84               /* add the record                                              */
85              newvar = (listallocate *)malloc(sizeof(listallocate));
86              strcpy(newvar->nomvar,nom);
87              strcpy(newvar->subroutine,subroutinename);
88              strcpy(newvar->module,curmodulename);
89              newvar->suiv = NULL;
90              parcours->suiv = newvar;
91            }
92         }
93      }
94   }
95}
96
97/******************************************************************************/
98/*                            IsAllocateInThisSubroutine_0                    */
99/******************************************************************************/
100/* Firstpass 0                                                                */
101/******************************************************************************/
102/*                                                                            */
103/******************************************************************************/
104int IsAllocateInThisSubroutine_0()
105{
106   listallocate *parcours;
107   int out;
108
109   out = 0 ; 
110   if ( firstpass == 0 ) 
111   {
112      parcours = AllocateList;
113      while ( parcours && out == 0 )
114      {
115         if ( !strcasecmp(parcours->subroutine,subroutinename)  )
116         {
117            out = 1 ;
118         }
119         else parcours=parcours->suiv;               
120      }
121   }
122   return out;
123}
124
125/******************************************************************************/
126/*                            IsVarAllocatable_0                              */
127/******************************************************************************/
128/* Firstpass 0                                                                */
129/******************************************************************************/
130/*                                                                            */
131/******************************************************************************/
132int IsVarAllocatable_0(char *ident)
133{
134   listallocate *parcours;
135   int out;
136
137   out = 0 ; 
138   if ( firstpass == 0 ) 
139   {
140      parcours = AllocateList;
141      while ( parcours && out == 0 )
142      {
143         if ( !strcasecmp(parcours->nomvar,ident)  ) out = 1 ;
144         else parcours=parcours->suiv;               
145      }
146   }
147   return out;
148}
149
150
151/******************************************************************************/
152/*                          varisallocatable_0                                */
153/******************************************************************************/
154/* Firstpass 0                                                                */
155/******************************************************************************/
156/*                                                                            */
157/******************************************************************************/
158int varisallocatable_0(char *ident)
159{
160   listvar *newvar;
161   listallocate *newvaralloc;
162   int out;
163
164   out =0;
165   if (firstpass == 0 )
166   {
167      newvar = globalvarofusefile;
168      while ( newvar && out == 0 )
169      {
170         if ( !strcasecmp(ident,newvar->var->nomvar) && 
171              newvar->var->allocatable == 1 )  out = 1;
172         else newvar = newvar->suiv;
173      }
174      if ( out == 0 )
175      {
176         newvar = globliste;
177         while ( newvar && out == 0 )
178         {
179            if ( !strcasecmp(ident,newvar->var->nomvar) && 
180                 newvar->var->allocatable == 1 )  out = 1;
181            else newvar = newvar->suiv;
182         }     
183      }
184      if ( out == 0 )
185      {
186         newvaralloc = AllocateList;
187         while ( newvar && out == 0 )
188         {
189            if ( !strcasecmp(ident,newvaralloc->nomvar) && 
190                 !strcasecmp(newvaralloc->subroutine,subroutinename)
191               )  out = 1;
192            else newvaralloc = newvaralloc->suiv;
193         }     
194      }
195   }
196   return out;
197}
Note: See TracBrowser for help on using the repository browser.