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

source: trunk/AGRIF/LIB/WorkWithlistdatavariable.c @ 530

Last change on this file since 530 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: 7.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/*                          COMPLETEDATALIST                                  */
41/******************************************************************************/
42/* This subroutine is used to add a record to listdatavariable                */
43/******************************************************************************/
44/*        _______     _______     _______     _______     _______             */
45/*       +      +    +      +    +      +    +      +    +      +             */
46/*       + NEW  +--->+ data +--->+ data +--->+ data +--->+  data+             */
47/*       +______+    +______+    +______+    +______+    +______+             */
48/*                                                                            */
49/******************************************************************************/
50void CompleteDataList (char *name,char *values)
51{
52  listvar *newvar;
53 
54  newvar=(listvar *)malloc(sizeof(listvar));
55  newvar->var=(variable *)malloc(sizeof(variable));
56  strcpy(newvar->var->nomvar,name); 
57  strcpy(newvar->var->initialvalue,values); 
58  newvar->suiv = NULL; 
59
60  if ( !listdatavariable )
61  {
62     listdatavariable  = newvar ;
63  }
64  else
65  {
66     newvar->suiv = listdatavariable;
67     listdatavariable = newvar;
68  }
69}
70
71
72/******************************************************************************/
73/*                    COMPLETEGLOBLISTEWITHDATALIST_1                         */
74/******************************************************************************/
75/* This subroutine is used to complete the variable initialisation            */
76/* in the globliste with the listdatavariable                                 */
77/******************************************************************************/
78/*        _______     _______     _______     _______     _______             */
79/*       +      +    +      +    +      +    +      +    +      +             */
80/*       + data +--->+ data +--->+ data +--->+ data +--->+ data +             */
81/*       +______+    +______+    +______+    +______+    +______+             */
82/*                                  ||                                        */
83/*                                  ||                                        */
84/*                                  ||                                        */
85/*                                  ||                                        */
86/*                            initialvalue                                    */
87/*                                  ||                                        */
88/*                                  ||                                        */
89/*        _______     _______     __\/___     _______     _______             */
90/*       +      +    +      +    +      +    +      +    +      +             */
91/*       + glob +--->+ glob +--->+ glob +--->+ glob +--->+ glob +             */
92/*       +______+    +______+    +______+    +______+    +______+             */
93/*                                                                            */
94/******************************************************************************/
95void CompleteGlobListeWithDatalist_1()
96{
97  listvar *newvar;
98  listvar *globlistetmp;
99  int out;
100
101  if ( firstpass == 1 )
102  { 
103  /* We are looking for each variable of the listdatavariable where           */
104  /* are they located in the globliste                                        */
105  newvar = listdatavariable;
106  while ( newvar )
107  {
108     globlistetmp = globliste;
109     out = 0 ;
110     while( globlistetmp && out == 0 )
111     {
112        if ( !strcasecmp(newvar->var->nomvar,globlistetmp->var->nomvar) )
113   {
114           out = 1;
115      if ( strcasecmp(globlistetmp->var->initialvalue,"") )
116      {
117              printf("The variable %s has ever a initial value \n"
118                                                         , newvar->var->nomvar);
119              printf("Error in the CompleteGlobListeWithDatalist routine \n");
120              exit(0);       
121      }
122      else
123      {
124              strcpy(globlistetmp->var->initialvalue,newvar->var->initialvalue);
125      }
126   }
127   else
128   {
129        globlistetmp = globlistetmp->suiv;
130   }
131     }
132     if ( !globlistetmp )
133     {
134        printf("The variable %s has not bee found in the globliste \n"
135                                                         , newvar->var->nomvar);
136        printf("Error in the CompleteGlobListeWithDatalist routine \n");
137   exit(0);
138     }
139     newvar = newvar->suiv;
140  }
141  }
142}
143
Note: See TracBrowser for help on using the repository browser.