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

source: trunk/AGRIF/LIB/WorkWithlistmoduleinfile.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: 6.4 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/*                   MOD_1_FillInlistmodule                                   */
24/******************************************************************************/
25/*                                                                            */
26/******************************************************************************/
27void MOD_1_FillInlistmodule()
28{
29   listmodule *tmplist;
30   
31   
32   if (firstpass == 1) 
33   {   
34      tmplist = (listmodule *)malloc(sizeof(listmodule));
35      strcpy(tmplist->module,curmodulename);
36      tmplist->InstanceShouldMade = 0;
37      tmplist->Instance = 0;
38      /*         */
39      if ( !listmoduleinfile)
40      {
41         listmoduleinfile = tmplist; 
42         tmplist->suiv = NULL;
43      }
44      else
45      {
46         tmplist->suiv = listmoduleinfile;
47         listmoduleinfile = tmplist;     
48      }
49   }
50}
51
52
53/******************************************************************************/
54/*                MOD_1_InstanceShouldMadeTo0InModule                         */
55/******************************************************************************/
56/*                                                                            */
57/******************************************************************************/
58void MOD_1_InstanceShouldMadeTo0InModule()
59{
60   listmodule *tmplist;
61   
62   
63   if (firstpass == 1 && listmoduleinfile ) 
64   {
65      tmplist=listmoduleinfile;
66      /* we should find the module in the listmoduleinfile                    */
67      while ( strcasecmp(tmplist->module,curmodulename) ) tmplist=tmplist->suiv;
68      /* and turn the flag to 0                                               */
69      tmplist->InstanceShouldMade = 0 ;
70   }
71}
72
73
74/******************************************************************************/
75/*                MOD_1_InstanceShouldMadeTo1InModule                         */
76/******************************************************************************/
77/*                                                                            */
78/******************************************************************************/
79void MOD_1_InstanceShouldMadeTo1InModule()
80{
81   listmodule *tmplist;
82   
83   
84   if (firstpass == 1 && listmoduleinfile ) 
85   {
86      tmplist=listmoduleinfile;
87      /* we should find the module in the listmoduleinfile                    */
88      while ( strcasecmp(tmplist->module,curmodulename) ) tmplist=tmplist->suiv;
89      /* and turn the flag to 0                                               */
90      tmplist->InstanceShouldMade = 1 ;
91   }
92}
93
94/******************************************************************************/
95/*                     MOD_1_InstanceTo1InModule                              */
96/******************************************************************************/
97/*                                                                            */
98/******************************************************************************/
99void MOD_1_InstanceTo1InModule()
100{
101   listmodule *tmplist;
102   
103   
104   if (firstpass == 1 && listmoduleinfile ) 
105   {
106      tmplist=listmoduleinfile;
107      /* we should find the module in the listmoduleinfile                    */
108      while ( strcasecmp(tmplist->module,curmodulename) ) tmplist=tmplist->suiv;
109      /* and turn the flag to 0                                               */
110      tmplist->Instance = 1 ;
111   }
112}
113
114/******************************************************************************/
115/*                     MOD_n_InstanceShouldMadeInModule                       */
116/******************************************************************************/
117/*                                                                            */
118/******************************************************************************/
119int MOD_n_InstanceShouldMadeInModule()
120{
121   listmodule *tmplist;
122   
123   
124   if ( listmoduleinfile ) 
125   {
126      tmplist=listmoduleinfile;
127      /* we should find the module in the listmoduleinfile                    */
128      while ( strcasecmp(tmplist->module,curmodulename) ) tmplist=tmplist->suiv;
129      /* and turn the flag to 0                                               */
130      return tmplist->InstanceShouldMade;
131   }
132   else
133   {
134      return 0;
135   }
136}
137
138/******************************************************************************/
139/*                          MOD_n_InstanceInModule                            */
140/******************************************************************************/
141/*                                                                            */
142/******************************************************************************/
143int MOD_n_InstanceInModule()
144{
145   listmodule *tmplist;
146   
147   
148   if ( listmoduleinfile ) 
149   {
150      tmplist=listmoduleinfile;
151      /* we should find the module in the listmoduleinfile                    */
152      while ( strcasecmp(tmplist->module,curmodulename) ) tmplist=tmplist->suiv;
153      /* and turn the flag to 0                                               */
154      return tmplist->Instance;
155   }
156   else
157   {
158      return 0;
159   }
160}
Note: See TracBrowser for help on using the repository browser.