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.
Changeset 530 for trunk/AGRIF/LIB/UtilAgrif.c – NEMO

Ignore:
Timestamp:
2006-10-17T17:36:11+02:00 (18 years ago)
Author:
opalod
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/AGRIF/LIB/UtilAgrif.c

    r396 r530  
    33/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */ 
    44/*                                                                            */ 
    5 /*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */ 
     5/* Copyright or © or Copr. Laurent Debreu (Laurent.Debreu@imag.fr)            */ 
    66/*                        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 /*                                                                            */ 
     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                                                                */ 
    1634/******************************************************************************/ 
    1735#include <stdio.h> 
     
    2038#include "decl.h" 
    2139/******************************************************************************/ 
    22 /*                      AGRIF_n_Vartonumber                                   */ 
     40/*                      Vartonumber                                           */ 
    2341/******************************************************************************/ 
    2442/* This subroutine is used to know if Agrif_ is locate in the char            */ 
     
    2745/*                                                                            */ 
    2846/******************************************************************************/ 
    29 int AGRIF_n_Vartonumber(char *tokname) 
     47int Vartonumber(char *tokname) 
    3048{ 
    3149   int agrifintheword; 
     
    5371 
    5472/******************************************************************************/ 
    55 /*                      AGRIF_n_Agrif_in_Tok_NAME                             */ 
     73/*                              Agrif_in_Tok_NAME                             */ 
    5674/******************************************************************************/ 
    5775/* This subroutine is used to know if Agrif_ is locate in the char            */ 
     
    6381/*                                                                            */ 
    6482/******************************************************************************/ 
    65 int AGRIF_n_Agrif_in_Tok_NAME(char *tokname) 
     83int Agrif_in_Tok_NAME(char *tokname) 
    6684{ 
    6785   int agrifintheword; 
     
    7593 
    7694/******************************************************************************/ 
    77 /*          AGRIF_1_completeListofvariableinagriffunction                     */ 
     95/*          completeListofvariableinagriffunction_1                           */ 
    7896/******************************************************************************/ 
    7997/* Firstpass 1                                                                */ 
     
    91109/*                                                                            */ 
    92110/******************************************************************************/ 
    93 void AGRIF_1_completeListofvariableinagriffunction(char *ident) 
     111void completeListofvariableinagriffunction_1(char *ident) 
    94112{ 
    95113   listnom *listnomtmp; 
     
    125143 
    126144/******************************************************************************/ 
    127 /*                     AGRIF_0_ModifyTheVariableName                          */ 
     145/*                     ModifyTheVariableName_0                                */ 
    128146/******************************************************************************/ 
    129147/* Firstpass 0                                                                */ 
     
    133151/*                                                                            */ 
    134152/******************************************************************************/ 
    135 void AGRIF_0_ModifyTheVariableName(char *ident) 
     153void ModifyTheVariableName_0(char *ident) 
    136154{ 
    137155   listvar *newvar; 
     
    156174      { 
    157175         /* remove the variable                                               */ 
    158          RemoveWordCUR(fortranout,(long)(-strlen(ident)), 
     176         RemoveWordCUR_0(fortranout,(long)(-strlen(ident)), 
    159177                               strlen(ident)); 
    160178         fseek(fortranout,(long)(-strlen(ident)),SEEK_CUR); 
     
    164182         else 
    165183         { 
    166             fprintf(fortranout,"%s",vargridcurgridtabvars(newvar->var,0)); 
    167             colnum = strlen(vargridcurgridtabvars(newvar->var,0)); 
    168184            if ( colnum >= 25 )  
    169185            { 
     
    177193              } 
    178194            } 
     195            fprintf(fortranout,"%s",vargridcurgridtabvars(newvar->var,0)); 
     196            colnum = strlen(vargridcurgridtabvars(newvar->var,0)); 
    179197         } 
    180198      } 
     
    193211            { 
    194212               /* remove the variable                                         */ 
    195                RemoveWordCUR(fortranout,(long)(-strlen(ident)), 
     213               RemoveWordCUR_0(fortranout,(long)(-strlen(ident)), 
    196214                                     strlen(ident)); 
    197215               fseek(fortranout,(long)(-strlen(ident)),SEEK_CUR); 
     
    218236 
    219237/******************************************************************************/ 
    220 /*             AGRIF_n_AddsubroutineTolistsubwhereagrifused                   */ 
     238/*                     AddsubroutineTolistsubwhereagrifused                   */ 
    221239/******************************************************************************/ 
    222240/* This subroutine is used to add a record to                                 */ 
     
    234252/*                                                                            */ 
    235253/******************************************************************************/ 
    236 void  AGRIF_n_AddsubroutineTolistsubwhereagrifused() 
     254void  AddsubroutineTolistsubwhereagrifused() 
    237255{ 
    238256  listnom *listnomtmp; 
     
    264282 
    265283/******************************************************************************/ 
    266 /*                          AGRIF_n_AddUseAgrifUtil                           */ 
     284/*                                AddUseAgrifUtil_0                           */ 
    267285/******************************************************************************/ 
    268286/* Add use Agrif_Util at the beginning of the subroutine definition           */ 
     
    280298/*                                                                            */ 
    281299/******************************************************************************/ 
    282 void  AGRIF_n_AddUseAgrifUtil() 
     300void  AddUseAgrifUtil_0() 
    283301{ 
    284302  listnom *parcours; 
     
    286304  int out; 
    287305 
     306  if ( firstpass == 0 ) 
     307  { 
     308  adduseagrifutil = 0 ; 
    288309  parcours = listofsubroutinewhereagrifisused; 
    289310  while ( parcours && strcasecmp(parcours->nom,subroutinename) )   
     
    312333     } 
    313334  } 
    314 } 
    315  
    316  
    317 /******************************************************************************/ 
    318 /*                         AGRIF_0_AgrifParentNotify                          */ 
     335  } 
     336} 
     337 
     338 
     339/******************************************************************************/ 
     340/*                         AgrifParentNotify_0                                */ 
    319341/******************************************************************************/ 
    320342/* Firstpass 0                                                                */ 
     
    324346/*                                                                            */ 
    325347/******************************************************************************/ 
    326 void AGRIF_0_NotifyAgrifFunction(char *ident) 
     348void NotifyAgrifFunction_0(char *ident) 
    327349{ 
    328350   if ( firstpass == 0 )  
     
    482504 
    483505/******************************************************************************/ 
    484 /*                       AGRIF_0_ModifyTheAgrifFunction                       */ 
     506/*                       ModifyTheAgrifFunction_0                             */ 
    485507/******************************************************************************/ 
    486508/* Firstpass 0                                                                */ 
     
    490512/*                                                                            */ 
    491513/******************************************************************************/ 
    492 void AGRIF_0_ModifyTheAgrifFunction(char *ident) 
     514void ModifyTheAgrifFunction_0(char *ident) 
    493515{ 
    494516   if ( InAgrifParentDef != 0 ) 
    495           AGRIF_0_AgriffunctionModify(ident,InAgrifParentDef); 
     517          AgriffunctionModify_0(ident,InAgrifParentDef); 
    496518   /*                                                                         */ 
    497519   InAgrifParentDef = 0; 
     
    500522 
    501523/******************************************************************************/ 
    502 /*                         AGRIF_0_AgriffunctionModify                        */ 
     524/*                         AgriffunctionModify_0                              */ 
    503525/******************************************************************************/ 
    504526/* Firstpass 0                                                                */ 
     
    566588/*                                                                            */ 
    567589/******************************************************************************/ 
    568 void AGRIF_0_AgriffunctionModify(char *ident,int whichone) 
     590void AgriffunctionModify_0(char *ident,int whichone) 
    569591{ 
    570592   char toprint[LONGNOM]; 
     
    716738 
    717739/******************************************************************************/ 
    718 /*                          AGRIF_0_AddUseAgrifInModuleDeclaration            */ 
     740/*                   AddUseAgrifInModuleDeclaration_0                         */ 
    719741/******************************************************************************/ 
    720742/* Add use Agrif_Util at the beginning of the subroutine definition           */ 
     
    732754/*                                                                            */ 
    733755/******************************************************************************/ 
    734 void  AGRIF_0_AddUseAgrifInModuleDeclaration() 
     756void  AddUseAgrifInModuleDeclaration_0() 
    735757{ 
    736758  listusemodule *newmodule; 
     
    760782   } 
    761783} 
     784 
     785 
     786/******************************************************************************/ 
     787/*                             Instanciation_0                                */ 
     788/******************************************************************************/ 
     789/* Firstpass 0                                                                */ 
     790/******************************************************************************/ 
     791/*                                                                            */ 
     792/*               Agrif_<toto>(variable) ====>     Agrif_<toto>(variable)      */ 
     793/*                                                                            */ 
     794/******************************************************************************/ 
     795void Instanciation_0(char *ident) 
     796{ 
     797   listvar *newvar; 
     798   int out; 
     799 
     800   if ( firstpass == 0 && sameagrifargument == 1 )  
     801   { 
     802      if ( fortran77 == 0 ) newvar = globalvarofusefile; 
     803      else newvar = globliste; 
     804 
     805      out=0; 
     806      while ( newvar && out == 0 )  
     807      { 
     808         if ( !strcasecmp(newvar->var->nomvar,ident) ) out = 1; 
     809         else newvar=newvar->suiv;       
     810      } 
     811      if ( out == 1 )  
     812      { 
     813         /* then write the instanciation                                      */ 
     814         fprintf(fortranout,"\n      %s = %s",ident,vargridcurgridtabvars(newvar->var,3)); 
     815         colnum = 0; 
     816      } 
     817      else 
     818      { 
     819         newvar = globalvarofusefile; 
     820 
     821         out=0; 
     822         while ( newvar && out == 0 )  
     823         { 
     824            if ( !strcasecmp(newvar->var->nomvar,ident) ) out = 1; 
     825            else newvar=newvar->suiv;       
     826         } 
     827         if ( out == 1 )  
     828         { 
     829            /* then write the instanciation                                      */ 
     830            fprintf(fortranout,"\n      %s = %s",ident,vargridcurgridtabvars(newvar->var,3)); 
     831            colnum = 0; 
     832         } 
     833      } 
     834   } 
     835   sameagrifargument = 0; 
     836} 
Note: See TracChangeset for help on using the changeset viewer.