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 branches/2015/dev_r5072_UKMO2_OBS_simplification/NEMOGCM/EXTERNAL/AGRIF/LIB – NEMO

source: branches/2015/dev_r5072_UKMO2_OBS_simplification/NEMOGCM/EXTERNAL/AGRIF/LIB/WorkWithAllocatelist.c @ 5682

Last change on this file since 5682 was 5682, checked in by mattmartin, 9 years ago

OBS simplification changes committed to branch after running SETTE tests to make sure we get the same results as the trunk for ORCA2_LIM_OBS.

  • Property svn:keywords set to Id
File size: 5.9 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_Allocate_Var_1                           */
42/******************************************************************************/
43/* Firstpass 1                                                                */
44/******************************************************************************/
45/*                                                                            */
46/******************************************************************************/
47void Add_Allocate_Var_1(const char *nom, const char *nommodule)
48{
49   listallocate *newvar;
50   listallocate *parcours;
51   int out;
52
53   if ( firstpass == 1 )
54   {
55      if ( !List_Allocate_Var )
56      {
57         newvar = (listallocate *)calloc(1,sizeof(listallocate));
58         strcpy(newvar->a_nomvar,nom);
59         strcpy(newvar->a_subroutine,subroutinename);
60         strcpy(newvar->a_module,nommodule);
61         Save_Length(nom,25);
62         newvar->suiv = NULL;
63         List_Allocate_Var = newvar;
64      }
65      else
66      {
67         parcours = List_Allocate_Var;
68         out = 0 ;
69         while ( parcours->suiv && out == 0 )
70         {
71            if (  !strcasecmp(parcours->a_nomvar, nom) &&
72                  !strcasecmp(parcours->a_subroutine, subroutinename) &&
73                  !strcasecmp(parcours->a_module, nommodule) ) out = 1;
74            else
75               parcours=parcours->suiv;
76         }
77         if ( out == 0 )
78         {
79            if (  !strcasecmp(parcours->a_nomvar,nom) &&
80                  !strcasecmp(parcours->a_subroutine,subroutinename) &&
81                  !strcasecmp(parcours->a_module,nommodule) ) out = 1;
82            else
83            {
84               /* add the record                                              */
85              newvar = (listallocate *)calloc(1,sizeof(listallocate));
86              strcpy(newvar->a_nomvar, nom);
87              strcpy(newvar->a_subroutine, subroutinename);
88              strcpy(newvar->a_module, nommodule);
89              Save_Length(nom,25);
90              newvar->suiv = NULL;
91              parcours->suiv = newvar;
92            }
93         }
94      }
95   }
96}
97
98
99/******************************************************************************/
100/*                            IsVarAllocatable_0                              */
101/******************************************************************************/
102/* Firstpass 0                                                                */
103/******************************************************************************/
104/*                                                                            */
105/******************************************************************************/
106// int IsVarAllocatable_0(const char *ident)
107// {
108//    listallocate *parcours;
109//    int out;
110//
111//    out = 0 ;
112//    if ( firstpass == 0 )
113//    {
114//       parcours = List_Allocate_Var;
115//       while ( parcours && out == 0 )
116//       {
117//          if ( !strcasecmp(parcours->a_nomvar,ident)  ) out = 1 ;
118//          else parcours=parcours->suiv;
119//       }
120//    }
121//    return out;
122// }
Note: See TracBrowser for help on using the repository browser.