Changeset 6237
- Timestamp:
- 2016-01-13T15:47:26+01:00 (9 years ago)
- Location:
- branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM
- Files:
-
- 29 added
- 27 deleted
- 133 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/ARCH/CMCC/arch-PW6_calypso.fcm
r4865 r6237  13 13 # USER_INC additional include files for the compiler, e.g. -I<include dir>  14 14 # USER_LIB additional libraries to pass to the linker, e.g. -l<library>  15 # CC C compiler used to compile conv for AGRIF  16 # CFLAGS compiler flags used with CC 15 17  16 18  … …  29 31 %USER_INC %NCDF_INC 30 32 %USER_LIB %NCDF_LIB   33 %CC xlc  34 %CFLAGS -O -qcpluscmt -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/ARCH/CMCC/arch-PW6_calypso_debug.fcm
r4865 r6237  13 13 # USER_INC additional include files for the compiler, e.g. -I<include dir>  14 14 # USER_LIB additional libraries to pass to the linker, e.g. -l<library>  15 # CC C compiler used to compile conv for AGRIF  16 # CFLAGS compiler flags used with CC 15 17  16 18  … …  29 31 %USER_INC %NCDF_INC 30 32 %USER_LIB %NCDF_LIB   33 %CC xlc  34 %CFLAGS -O -qcpluscmt -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/ARCH/CMCC/arch-PW6_calypso_tools.fcm
r4865 r6237  13 13 # USER_INC additional include files for the compiler, e.g. -I<include dir>  14 14 # USER_LIB additional libraries to pass to the linker, e.g. -l<library>  15 # CC C compiler used to compile conv for AGRIF  16 # CFLAGS compiler flags used with CC 15 17  16 18  … …  29 31 %USER_INC %NCDF_INC 30 32 %USER_LIB %NCDF_LIB   33 %CC xlc  34 %CFLAGS -O -qcpluscmt -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/ARCH/CMCC/arch-gfortran_athena_xios.fcm
r4865 r6237  25 25 # USER_INC complete list of include files 26 26 # USER_LIB complete list of libraries to pass to the linker  27 # CC C compiler used to compile conv for AGRIF  28 # CFLAGS compiler flags used with CC 27 29 # 28 30 # Note that: … …  56 58 %USER_INC %XIOS_INC %NCDF_INC %HDF5_INC 57 59 %USER_LIB %XIOS_LIB %NCDF_LIB %HDF5_LIB -lnetcdff -lnetcdf -lstdc++ -lz -lcurl -lgpfs  60   61 %CC cc  62 %CFLAGS -O0 -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/ARCH/CMCC/arch-ifort_athena.fcm
r4865 r6237  13 13 # USER_INC additional include files for the compiler, e.g. -I<include dir> 14 14 # USER_LIB additional libraries to pass to the linker, e.g. -l<library>  15 # CC C compiler used to compile conv for AGRIF  16 # CFLAGS compiler flags used with CC 15 17  16 18  … …  29 31 %USER_INC %NCDF_INC 30 32 %USER_LIB %NCDF_LIB  33 %CC icc  34 %CFLAGS -O0 31 35  -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/ARCH/CMCC/arch-ifort_athena_debug.fcm
r4865 r6237  13 13 # USER_INC additional include files for the compiler, e.g. -I<include dir> 14 14 # USER_LIB additional libraries to pass to the linker, e.g. -l<library>  15 # CC C compiler used to compile conv for AGRIF  16 # CFLAGS compiler flags used with CC 15 17  16 18  … …  29 31 %USER_INC %NCDF_INC 30 32 %USER_LIB %NCDF_LIB  33 %CC icc  34 %CFLAGS -O0 31 35  -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/ARCH/CMCC/arch-ifort_athena_tools.fcm
r4865 r6237  13 13 # USER_INC additional include files for the compiler, e.g. -I<include dir> 14 14 # USER_LIB additional libraries to pass to the linker, e.g. -l<library>  15 # CC C compiler used to compile conv for AGRIF  16 # CFLAGS compiler flags used with CC 15 17  16 18  … …  29 31 %USER_INC %NCDF_INC 30 32 %USER_LIB %NCDF_LIB  33 %CC icc  34 %CFLAGS -O0 31 35  -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/ARCH/CMCC/arch-ifort_athena_xios.fcm
r4997 r6237  25 25 # USER_INC complete list of include files 26 26 # USER_LIB complete list of libraries to pass to the linker  27 # CC C compiler used to compile conv for AGRIF  28 # CFLAGS compiler flags used with CC 27 29 # 28 30 # Note that: … …  55 57 %USER_INC %XIOS_INC %NCDF_INC %HDF5_INC 56 58 %USER_LIB %XIOS_LIB %NCDF_LIB %HDF5_LIB  59 %CC icc  60 %CFLAGS -O0 -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/ARCH/INGV/arch-IBM_EKMAN_INGV.fcm
r5301 r6237  15 15 # USER_INC additional include files for the compiler, e.g. -I<include dir> 16 16 # USER_LIB additional libraries to pass to the linker, e.g. -l<library>  17 # CC C compiler used to compile conv for AGRIF  18 # CFLAGS compiler flags used with CC 17 19  18 20 %NCDF_INC -I/srv/lib/netcdf-x/include -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/ARCH/arch-ALTIX_NAUTILUS_MPT.fcm
r5385 r6237  24 24 # USER_INC complete list of include files 25 25 # USER_LIB complete list of libraries to pass to the linker  26 # CC C compiler used to compile conv for AGRIF  27 # CFLAGS compiler flags used with CC 26 28 # 27 29 # Note that: … …  58 60 #FCFLAGS -g -traceback -r8 -O0 -xT -ip -vec-report0 59 61 #FFLAGS -g -traceback -r8 -O0 -xT -ip -vec-report0  62   63 %CC cc  64 %CFLAGS -O0 -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/ARCH/arch-PW7_C2A_XIO.fcm
r4865 r6237  17 17 # USER_INC complete list of include files 18 18 # USER_LIB complete list of libraries to pass to the linker  19 # CC C compiler used to compile conv for AGRIF  20 # CFLAGS compiler flags used with CC 19 21 # 20 22 # Note that: … …  48 50 %USER_INC %XIOS_INC %NCDF_INC 49 51 %USER_LIB %XIOS_LIB %NCDF_LIB %XLF90_LIB  52   53 %CC xlc  54 %CFLAGS -O -qcpluscmt -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/ARCH/arch-PW7_METO.fcm
r5415 r6237  15 15 # USER_INC additional include files for the compiler, e.g. -I<include dir> 16 16 # USER_LIB additional libraries to pass to the linker, e.g. -l<library>  17 # CC C compiler used to compile conv for AGRIF  18 # CFLAGS compiler flags used with CC 17 19  18 20  … …  24 26 %FC mpxlf90_r 25 27 %FCFLAGS -qrealsize=8 -qextname -qsuffix=f=f90 -qarch=pwr7 -qtune=pwr7 -g -O2 -qstrict -qinitauto=7FBFFFFF 26  %FFLAGS -qrealsize=8 -qextname -qarch=pwr7 -qtune=pwr7 -g -O2 -qstrict -qinitauto=7FBFFFFF -qfixed 28 %FFLAGS -qrealsize=8 -qextname -qsuffix=f=f90 -qarch=pwr7 -qtune=pwr7 -g -O2 -qstrict -qinitauto=7FBFFFFF 27 29 %LD mpCC_r 28 30 %LDFLAGS -lxlf90 -L/projects/um1/lib -lsig -O2 -L MASS … …  33 35 %USER_INC %NCDF_INC %XIOS_INC 34 36 %USER_LIB %NCDF_LIB %XIOS_LIB  37 %CC xlc  38 %CFLAGS -O -qcpluscmt -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/ARCH/arch-PW7_MONSOON.fcm
r5027 r6237  15 15 # USER_INC additional include files for the compiler, e.g. -I<include dir> 16 16 # USER_LIB additional libraries to pass to the linker, e.g. -l<library>  17 # CC C compiler used to compile conv for AGRIF  18 # CFLAGS compiler flags used with CC 17 19  18 20 %NCDF_INC -I/home/dcalve/netcdf/4.1.3_seq/include … …  32 34 %USER_INC %NCDF_INC %XIOS_INC 33 35 %USER_LIB %NCDF_LIB %XIOS_LIB  36   37 %CC xlc  38 %CFLAGS -O -qcpluscmt -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/ARCH/arch-X64_ADA.fcm
r5385 r6237  24 24 # USER_INC complete list of include files 25 25 # USER_LIB complete list of libraries to pass to the linker  26 # CC C compiler used to compile conv for AGRIF  27 # CFLAGS compiler flags used with CC 26 28 # 27 29 # Note that: … …  54 56 %USER_INC %XIOS_INC %OASIS_INC %NCDF_INC 55 57 %USER_LIB %XIOS_LIB %OASIS_LIB %NCDF_LIB  58   59 %CC icc  60 %CFLAGS -O0 -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/ARCH/arch-X64_ADA_O0.fcm
r4990 r6237  24 24 # USER_INC complete list of include files 25 25 # USER_LIB complete list of libraries to pass to the linker  26 # CC C compiler used to compile conv for AGRIF  27 # CFLAGS compiler flags used with CC 26 28 # 27 29 # Note that: … …  53 55 %USER_INC %XIOS_INC %OASIS_INC %NCDF_INC 54 56 %USER_LIB %XIOS_LIB %OASIS_LIB %NCDF_LIB  57   58 %CC icc  59 %CFLAGS -O0 -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/ARCH/arch-X64_CURIE.fcm
r5407 r6237  24 24 # USER_INC complete list of include files 25 25 # USER_LIB complete list of libraries to pass to the linker  26 # CC C compiler used to compile conv for AGRIF  27 # CFLAGS compiler flags used with CC 26 28 # 27 29 # Note that: … …  58 60 %USER_INC %XIOS_INC %OASIS_INC %NCDF_INC 59 61 %USER_LIB %XIOS_LIB %OASIS_LIB %NCDF_LIB  62   63 %CC cc  64 %CFLAGS -O0 -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/ARCH/arch-X64_MOBILIS.fcm
r5118 r6237  29 29 # USER_INC complete list of include files 30 30 # USER_LIB complete list of libraries to pass to the linker  31 # CC C compiler used to compile conv for AGRIF  32 # CFLAGS compiler flags used with CC 31 33 # 32 34 # Note that: … …  58 60 %USER_INC %XIOS_INC %OASIS_INC %NCDF_INC 59 61 %USER_LIB %XIOS_LIB %OASIS_LIB %NCDF_LIB  62   63 %CC cc  64 %CFLAGS -O0 -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/ARCH/arch-X64_VAYU.fcm
r4865 r6237  24 24 # USER_INC complete list of include files 25 25 # USER_LIB complete list of libraries to pass to the linker  26 # CC C compiler used to compile conv for AGRIF  27 # CFLAGS compiler flags used with CC 26 28 # 27 29 # Note that: … …  53 55 %USER_INC %XIOS_INC %OASIS_INC %NCDF_INC 54 56 %USER_LIB %XIOS_LIB %OASIS_LIB %NCDF_LIB  57   58 %CC cc  59 %CFLAGS -O0 -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/ARCH/arch-X64_YELLOWSTONE.fcm
r4865 r6237  24 24 # USER_INC complete list of include files 25 25 # USER_LIB complete list of libraries to pass to the linker  26 # CC C compiler used to compile conv for AGRIF  27 # CFLAGS compiler flags used with CC 26 28 # 27 29 # Note that: … …  53 55 %USER_INC %XIOS_INC %OASIS_INC %NCDF_INC 54 56 %USER_LIB %XIOS_LIB %OASIS_LIB %NCDF_LIB  57   58 %CC cc  59 %CFLAGS -O0 -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/ARCH/arch-XC40_METO.fcm
r5480 r6237  24 24 # USER_INC complete list of include files 25 25 # USER_LIB complete list of libraries to pass to the linker  26 # CC C compiler used to compile conv for AGRIF  27 # CFLAGS compiler flags used with CC 26 28 # 27 29 # Note that: … …  31 33 %NCDF_HOME /opt/cray/netcdf-hdf5parallel/4.3.2/CRAY/83 32 34 %HDF5_HOME /opt/cray/hdf5-parallel/1.8.13/CRAY/83 33  %XIOS_HOME /projects/ocean/nemo/xios/xios_1.0_r6 18_20150619/XIOS 35 %XIOS_HOME /projects/ocean/nemo/xios/xios_1.0_r629_20150625/XIOS 34 36  35 37 %NCDF_INC -I%NCDF_HOME/include -I%HDF5_HOME/include … …  51 53 %USER_INC %XIOS_INC 52 54 %USER_LIB %XIOS_LIB  55   56 %CC cc  57 %CFLAGS -O0 -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/ARCH/arch-XC_ARCHER.fcm
r4865 r6237  24 24 # USER_INC complete list of include files 25 25 # USER_LIB complete list of libraries to pass to the linker  26 # CC C compiler used to compile conv for AGRIF  27 # CFLAGS compiler flags used with CC 26 28 # 27 29 # Note that: … …  57 59 #USER_INC %XIOS_INC %OASIS_INC %NCDF_INC 58 60 #USER_LIB %XIOS_LIB %OASIS_LIB %NCDF_LIB  61   62 %CC cc  63 %CFLAGS -O0 -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/ARCH/arch-XC_ARCHER_INTEL.fcm
r4865 r6237  24 24 # USER_INC complete list of include files 25 25 # USER_LIB complete list of libraries to pass to the linker  26 # CC C compiler used to compile conv for AGRIF  27 # CFLAGS compiler flags used with CC 26 28 # 27 29 # Note that: … …  55 57 #USER_INC %XIOS_INC %OASIS_INC %NCDF_INC 56 58 #USER_LIB %XIOS_LIB %OASIS_LIB %NCDF_LIB  59   60 %CC cc  61 %CFLAGS -O0 -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/ARCH/arch-macport_osx.fcm
r5407 r6237  33 33 # USER_INC complete list of include files 34 34 # USER_LIB complete list of libraries to pass to the linker  35 # CC C compiler used to compile conv for AGRIF  36 # CFLAGS compiler flags used with CC 35 37 # 36 38 # Note that: … …  62 64 %USER_INC %XIOS_INC %OASIS_INC %NCDF_INC 63 65 %USER_LIB %XIOS_LIB %OASIS_LIB %NCDF_LIB  66   67 %CC cc  68 %CFLAGS -O0 -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/ARCH/arch-openmpi_NAVITI_MERCATOR.fcm
r4865 r6237  13 13 # USER_INC additional include files for the compiler, e.g. -I<include dir> 14 14 # USER_LIB additional libraries to pass to the linker, e.g. -l<library>  15 # CC C compiler used to compile conv for AGRIF  16 # CFLAGS compiler flags used with CC 15 17 # debug: -g -check bounds -check uninit -check pointers -traceback 16 18  … …  31 33 %USER_INC -I$XIOS_INC %NCDF_INC 32 34 %USER_LIB -L$XIOS_LIB -lxios %NCDF_LIB -lstdc++  35   36 %CC cc  37 %CFLAGS -O0 -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/CONFIG/C1D_PAPA/EXP00/namelist_cfg
r5407 r6237  141 141 &namtra_qsr ! penetrative solar radiation 142 142 !-----------------------------------------------------------------------  143 ! ! file name ! frequency (hours) ! variable ! time interp. ! clim ! 'yearly'/ ! weights ! rotation ! land/sea mask !  144 ! ! ! (if <0 months) ! name ! (logical) ! (T/F) ! 'monthly' ! filename ! pairing ! filename !  145 sn_chl ='chlorophyll_PAPASTATION', -1 , 'CHLA' , .true. , .true. , 'yearly' , '' , '' , '' 143 146 / 144 147 !----------------------------------------------------------------------- -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/CONFIG/GYRE_XIOS/EXP00/iodef.xml
r5363 r6237  2 2 <simulation>  3 3  4  <context id="nemo" time_origin="1900-01-01 00:00:00"> 4 <context id="nemo" > 5 5  6 6 <!-- $id$ --> … …  19 19 = put the variables you want... = 20 20 ============================================================================================================ 21  --> 22   23  <file_definition type="multiple_file" name="@expname@_@freq@_@startdate@_@enddate@" sync_freq="1d" min_digits="4"> 24   25  <file_group id="1ts" output_freq="1ts" output_level="10" enabled=".TRUE."/> <!-- 1 time step files --> 26  <file_group id="1h" output_freq="1h" output_level="10" enabled=".TRUE."/> <!-- 1h files --> 27  <file_group id="2h" output_freq="2h" output_level="10" enabled=".TRUE."/> <!-- 2h files --> 28  <file_group id="3h" output_freq="3h" output_level="10" enabled=".TRUE."/> <!-- 3h files -->  29  <file_group id="4h" output_freq="4h" output_level="10" enabled=".TRUE."/> <!-- 4h files --> 30  <file_group id="6h" output_freq="6h" output_level="10" enabled=".TRUE."/> <!-- 6h files --> 31   32  <file_group id="1d" output_freq="1d" output_level="10" enabled=".TRUE."/> <!-- 1d files --> 33  <file_group id="3d" output_freq="3d" output_level="10" enabled=".TRUE."/> <!-- 3d files -->  34  <file_group id="5d" output_freq="5d" output_level="10" enabled=".TRUE."> <!-- 5d files -->   21 -->  22   23 <file_definition src="./file_def.xml"/>  24   25 <!-- 35 26  36  <file id="file1" name_suffix="_grid_T" description="ocean T grid variables" >Â37  <field field_ref="toce" name="votemper" />Â38  <field field_ref="soce" name="vosaline" />Â39  <field field_ref="sst" name="sosstsst" />Â40  <field field_ref="sss" name="sosaline" />Â41  <field field_ref="ssh" name="sossheig" />Â42  <field field_ref="empmr" name="sowaflup" />Â43  <field field_ref="qsr" name="soshfldo" />Â44  <field field_ref="saltflx" name="sosfldow" />Â45  <field field_ref="qt" name="sohefldo" />Â46  <field field_ref="mldr10_1" name="somxl010" />Â47  <field field_ref="mldkz5" name="somixhgt" />Â48  </file>Â49  50  <file id="file2" name_suffix="_grid_U" description="ocean U grid variables" >Â51  <field field_ref="uoce" name="vozocrtx" />Â52  <field field_ref="utau" name="sozotaux" />Â53  </file>Â54  55  <file id="file3" name_suffix="_grid_V" description="ocean V grid variables" >Â56  <field field_ref="voce" name="vomecrty" />Â57  <field field_ref="vtau" name="sometauy" />Â58  </file>Â59  60  <file id="file4" name_suffix="_grid_W" description="ocean W grid variables" >Â61  <field field_ref="woce" name="vovecrtz" />Â62  <field field_ref="avt" name="votkeavt" />Â63  <field field_ref="aht2d" name="soleahtw" />Â64  </file>Â65  Â66  </file_group>Â67  68  <file_group id="1m" output_freq="1mo" output_level="10" enabled=".TRUE."/> <!-- real monthly files -->Â69  <file_group id="2m" output_freq="2mo" output_level="10" enabled=".TRUE."/> <!-- real 2m files -->Â70  <file_group id="3m" output_freq="3mo" output_level="10" enabled=".TRUE."/> <!-- real 3m files -->Â71  <file_group id="4m" output_freq="4mo" output_level="10" enabled=".TRUE."/> <!-- real 4m files -->Â72  <file_group id="6m" output_freq="6mo" output_level="10" enabled=".TRUE."/> <!-- real 6m files -->Â73  Â74  <file_group id="1y" output_freq="1y" output_level="10" enabled=".TRUE."/> <!-- real yearly files -->Â75  <file_group id="2y" output_freq="2y" output_level="10" enabled=".TRUE."/> <!-- real 2y files -->Â76  <file_group id="5y" output_freq="5y" output_level="10" enabled=".TRUE."/> <!-- real 5y files -->Â77  <file_group id="10y" output_freq="10y" output_level="10" enabled=".TRUE."/> <!-- real 10y files -->Â78  Â79  </file_definition>Â80  81  <!--Â82 27 ============================================================================================================ 83 28 = grid definition = = DO NOT CHANGE = … …  100 45  101 46 <grid_definition>  102  <grid id="grid_T_2D" domain_ref="grid_T"/> 103  <grid id="grid_T_3D" domain_ref="grid_T" axis_ref="deptht"/> 104  <grid id="grid_U_2D" domain_ref="grid_U"/> 105  <grid id="grid_U_3D" domain_ref="grid_U" axis_ref="depthu"/> 106  <grid id="grid_V_2D" domain_ref="grid_V"/> 107  <grid id="grid_V_3D" domain_ref="grid_V" axis_ref="depthv"/> 108  <grid id="grid_W_2D" domain_ref="grid_W"/> 109  <grid id="grid_W_3D" domain_ref="grid_W" axis_ref="depthw"/>  47 <grid id="grid_T_2D" >  48 <domain id="grid_T" />  49 </grid>  50 <grid id="grid_T_3D" >  51 <domain id="grid_T" />  52 <axis id="deptht" />  53 </grid>  54 <grid id="grid_U_2D" >  55 <domain id="grid_U" />  56 </grid>  57 <grid id="grid_U_3D" >  58 <domain id="grid_U" />  59 <axis id="depthu" />  60 </grid>  61 <grid id="grid_V_2D" >  62 <domain id="grid_V" />  63 </grid>  64 <grid id="grid_V_3D" >  65 <domain id="grid_V" />  66 <axis id="depthv" />  67 </grid>  68 <grid id="grid_W_2D" >  69 <domain id="grid_W" />  70 </grid>  71 <grid id="grid_W_3D" >  72 <domain id="grid_W" />  73 <axis id="depthw" />  74 </grid>  75 <grid id="scalarpoint" />  76  110 77 </grid_definition>  111 78  … …  120 87 We must have buffer_size > jpi*jpj*jpk*8 (with jpi and jpj the subdomain size) 121 88 --> 122  <variable id="buffer_size" type="integer">10000000</variable> 123  <variable id="buffer_server_factor_size" type="integer">2</variable> 124  <variable id="info_level" type="integer">0</variable> 125  <variable id="using_server" type="boolean">false</variable> 126  <variable id="using_oasis" type="boolean">false</variable>  89 <variable id="info_level" type="int">0</variable>  90 <variable id="using_server" type="bool">false</variable>  91 <variable id="using_oasis" type="bool">false</variable> 127 92 <variable id="oasis_codes_id" type="string" >oceanx</variable> 128 93  -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/CONFIG/GYRE_XIOS/cpp_GYRE_XIOS.fcm
r4373 r6237 Â 1 Â bld::tool::fppkeys key_dynspg_flt key_ldfslp key_zdftke key_iomput key_mpp_mpi ÂÂ 1 bld::tool::fppkeys key_dynspg_flt key_ldfslp key_zdftke key_iomput key_mpp_mpi key_xios2Â -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/1_namelist_cfg
r5499 r6237  6 6 !----------------------------------------------------------------------- 7 7 cn_exp = "Agulhas" ! experience name  8  nn_itend = 480 ! last time step 8 nn_itend = 10950 ! last time step 9 9 nn_stock = 10950 ! frequency of creation of a restart file (modulo referenced to 1) 10 10 nn_write = 10950 ! frequency of write in the output file (modulo referenced to nn_it000) -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef.xml
r5407 r6237 Â 153 153 </context>Â 154 154 Â Â 155 <context id="1_nemo" time_origin="1950-01-01 00:00:00" >Â Â 156 Â Â 157 <!-- $id$ -->Â Â 158 Â Â 159 <!-- Â Â 160 ============================================================================================================Â Â 161 = definition of all existing variables =Â Â 162 = DO NOT CHANGE =Â Â 163 ============================================================================================================Â Â 164 -->Â Â 165 <field_definition src="./field_def.xml"/>Â Â 166 <!-- Â Â 167 ============================================================================================================Â Â 168 = output files definition =Â Â 169 = Define your own files =Â Â 170 = put the variables you want... =Â Â 171 ============================================================================================================Â Â 172 -->Â Â 173 Â Â 174 <file_definition type="multiple_file" name="@expname@_@freq@_@startdate@_@enddate@" sync_freq="10d" min_digits="4">Â Â 175 Â Â 176 <file_group id="1ts" output_freq="1ts" output_level="10" enabled=".TRUE."/> <!-- 1 time step files -->Â Â 177 <file_group id="1h" output_freq="1h" output_level="10" enabled=".TRUE."/> <!-- 1h files -->Â Â 178 <file_group id="2h" output_freq="2h" output_level="10" enabled=".TRUE."/> <!-- 2h files -->Â Â 179 <file_group id="3h" output_freq="3h" output_level="10" enabled=".TRUE."/> <!-- 3h files --> Â Â 180 <file_group id="4h" output_freq="4h" output_level="10" enabled=".TRUE."/> <!-- 4h files -->Â Â 181 <file_group id="6h" output_freq="6h" output_level="10" enabled=".TRUE."/> <!-- 6h files --> Â Â 182 <file_group id="1d" output_freq="1d" output_level="10" enabled=".TRUE."/> <!-- 1d files -->Â Â 183 <file_group id="3d" output_freq="3d" output_level="10" enabled=".TRUE."/> <!-- 3d files --> Â Â 184 Â Â 185 <file_group id="5d" output_freq="5d" output_level="10" enabled=".TRUE." > <!-- 5d files --> Â Â 186 Â Â 187 <file id="file1" name_suffix="_grid_T" description="ocean T grid variables" >Â Â 188 <field field_ref="sst" name="tos" long_name="sea_surface_temperature" />Â Â 189 <field field_ref="sss" name="sos" long_name="sea_surface_salinity" />Â Â 190 <field field_ref="ssh" name="zos" long_name="sea_surface_height_above_geoid" />Â Â 191 <field field_ref="toce" name="thetao" long_name="sea_water_potential_temperature" />Â Â 192 <field field_ref="soce" name="so" long_name="sea_water_salinity" />Â Â 193 <field field_ref="sst2" name="tossq" long_name="square_of_sea_surface_temperature" />Â Â 194 <field field_ref="ssh2" name="zossq" long_name="square_of_sea_surface_height_above_geoid" />Â Â 195 <field field_ref="mldkz5" />Â Â 196 <field field_ref="mldr10_1" />Â Â 197 <field field_ref="empmr" name="wfo" long_name="water_flux_into_sea_water" />Â Â 198 <field field_ref="qsr" name="rsntds" long_name="surface_net_downward_shortwave_flux" />Â Â 199 <field field_ref="qt" name="tohfls" long_name="surface_net_downward_total_heat_flux" />Â Â 200 <field field_ref="saltflx" name="sosflxdo" />Â Â 201 <field field_ref="taum" name="taum" />Â Â 202 <field field_ref="wspd" name="sowindsp" />Â Â 203 <field field_ref="precip" name="soprecip" />Â Â 204 </file>Â Â 205 Â Â 206 <file id="file3" name_suffix="_grid_U" description="ocean U grid variables" >Â Â 207 <field field_ref="ssu" name="uos" long_name="sea_surface_x_velocity" />Â Â 208 <field field_ref="uoce" name="uo" long_name="sea_water_x_velocity" />Â Â 209 <field field_ref="utau" name="tauuo" long_name="surface_downward_x_stress" />Â Â 210 <!-- variables available with MLEÂ Â 211 <field field_ref="psiu_mle" name="psiu_mle" long_name="MLE_streamfunction_along_i-axis" />Â Â 212 -->Â Â 213 </file>Â Â 214 Â Â 215 <file id="file4" name_suffix="_grid_V" description="ocean V grid variables" >Â Â 216 <field field_ref="ssv" name="vos" long_name="sea_surface_y_velocity" />Â Â 217 <field field_ref="voce" name="vo" long_name="sea_water_y_velocity" />Â Â 218 <field field_ref="vtau" name="tauvo" long_name="surface_downward_y_stress" />Â Â 219 <!-- variables available with MLEÂ Â 220 <field field_ref="psiv_mle" name="psiv_mle" long_name="MLE_streamfunction_along_j-axis" />Â Â 221 -->Â Â 222 </file>Â Â 223 Â Â 224 <file id="file5" name_suffix="_grid_W" description="ocean W grid variables" >Â Â 225 <field field_ref="woce" name="wo" long_name="ocean vertical velocity" />Â Â 226 <field field_ref="avt" name="difvho" long_name="ocean_vertical_heat_diffusivity" />Â Â 227 </file>Â Â 228 <!--Â Â 229 <file id="file6" name_suffix="_icemod" description="ice variables" >Â Â 230 <field field_ref="ice_pres" />Â Â 231 <field field_ref="snowthic_cea" name="snd" long_name="surface_snow_thickness" />Â Â 232 <field field_ref="icethic_cea" name="sit" long_name="sea_ice_thickness" />Â Â 233 <field field_ref="iceprod_cea" name="sip" long_name="sea_ice_thickness" />Â Â 234 <field field_ref="ist_ipa" />Â Â 235 <field field_ref="uice_ipa" />Â Â 236 <field field_ref="vice_ipa" />Â Â 237 <field field_ref="utau_ice" />Â Â 238 <field field_ref="vtau_ice" />Â Â 239 <field field_ref="qsr_io_cea" />Â Â 240 <field field_ref="qns_io_cea" />Â Â 241 <field field_ref="snowpre" />Â Â 242 </file>Â Â 243 Â Â 244 <file id="file8" name_suffix="_Tides" description="tidal harmonics" >Â Â 245 <field field_ref="M2x" name="M2x" long_name="M2 Elevation harmonic real part" />Â Â 246 <field field_ref="M2y" name="M2y" long_name="M2 Elevation harmonic imaginary part" />Â Â 247 <field field_ref="M2x_u" name="M2x_u" long_name="M2 current barotrope along i-axis harmonic real part " />Â Â 248 <field field_ref="M2y_u" name="M2y_u" long_name="M2 current barotrope along i-axis harmonic imaginary part " />Â Â 249 <field field_ref="M2x_v" name="M2x_v" long_name="M2 current barotrope along j-axis harmonic real part " />Â Â 250 <field field_ref="M2y_v" name="M2y_v" long_name="M2 current barotrope along j-axis harmonic imaginary part " />Â Â 251 </file>Â Â 252 -->Â Â 253 </file_group>Â Â 254 Â Â 255 Â Â 256 <file_group id="1m" output_freq="1mo" output_level="10" enabled=".TRUE."/> <!-- real monthly files -->Â Â 257 Â Â 258 Â Â 259 <file_group id="2m" output_freq="2mo" output_level="10" enabled=".TRUE."/> <!-- real 2m files -->Â Â 260 <file_group id="3m" output_freq="3mo" output_level="10" enabled=".TRUE."/> <!-- real 3m files -->Â Â 261 <file_group id="4m" output_freq="4mo" output_level="10" enabled=".TRUE."/> <!-- real 4m files -->Â Â 262 <file_group id="6m" output_freq="6mo" output_level="10" enabled=".TRUE."/> <!-- real 6m files -->Â Â 263 Â Â 264 <file_group id="1y" output_freq="1y" output_level="10" enabled=".TRUE."/> <!-- real yearly files -->Â Â 265 <file_group id="2y" output_freq="2y" output_level="10" enabled=".TRUE."/> <!-- real 2y files -->Â Â 266 <file_group id="5y" output_freq="5y" output_level="10" enabled=".TRUE."/> <!-- real 5y files -->Â Â 267 <file_group id="10y" output_freq="10y" output_level="10" enabled=".TRUE."/> <!-- real 10y files -->Â Â 268 Â Â 269 </file_definition>Â Â 270 Â Â 271 <!-- Â Â 272 ============================================================================================================Â Â 273 = grid definition = = DO NOT CHANGE =Â Â 274 ============================================================================================================Â Â 275 -->Â Â 276 Â Â 277 <axis_definition> Â Â 278 <axis id="deptht" long_name="Vertical T levels" unit="m" positive="down" />Â Â 279 <axis id="depthu" long_name="Vertical U levels" unit="m" positive="down" />Â Â 280 <axis id="depthv" long_name="Vertical V levels" unit="m" positive="down" />Â Â 281 <axis id="depthw" long_name="Vertical W levels" unit="m" positive="down" />Â Â 282 <axis id="nfloat" long_name="Float number" unit="-" />Â Â 283 <axis id="icbcla" long_name="Iceberg class" unit="-" />Â Â 284 </axis_definition> Â Â 285 Â Â 286 <domain_definition src="./domain_def.xml"/>Â Â 287 Â Â 288 <grid_definition> Â Â 289 <grid id="grid_T_2D" domain_ref="grid_T"/>Â Â 290 <grid id="grid_T_3D" domain_ref="grid_T" axis_ref="deptht"/>Â Â 291 <grid id="grid_U_2D" domain_ref="grid_U"/>Â Â 292 <grid id="grid_U_3D" domain_ref="grid_U" axis_ref="depthu"/>Â Â 293 <grid id="grid_V_2D" domain_ref="grid_V"/>Â Â 294 <grid id="grid_V_3D" domain_ref="grid_V" axis_ref="depthv"/>Â Â 295 <grid id="grid_W_2D" domain_ref="grid_W"/>Â Â 296 <grid id="grid_W_3D" domain_ref="grid_W" axis_ref="depthw"/>Â Â 297 </grid_definition> Â Â 298 </context>Â 155 299 Â 156 300 <context id="xios">Â -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/EXTERNAL/AGRIF/LIB/DiversListe.c
r5781 r6237  48 48 void Add_Common_var_1() 49 49 { 50  listvar *newvar; 51  listvar *newvar2; 52  variable *newvariable; 53  listdim *dims; 54  char listdimension[LONG_C]; 55  char ligne[LONG_C]; 56  int out; 57   58  if ( firstpass == 1 ) 59  { 60   61  newvar = (listvar *)malloc(sizeof(listvar)); 62  newvariable = (variable *)malloc(sizeof(variable)); 63  /* */ 64  Init_Variable(newvariable); 65  /* */ 66  strcpy(newvariable->v_nomvar,commonvar); 67  Save_Length(commonvar,4); 68  strcpy(newvariable->v_commonname,commonblockname); 69  Save_Length(commonblockname,7); 70  strcpy(newvariable->v_modulename,curmodulename); 71  Save_Length(curmodulename,6); 72  strcpy(newvariable->v_subroutinename,subroutinename); 73  Save_Length(subroutinename,11); 74  newvariable->v_positioninblock= positioninblock; 75  newvariable->v_common=1; 76  strcpy(newvariable->v_commoninfile,mainfile); 77  Save_Length(mainfile,10); 78   79  newvar->var = newvariable; 80   81  if ( commondim ) 82  { 83  newvariable->v_dimension=commondim; 84  newvariable->v_dimensiongiven=1; 85  newvariable->v_nbdim=num_dims(commondim); 86  /* Creation of the string for the dimension of this variable */ 87  dimsempty = 1; 88  strcpy(listdimension,""); 89   90  if ( commondim ) 91  { 92  dims = commondim; 93  while (dims) 94  { 95  if ( strcasecmp(dims->dim.first,"") || 96  strcasecmp(dims->dim.last,"")) dimsempty = 0; 97  sprintf(ligne,"%s:%s",dims->dim.first,dims->dim.last); 98  strcat(listdimension,ligne); 99  if ( dims->suiv ) strcat(listdimension,","); 100  dims = dims->suiv; 101  } 102  if ( dimsempty == 1 ) newvariable->v_dimsempty=1; 103  } 104  strcpy(newvariable->v_readedlistdimension,listdimension); 105  Save_Length(listdimension,15); 106  } 107   108   109  newvar->suiv = NULL; 110   111  if ( !List_Common_Var ) 112  { 113  List_Common_Var = newvar; 114  } 115  else 116  { 117  newvar2 = List_Common_Var; 118  out = 0 ; 119  while ( newvar2 && out == 0 ) 120  { 121  if ( !strcasecmp(newvar2->var->v_nomvar,commonvar) && 122  !strcasecmp(newvar2->var->v_commonname,commonblockname) && 123  !strcasecmp(newvar2->var->v_subroutinename,subroutinename) 124  ) out = 1 ; 125  else newvar2 = newvar2->suiv; 126  } 127  if ( out == 0 ) 128  { 129  newvar->suiv = List_Common_Var; 130  List_Common_Var = newvar; 131  } 132  else 133  { 134  free(newvar); 135  } 136  } 137  }  50 listvar *newvar;  51 listvar *newvar2;  52 variable *newvariable;  53 listdim *dims;  54 char listdimension[LONG_M];  55 char ligne[LONG_M];  56 int out;  57   58 if ( firstpass == 1 )  59 {  60 newvar = (listvar *) calloc(1,sizeof(listvar));  61 newvariable = (variable *) calloc(1,sizeof(variable));  62   63 Init_Variable(newvariable);  64   65 strcpy(newvariable->v_nomvar,commonvar);  66 strcpy(newvariable->v_commonname,commonblockname);  67 strcpy(newvariable->v_modulename,curmodulename);  68 strcpy(newvariable->v_subroutinename,subroutinename);  69 strcpy(newvariable->v_commoninfile,cur_filename);  70 newvariable->v_positioninblock = positioninblock;  71 newvariable->v_common = 1;  72 newvar->var = newvariable;  73   74 if ( commondim )  75 {  76 newvariable->v_dimension = commondim;  77 newvariable->v_dimensiongiven = 1;  78 newvariable->v_nbdim = get_num_dims(commondim);  79   80 /* Creation of the string for the dimension of this variable */  81 dimsempty = 1;  82 strcpy(listdimension,"");  83   84 dims = commondim;  85 while (dims)  86 {  87 if ( strcasecmp(dims->dim.first,"") ||  88 strcasecmp(dims->dim.last,"")) dimsempty = 0;  89 sprintf(ligne,"%s:%s",dims->dim.first,dims->dim.last);  90 strcat(listdimension,ligne);  91 if ( dims->suiv ) strcat(listdimension,",");  92 dims = dims->suiv;  93 }  94 if ( dimsempty == 1 ) newvariable->v_dimsempty = 1;  95   96 strcpy(newvariable->v_readedlistdimension,listdimension);  97 Save_Length(listdimension,15);  98 }  99   100 newvar->suiv = NULL;  101   102 if ( !List_Common_Var )  103 {  104 List_Common_Var = newvar;  105 }  106 else  107 {  108 newvar2 = List_Common_Var;  109 out = 0 ;  110 while ( newvar2 && out == 0 )  111 {  112 if ( !strcasecmp(newvar2->var->v_nomvar,commonvar) &&  113 !strcasecmp(newvar2->var->v_commonname,commonblockname) &&  114 !strcasecmp(newvar2->var->v_subroutinename,subroutinename)  115 ) out = 1 ;  116 else newvar2 = newvar2->suiv;  117 }  118 if ( out == 0 )  119 {  120 newvar->suiv = List_Common_Var;  121 List_Common_Var = newvar;  122 }  123 else  124 {  125 free(newvar);  126 }  127 }  128 } 138 129 } 139 130  … …  145 136 /* */ 146 137 /******************************************************************************/ 147  listnom *Addtolistnom(char *nom, listnom *listin,int value) 148  { 149  listnom *newnom; 150  listnom *parcours; 151  int out; 152   153  newnom=(listnom *) malloc (sizeof (listnom)); 154  strcpy(newnom->o_nom,nom); 155  Save_Length(nom,23); 156  newnom->o_val = value; 157  newnom->suiv = NULL; 158   159  if ( !listin ) listin = newnom; 160  else 161  { 162  parcours = listin; 163  out = 0 ; 164  while ( parcours && out == 0 ) 165  { 166  if ( !strcasecmp(parcours->o_nom,nom) ) out = 1 ; 167  else parcours=parcours->suiv; 168  } 169  if ( out == 0 ) 170  { 171  newnom->suiv = listin; 172  listin = newnom; 173  } 174  else 175  { 176  free(newnom); 177  } 178  } 179  return listin;  138 listnom *Addtolistnom(const char *nom, listnom *listin, int value)  139 {  140 listnom *newnom;  141 listnom *parcours;  142 int out;  143   144 newnom = (listnom*) calloc(1, sizeof(listnom));  145 strcpy(newnom->o_nom, nom);  146 newnom->o_val = value;  147 newnom->suiv = NULL;  148   149 if ( listin == NULL )  150 {  151 listin = newnom;  152 }  153 else  154 {  155 parcours = listin;  156 out = 0 ;  157 while ( parcours && out == 0 )  158 {  159 if ( !strcasecmp(parcours->o_nom, nom) ) out = 1 ;  160 else parcours = parcours->suiv;  161 }  162 if ( out == 0 )  163 {  164 newnom->suiv = listin;  165 listin = newnom;  166 }  167 else  168 {  169 free(newnom);  170 }  171 }  172 return listin; 180 173 } 181 174  … …  193 186 /* */ 194 187 /******************************************************************************/ 195  listname *Addtolistname(char *nom,listname *input) 196  { 197  listname *newnom; 198  listname *parcours; 199  int out; 200   201  if ( !input ) 202  { 203  newnom=(listname *) malloc (sizeof (listname)); 204  strcpy(newnom->n_name,nom); 205  Save_Length(nom,20); 206  newnom->suiv = NULL; 207  input = newnom; 208  } 209  else 210  { 211  parcours = input; 212  out = 0 ; 213  while ( parcours && out == 0 ) 214  { 215  if ( !strcasecmp(parcours->n_name,nom) ) out = 1; 216  else parcours=parcours->suiv; 217  } 218  if ( out == 0 ) 219  { 220  newnom=(listname *) malloc (sizeof (listname)); 221  strcpy(newnom->n_name,nom); 222  Save_Length(nom,20); 223  newnom->suiv = input; 224  input = newnom; 225  } 226  } 227  return input;  188 listname *Addtolistname(const char *nom, listname *input)  189 {  190 listname *newnom;  191 listname *parcours;  192 int out;  193   194 if ( !input )  195 {  196 newnom = (listname*) calloc(1, sizeof(listname));  197 strcpy(newnom->n_name, nom);  198 newnom->suiv = NULL;  199 input = newnom;  200 }  201 else  202 {  203 parcours = input;  204 out = 0 ;  205 while ( parcours && out == 0 )  206 {  207 if ( !strcasecmp(parcours->n_name,nom) ) out = 1;  208 else parcours=parcours->suiv;  209 }  210 if ( out == 0 )  211 {  212 newnom = (listname*) calloc(1,sizeof(listname));  213 strcpy(newnom->n_name, nom);  214 newnom->suiv = input;  215 input = newnom;  216 }  217 }  218 return input; 228 219 } 229 220  … …  236 227 /* */ 237 228 /******************************************************************************/ 238  int ModuleIsDefineInInputFile(c har *name)Â239  { Â240  listnom *newnom;Â241  int out;Â242   243  out = 0;Â244  if ( listofmodules )Â245  {Â246  newnom = listofmodules;Â247  while( newnom && out == 0 )Â248  {Â249  if ( !strcasecmp(newnom->o_nom,name) ) out = 1 ;Â250  else newnom=newnom->suiv;Â251  }Â252  }Â253  return out; 229 int ModuleIsDefineInInputFile(const char *name)  230 {  231 listnom *newnom;  232 int out;  233   234 out = 0;  235 if ( listofmodules )  236 {  237 newnom = listofmodules;  238 while( newnom && out == 0 )  239 {  240 if ( !strcasecmp(newnom->o_nom,name) ) out = 1 ;  241 else newnom = newnom->suiv;  242 }  243 }  244 return out; 254 245 } 255 246  … …  270 261 /* */ 271 262 /******************************************************************************/ 272  void Addmoduletothelisttmp(char *name) 273  { 274  listusemodule *newmodule; 275  listusemodule *parcours; 276  int out; 277   278  if ( !listofmoduletmp) 279  { 280  newmodule =(listusemodule *)malloc(sizeof(listusemodule)); 281  strcpy(newmodule->u_usemodule,name); 282  Save_Length(name,16); 283  strcpy(newmodule->u_cursubroutine,subroutinename); 284  Save_Length(subroutinename,18); 285  newmodule->suiv = NULL; 286  listofmoduletmp = newmodule ; 287  } 288  else 289  { 290  parcours = listofmoduletmp; 291  out = 0; 292  while( parcours && out == 0 ) 293  { 294  if ( !strcasecmp(parcours->u_usemodule,name) ) out = 1; 295  else parcours = parcours->suiv; 296  } 297  if ( out == 0 ) 298  { 299  newmodule =(listusemodule *)malloc(sizeof(listusemodule)); 300  strcpy(newmodule->u_usemodule,name); 301  Save_Length(name,16); 302  strcpy(newmodule->u_cursubroutine,subroutinename); 303  Save_Length(subroutinename,18); 304  newmodule->suiv = listofmoduletmp; 305  listofmoduletmp = newmodule; 306  } 307  }  263 void Addmoduletothelisttmp(const char *name)  264 {  265 listusemodule *newmodule;  266 listusemodule *parcours;  267 int out;  268   269 if ( !listofmoduletmp )  270 {  271 newmodule = (listusemodule*) calloc(1, sizeof(listusemodule));  272 strcpy(newmodule->u_usemodule, name);  273 strcpy(newmodule->u_cursubroutine, subroutinename);  274 newmodule->suiv = NULL;  275 listofmoduletmp = newmodule ;  276 }  277 else  278 {  279 parcours = listofmoduletmp;  280 out = 0;  281 while( parcours && out == 0 )  282 {  283 if ( !strcasecmp(parcours->u_usemodule, name) ) out = 1;  284 else parcours = parcours->suiv;  285 }  286 if ( out == 0 )  287 {  288 newmodule = (listusemodule*) calloc(1, sizeof(listusemodule));  289 strcpy(newmodule->u_usemodule, name);  290 strcpy(newmodule->u_cursubroutine, subroutinename);  291 newmodule->suiv = listofmoduletmp;  292 listofmoduletmp = newmodule;  293 }  294 } 308 295 } 309 296  … …  321 308 /* */ 322 309 /******************************************************************************/ 323  void Add_NameOfModule_1(char *nom) 324  { 325  listnom *newnom; 326   327  if ( firstpass == 1 ) 328  { 329  newnom=(listnom *) malloc (sizeof (listnom)); 330  strcpy(newnom->o_nom,nom); 331  Save_Length(nom,23); 332  newnom->suiv = List_NameOfModule; 333  List_NameOfModule = newnom; 334  }  310 void Add_NameOfModule_1(const char *nom)  311 {  312 listnom *newnom;  313   314 if ( firstpass == 1 )  315 {  316 newnom = (listnom *) calloc(1,sizeof(listnom));  317 strcpy(newnom->o_nom,nom);  318 newnom->suiv = List_NameOfModule;  319 List_NameOfModule = newnom;  320 } 335 321 } 336 322  … …  348 334 /* */ 349 335 /******************************************************************************/ 350  void Add_NameOfCommon_1(char *nom,char *cursubroutinename) 351  { 352  listnom *newnom; 353  listnom *parcours; 354   355  if ( firstpass == 1 ) 356  { 357  parcours = List_NameOfCommon; 358  while ( parcours && strcasecmp(parcours->o_nom,nom) ) 359  parcours = parcours->suiv; 360  if ( !parcours ) 361  { 362  newnom=(listnom *) malloc (sizeof (listnom)); 363  strcpy(newnom->o_nom,nom); 364  strcpy(newnom->o_subroutinename,cursubroutinename); 365  Save_Length(nom,23); 366  newnom->suiv = List_NameOfCommon; 367  List_NameOfCommon = newnom; 368  } 369  }  336 void Add_NameOfCommon_1(const char *nom, const char *cursubroutinename)  337 {  338 listnom *newnom;  339 listnom *parcours;  340   341 if ( firstpass == 1 )  342 {  343 parcours = List_NameOfCommon;  344 while ( parcours && strcasecmp(parcours->o_nom,nom) )  345 parcours = parcours->suiv;  346 if ( !parcours )  347 {  348 newnom = (listnom *) calloc(1,sizeof(listnom));  349 strcpy(newnom->o_nom,nom);  350 strcpy(newnom->o_subroutinename,cursubroutinename);  351 newnom->suiv = List_NameOfCommon;  352 List_NameOfCommon = newnom;  353 }  354 } 370 355 } 371 356  … …  378 363 /* */ 379 364 /******************************************************************************/ 380  void Add_CouplePointed_Var_1(char *namemodule,listcouple *couple) 381  { 382  listvarpointtovar *pointtmp; 383   384  if ( firstpass == 1 ) 385  { 386  /* we should complete the List_CouplePointed_Var */ 387  pointtmp=(listvarpointtovar *)malloc(sizeof(listvarpointtovar)); 388  strcpy(pointtmp->t_usemodule,namemodule); 389  Save_Length(namemodule,28); 390  strcpy(pointtmp->t_cursubroutine,subroutinename); 391  Save_Length(subroutinename,29); 392  pointtmp->t_couple = couple; 393  if ( List_CouplePointed_Var ) 394  { 395  pointtmp->suiv = List_CouplePointed_Var; 396  List_CouplePointed_Var = pointtmp; 397  } 398  else 399  { 400  pointtmp->suiv = NULL; 401  List_CouplePointed_Var = pointtmp; 402  } 403  }  365 void Add_CouplePointed_Var_1(const char *namemodule, listcouple *couple)  366 {  367 listvarpointtovar *pointtmp;  368   369 /* we should complete the List_CouplePointed_Var */  370 pointtmp = (listvarpointtovar*) calloc(1, sizeof(listvarpointtovar));  371 strcpy(pointtmp->t_usemodule, namemodule);  372 strcpy(pointtmp->t_cursubroutine, subroutinename);  373 pointtmp->t_couple = couple;  374 if ( List_CouplePointed_Var )  375 {  376 pointtmp->suiv = List_CouplePointed_Var;  377 }  378 else  379 {  380 pointtmp->suiv = NULL;  381 }  382 List_CouplePointed_Var = pointtmp; 404 383 } 405 384  … …  420 399 /* */ 421 400 /******************************************************************************/ 422  void Add_Include_1(char *name)  401 void Add_Include_1(const char *name)  402 {  403 listusemodule *newinclude;  404   405 if ( firstpass == 1 )  406 {  407 newinclude = (listusemodule*) calloc(1, sizeof(listusemodule));  408 strcpy(newinclude->u_usemodule,name);  409 strcpy(newinclude->u_cursubroutine,subroutinename);  410   411 newinclude->suiv = List_Include;  412 List_Include = newinclude ;  413 }  414 }  415   416 /******************************************************************************/  417 /* Add_ImplicitNoneSubroutine_1 */  418 /******************************************************************************/  419 /* This subroutine is used to add a record to a list of struct */  420 /******************************************************************************/  421 /* */  422 /* */  423 /******************************************************************************/  424 void Add_ImplicitNoneSubroutine_1()  425 {  426 if ( firstpass == 1 )  427 List_ImplicitNoneSubroutine = Addtolistname(subroutinename,List_ImplicitNoneSubroutine);  428 }  429   430 /******************************************************************************/  431 /* WriteIncludeDeclaration */  432 /******************************************************************************/  433 /* Firstpass 0 */  434 /******************************************************************************/  435 /* */  436 /******************************************************************************/  437 void WriteIncludeDeclaration(FILE* tofile) 423 438 { 424 439 listusemodule *newinclude; 425 440  426  if ( firstpass == 1 )Â427  {Â428  newinclude =(listusemodule *)malloc(sizeof(listusemodule));Â429  strcpy(newinclude->u_usemodule,name);Â430  Save_Length(name,16);Â431  strcpy(newinclude->u_cursubroutine,subroutinename);Â432  Save_Length(subroutinename,18);Â433  newinclude->suiv = NULL;Â434  Â435  if ( !List_Include)Â436  {Â437  List_Include = newinclude ;Â438  }Â439  elseÂ440  {Â441  newinclude->suiv = List_Include;Â442  List_Include = newinclude;Â443  }Â444  }Â445  }Â446  Â447  /******************************************************************************/Â448  /* Add_ImplicitNoneSubroutine_1 */Â449  /******************************************************************************/Â450  /* This subroutine is used to add a record to a list of struct */Â451  /******************************************************************************/Â452  /* */Â453  /* */Â454  /******************************************************************************/Â455  void Add_ImplicitNoneSubroutine_1()Â456  {Â457  Â458  if ( firstpass == 1 )Â459  {Â460  List_ImplicitNoneSubroutine = Addtolistname(subroutinename,Â461  List_ImplicitNoneSubroutine);Â462  }Â463  }Â464  Â465  Â466  /******************************************************************************/Â467  /* WriteIncludeDeclaration */Â468  /******************************************************************************/Â469  /* Firstpass 0 */Â470  /******************************************************************************/Â471  /* */Â472  /******************************************************************************/Â473  void WriteIncludeDeclaration()Â474  {Â475  listusemodule *newinclude;Â476  Â477 441 newinclude = List_Include; 478  fprintf( fortranout,"\n"); 442 fprintf(tofile,"\n"); 479 443 while ( newinclude ) 480 444 { 481 445 if ( !strcasecmp(newinclude->u_cursubroutine,subroutinename) ) 482 446 { 483  fprintf( fortranout," INCLUDE %s\n",newinclude->u_usemodule); 447 fprintf(tofile, " include %s\n",newinclude->u_usemodule); 484 448 } 485 449 newinclude = newinclude ->suiv; … …  498 462 /* */ 499 463 /******************************************************************************/ 500  void Add_Save_Var_1 (char *name,listdim *d) 501  { 502  listvar *newvar; 503  listdim *dims; 504  char ligne[LONG_C]; 505  char listdimension[LONG_C]; 506   507  if ( firstpass == 1 ) 508  { 509  newvar=(listvar *)malloc(sizeof(listvar)); 510  newvar->var=(variable *)malloc(sizeof(variable)); 511  /* */ 512  Init_Variable(newvar->var); 513  /* */ 514  newvar->var->v_save=1; 515  strcpy(newvar->var->v_nomvar,name); 516  Save_Length(name,4); 517  strcpy(newvar->var->v_modulename,curmodulename); 518  Save_Length(curmodulename,6); 519  strcpy(newvar->var->v_subroutinename,subroutinename); 520  Save_Length(subroutinename,11); 521  strcpy(newvar->var->v_commoninfile,mainfile); 522  Save_Length(mainfile,10); 523   524  newvar->var->v_dimension=d; 525  /* Creation of the string for the dimension of this variable */ 526  dimsempty = 1; 527   528  if ( d ) 529  { 530  newvar->var->v_dimensiongiven=1; 531  dims = d; 532  while (dims) 533  { 534  if ( strcasecmp(dims->dim.first,"") || strcasecmp(dims->dim.last,"")) 535  dimsempty = 0; 536  sprintf(ligne,"%s:%s",dims->dim.first,dims->dim.last); 537  strcat(listdimension,ligne); 538  if ( dims->suiv ) 539  { 540  strcat(listdimension,","); 541  } 542  dims = dims->suiv; 543  } 544  if ( dimsempty == 1 ) newvar->var->v_dimsempty=1; 545  } 546   547  /* strcpy(newvar->var->v_readedlistdimension,listdimension); 548  Save_Length(listdimension,15);*/ 549  /* */ 550  newvar->suiv = NULL; 551   552  if ( !List_Save_Var ) 553  { 554  List_Save_Var = newvar ; 555  } 556  else 557  {  464 void Add_Save_Var_1 (const char *name, listdim *d)  465 {  466 listvar *newvar;  467 listdim *dims;  468 char ligne[LONG_M];  469 char listdimension[LONG_M];  470   471 if ( firstpass == 1 )  472 {  473 newvar = (listvar *) calloc(1,sizeof(listvar));  474 newvar->var = (variable *) calloc(1,sizeof(variable));  475   476 Init_Variable(newvar->var);  477   478 newvar->var->v_save = 1;  479 strcpy(newvar->var->v_nomvar,name);  480 strcpy(newvar->var->v_modulename,curmodulename);  481 strcpy(newvar->var->v_subroutinename,subroutinename);  482 strcpy(newvar->var->v_commoninfile,cur_filename);  483   484 newvar->var->v_dimension = d;  485   486 /* Creation of the string for the dimension of this variable */  487 dimsempty = 1;  488   489 if ( d )  490 {  491 newvar->var->v_dimensiongiven = 1;  492 dims = d;  493 while (dims)  494 {  495 if ( strcasecmp(dims->dim.first,"") || strcasecmp(dims->dim.last,""))  496 dimsempty = 0;  497 sprintf(ligne,"%s:%s",dims->dim.first,dims->dim.last);  498 strcat(listdimension,ligne);  499 if ( dims->suiv ) strcat(listdimension,",");  500 dims = dims->suiv;  501 }  502 if ( dimsempty == 1 ) newvar->var->v_dimsempty = 1;  503 }  504  558 505 newvar->suiv = List_Save_Var; 559 506 List_Save_Var = newvar; 560  } 561  }  507 } 562 508 } 563 509  564 510 void Add_Save_Var_dcl_1 (listvar *var) 565 511 { 566  listvar *newvar; 567  listvar *parcours; 568   569  if ( firstpass == 1 ) 570  { 571  parcours = var; 572  while ( parcours ) 573  { 574  newvar=(listvar *)malloc(sizeof(listvar)); 575  newvar->var=(variable *)malloc(sizeof(variable)); 576  /* */ 577  Init_Variable(newvar->var); 578  /* */ 579  newvar->var->v_save=1; 580  strcpy(newvar->var->v_nomvar,parcours->var->v_nomvar); 581  strcpy(newvar->var->v_modulename,curmodulename); 582  Save_Length(curmodulename,6); 583  strcpy(newvar->var->v_subroutinename,subroutinename); 584  Save_Length(subroutinename,11); 585  strcpy(newvar->var->v_commoninfile,mainfile); 586  Save_Length(mainfile,10); 587  /* */ 588  strcpy(newvar->var->v_readedlistdimension, 589  parcours->var->v_readedlistdimension); 590  newvar->var->v_nbdim = parcours->var->v_nbdim; 591  newvar->var->v_dimension = parcours->var->v_dimension; 592  /* */ 593  newvar->var->v_dimensiongiven=parcours->var->v_dimensiongiven; 594  /* */ 595  newvar->suiv = NULL; 596   597  if ( !List_Save_Var ) List_Save_Var = newvar ; 598  else 599  { 600  newvar->suiv = List_Save_Var; 601  List_Save_Var = newvar; 602  } 603  parcours = parcours->suiv; 604  } 605  } 606  }  512 listvar *newvar;  513 listvar *parcours;  514   515 if ( firstpass == 1 )  516 {  517 parcours = var;  518 while ( parcours )  519 {  520 newvar = (listvar *) calloc(1,sizeof(listvar));  521 newvar->var = (variable *) calloc(1,sizeof(variable));  522   523 Init_Variable(newvar->var);  524   525 newvar->var->v_save = 1;  526 strcpy(newvar->var->v_nomvar,parcours->var->v_nomvar);  527 strcpy(newvar->var->v_modulename,curmodulename);  528 strcpy(newvar->var->v_subroutinename,subroutinename);  529 strcpy(newvar->var->v_commoninfile,cur_filename);  530 strcpy(newvar->var->v_readedlistdimension,parcours->var->v_readedlistdimension);  531   532 newvar->var->v_nbdim = parcours->var->v_nbdim;  533 newvar->var->v_catvar = parcours->var->v_catvar;  534 newvar->var->v_dimension = parcours->var->v_dimension;  535 newvar->var->v_dimensiongiven=parcours->var->v_dimensiongiven;  536 newvar->suiv = List_Save_Var;  537 List_Save_Var = newvar;  538   539 parcours = parcours->suiv;  540 }  541 }  542 } -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/EXTERNAL/AGRIF/LIB/Makefile
r5781 r6237  1  #- option to debugÂ2  C_D = -g # -g -WallÂ3  # Compilation:Â4  CC = cc -OÂ5  #-Â6 1 OBJS = main.o WriteInFile.o toamr.o fortran.o \ 7 2 dependfile.o SubLoopCreation.o WorkWithlistvarindoloop.o \ … …  14 9 WorkWithlistofcoupled.o 15 10  16  Â17 11 .SUFFIXES: 18 12 .SUFFIXES: .c .o 19 13  20  all : conv 21  @echo CONV is ok  14 all: conv  15 @echo  16 @echo ===================================================  17 @echo CONV is ok  18 @echo ===================================================  19 @echo 22 20  23  conv : $(OBJS) 24  @$(CC) $(OBJS) -o ../$@  21 #main.c: convert.y convert.lex  22 # @echo ===================================================  23 # @echo Rebuilding main.c ...  24 # @echo ===================================================  25 # $(MAKE) -f Makefile.lex main.c  26   27 #fortran.c: fortran.y fortran.lex  28 # @echo ===================================================  29 # @echo Rebuilding fortran.c ...  30 # @echo ===================================================  31 # $(MAKE) -f Makefile.lex fortran.c  32   33 conv: $(OBJS)  34 $(CC) $(CFLAGS) -g $(OBJS) -o ../$@  35   36 %.o: %.c  37 $(CC) $(CFLAGS) -g -c $< -o $@ 25 38  26 39 main.o : main.c … …  28 41 toamr.o : toamr.c decl.h 29 42 WriteInFile.o : WriteInFile.c decl.h 30  dependfile.o : dependfile.c decl.h 31  SubLoopCreation.o : SubLoopCreation.c decl.h 32  WorkWithglobliste.o : WorkWithglobliste.c decl.h 33  WorkWithlistvarindoloop.o : WorkWithlistvarindoloop.c decl.h 34  WorkWithvarofsubroutineliste.o : WorkWithvarofsubroutineliste.c decl.h 35  Writedeclarations.o : Writedeclarations.c decl.h 36  UtilFortran.o : UtilFortran.c decl.h 37  WorkWithParameterlist.o : WorkWithParameterlist.c decl.h 38  UtilNotGridDep.o : UtilNotGridDep.c decl.h 39  WorkWithlistdatavariable.o : WorkWithlistdatavariable.c decl.h 40  DiversListe.o : DiversListe.c decl.h 41  UtilAgrif.o : UtilAgrif.c decl.h  43 dependfile.o : dependfile.c decl.h  44 SubLoopCreation.o : SubLoopCreation.c decl.h  45 WorkWithglobliste.o : WorkWithglobliste.c decl.h  46 WorkWithlistvarindoloop.o : WorkWithlistvarindoloop.c decl.h  47 WorkWithvarofsubroutineliste.o : WorkWithvarofsubroutineliste.c decl.h  48 Writedeclarations.o : Writedeclarations.c decl.h  49 UtilFortran.o : UtilFortran.c decl.h  50 WorkWithParameterlist.o : WorkWithParameterlist.c decl.h  51 UtilNotGridDep.o : UtilNotGridDep.c decl.h  52 WorkWithlistdatavariable.o : WorkWithlistdatavariable.c decl.h  53 DiversListe.o : DiversListe.c decl.h  54 UtilAgrif.o : UtilAgrif.c decl.h 42 55 WorkWithAllocatelist.o : WorkWithAllocatelist.c decl.h 43 56 UtilCharacter.o : UtilCharacter.c decl.h … …  47 60 WorkWithlistmoduleinfile.o : WorkWithlistmoduleinfile.c decl.h 48 61 WorkWithlistofcoupled.o : WorkWithlistofcoupled.c decl.h 49  clean :  50  /bin/rm -f *.o y.output  62   63 clean:  64 # $(MAKE) -f Makefile.lex clean  65 $(RM) *.o conv  66  -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/EXTERNAL/AGRIF/LIB/SubLoopCreation.c
r5781 r6237  45 45  46 46 /******************************************************************************/ 47  /* writeheadnewsub_0 */ 48  /******************************************************************************/ 49  /* Firstpass 0 */  47 /* WriteBeginof_SubLoop */  48 /******************************************************************************/ 50 49 /* We should write the head of the subroutine sub_loop_<subroutinename> */ 51 50 /******************************************************************************/ 52 51 /* */ 53 52 /******************************************************************************/ 54  void writeheadnewsub_0() 55  { 56  char ligne[LONG_C]; 57   58  if ( firstpass == 0 && IsTabvarsUseInArgument_0() == 1 ) 59  { 60  if ( todebug == 1 ) printf("Enter in writeheadnewsub_0\n");  53 void WriteBeginof_SubLoop()  54 {  55 if (todebug == 1) printf("##\n## Enter in HEAD SUBLOOP for |%s|\n##\n", subroutinename);  56 if ( IsTabvarsUseInArgument_0() == 1 )  57 {  58 if ( todebug == 1 ) printf("> enter in WriteBeginof_SubLoop : IsTabvarsUseInArgument_0() == 1\n"); 61 59 /* we should add the use agrif_uti l if it is necessary */ 62 60 WriteHeadofSubroutineLoop(); 63 61 WriteUsemoduleDeclaration(subroutinename); 64  if ( ImplicitNoneInSubroutine() == 1 ) fprintf(fortranout, 65  " IMPLICIT NONE\n"); 66  WriteIncludeDeclaration();  62 if ( ImplicitNoneInSubroutine() == 1 ) fprintf(fortran_out, " implicit none\n");  63 WriteIncludeDeclaration(fortran_out); 67 64 /* */ 68 65 /* We should write once the declaration of tables (extract */ 69 66 /* from pointer) in the new subroutine */ 70  if ( mark == 1 ) fprintf(fortranout,"!!! 000000000000000 \n"); 71   72  if ( SubInList_ContainsSubroutine() == 0 ) WriteLocalParamDeclaration(); 73  if ( mark == 1 ) fprintf(fortranout,"!!! 111111111111111 \n"); 74   75  sprintf(ligne,"\n#include \"ParamFile%s.h\" \n",subroutinename); 76  tofich(fortranout,ligne,1); 77   78  WriteArgumentDeclaration_Sort(); 79   80  if ( mark == 1 ) fprintf(fortranout,"!!! 222222222222222 \n"); 81  writesub_loopdeclaration_tab(List_UsedInSubroutine_Var,fortranout); 82  if ( mark == 1 ) fprintf(fortranout,"!!! 333333333333333 \n"); 83  writesub_loopdeclaration_scalar(List_UsedInSubroutine_Var,paramout); 84  if ( mark == 1 ) fprintf(fortranout,"!!! 444444444444444 \n"); 85  /* now we should write the function declaration */ 86  /* case if it is the */ 87  WriteFunctionDeclaration(1); 88  if ( mark == 1 ) fprintf(fortranout,"!!! 555555555555555 \n"); 89   90  // if ( SubInList_ContainsSubroutine() == 0 ) WriteSubroutineDeclaration(1); 91   92  if ( mark == 1 ) fprintf(fortranout,"!!! 666666666666666 \n"); 93  if ( todebug == 1 ) printf("Out of writeheadnewsub_0\n"); 94  } 95  else if ( firstpass == 0 ) 96  { 97  AddUseAgrifUtil_0(fortranout);  67 if ( SubInList_ContainsSubroutine() == 0 ) WriteLocalParamDeclaration(fortran_out);  68   69 writesub_loopdeclaration_scalar(List_UsedInSubroutine_Var,fortran_out);  70 writesub_loopdeclaration_tab(List_UsedInSubroutine_Var,fortran_out);  71 WriteArgumentDeclaration_Sort(fortran_out);  72 WriteFunctionDeclaration(fortran_out, 1);  73 }  74 else  75 {  76 if ( todebug == 1 ) printf("> enter in WriteBeginof_SubLoop : IsTabvarsUseInArgument_0() == 0\n");  77 AddUseAgrifUtil_0(fortran_out); 98 78 WriteUsemoduleDeclaration(subroutinename); 99  WriteIncludeDeclaration(); 100  if ( ImplicitNoneInSubroutine() == 1 ) fprintf(fortranout, 101  " IMPLICIT NONE\n"); 102  if ( mark == 1 ) fprintf(fortranout,"!!! aaaaaaaaaaaaaaa \n"); 103  WriteLocalParamDeclaration(); 104  if ( mark == 1 ) fprintf(fortranout,"!!! bbbbbbbbbbbbbbb \n");   79 WriteIncludeDeclaration(fortran_out);  80 if ( ImplicitNoneInSubroutine() == 1 ) fprintf(fortran_out, " implicit none\n");  81 WriteLocalParamDeclaration(fortran_out); 105 82 WriteArgumentDeclaration_beforecall(); 106  if ( mark == 1 ) fprintf(fortranout,"!!! bbbbbbccccccccc \n"); 107  if ( functiondeclarationisdone == 0 ) WriteFunctionDeclaration(1); 108  /* writesub_loopdeclaration_scalar(List_SubroutineArgument_Var,fortranout); 109  writesub_loopdeclaration_tab(List_SubroutineArgument_Var,fortranout);*/ 110  if ( mark == 1 ) fprintf(fortranout,"!!! ccccccccccccccc \n"); 111  if ( mark == 1 ) fprintf(fortranout,"!!! ddddddddddddddd \n"); 112  // WriteSubroutineDeclaration(1); 113  if ( mark == 1 ) fprintf(fortranout,"!!! eeeeeeeeeeeeeee \n"); 114  } 115  } 116    83 if ( functiondeclarationisdone == 0 ) WriteFunctionDeclaration(fortran_out, 1);  84 /* writesub_loopdeclaration_scalar(List_SubroutineArgument_Var,fortran_out);  85 writesub_loopdeclaration_tab(List_SubroutineArgument_Var,fortran_out);*/  86 }  87 if ( todebug == 1 ) printf("< out of WriteBeginof_SubLoop\n");  88 if ( todebug == 1 ) printf("## EXIT HEAD SUBLOOP (%s)\n\n", subroutinename);  89 } 117 90  118 91 /******************************************************************************/ … …  129 102 /* */ 130 103 /******************************************************************************/ 131  void WriteVariablelist_subloop( FILE *outputfile,char *ligne) 104 void WriteVariablelist_subloop(char *ligne) 132 105 { 133 106 listvar *parcours; 134  int compteur; 135   136  if ( todebug == 1 ) printf("Enter in WriteVariablelist_subloop\n");  107   108 if ( todebug == 1 ) printf("> enter in WriteVariablelist_subloop\n"); 137 109 parcours = List_SubroutineArgument_Var; 138 110 didvariableadded = 0; 139  compteur = 0 ;Â140 111  141 112 while ( parcours ) 142 113 { 143  Â144 114 /* if the readed variable is a variable of the subroutine */ 145 115 /* subroutinename we should write the name of this variable */ … …  147 117 if ( !strcasecmp(parcours->var->v_subroutinename,subroutinename) ) 148 118 { 149  if ( didvariableadded == 1 ) 150  { 151  strcat(ligne,","); 152  }  119 if ( didvariableadded == 1 ) strcat(ligne,","); 153 120 strcat(ligne,parcours->var->v_nomvar); 154 121 didvariableadded = 1; 155   122 } 156 123 parcours = parcours -> suiv; 157 124 } … …  161 128 if ( !strcasecmp(parcours->var->v_subroutinename,subroutinename) ) 162 129 { 163  if ( didvariableadded == 1 ) 164  { 165  strcat(ligne,","); 166  }  130 if ( didvariableadded == 1 ) strcat(ligne,","); 167 131 strcat(ligne,parcours->var->v_nomvar); 168 132 didvariableadded = 1; 169   133 } 170 134 parcours = parcours -> suiv; 171 135 } 172  if ( todebug == 1 ) printf(" Out of WriteVariablelist_subloop\n"); 136 if ( todebug == 1 ) printf("< out of WriteVariablelist_subloop\n"); 173 137 } 174 138  … …  188 152 /* */ 189 153 /******************************************************************************/ 190  void WriteVariablelist_subloop_Call( FILE *outputfile,char *ligne) 154 void WriteVariablelist_subloop_Call(char **ligne, size_t line_length) 191 155 { 192 156 listvar *parcours; 193  char ligne2[ 10]; 157 char ligne2[LONG_M]; 194 158 int i; 195  int compteur ; 196   197  if ( todebug == 1 ) printf("Enter in WriteVariablelist_subloop_Call\n");  159 size_t cur_length;  160   161 cur_length = line_length;  162   163 if ( todebug == 1 ) printf("> enter in WriteVariablelist_subloop_Call\n"); 198 164 parcours = List_UsedInSubroutine_Var; 199  compteur = 0 ;  165  200 166 while ( parcours ) 201 167 { … …  207 173 ) 208 174 { 209  if ( didvariableadded == 1 )  175 if ( didvariableadded == 1 ) strcat(*ligne,",");  176 const char *vres = vargridcurgridtabvars(parcours->var, 0);  177 if ( (strlen(*ligne)+strlen(vres)+100) > cur_length ) 210 178 { 211  strcat(ligne," , ");  179 cur_length += LONG_M;  180 *ligne = realloc( *ligne, cur_length*sizeof(char) ); 212 181 } 213  strcat( ligne,vargridcurgridtabvars(parcours->var,0)); 182 strcat(*ligne, vres); 214 183 /* if it is asked in the call of the conv we should give */ 215 184 /* scalar in argument, so we should put (1,1,1) after the */ … …  223 192 while ( i <= parcours->var->v_nbdim ) 224 193 { 225  if ( i == 1 ) strcat( ligne,"( "); 194 if ( i == 1 ) strcat(*ligne,"( "); 226 195 if ( SubloopScalar == 2 ) 227 196 { 228  strcat( ligne,":");Â229  if ( i != parcours->var->v_nbdim ) strcat( ligne,","); 197 strcat(*ligne,":");  198 if ( i != parcours->var->v_nbdim ) strcat(*ligne,","); 230 199 } 231 200 else 232 201 { 233  strcat(ligne," lbound( "); 234  strcat(ligne,vargridcurgridtabvars(parcours->var,0)); 235  strcat(ligne,","); 236  strcpy(ligne2,""); 237  sprintf(ligne2,"%d",i); 238  strcat(ligne,ligne2); 239  if ( i != parcours->var->v_nbdim ) strcat(ligne,"),");  202 sprintf(ligne2,"lbound(%s,%d",vargridcurgridtabvars(parcours->var,0),i);  203 strcat(*ligne,ligne2);  204 if ( i != parcours->var->v_nbdim ) strcat(*ligne,"),"); 240 205 } 241  if ( i == parcours->var->v_nbdim ) strcat( ligne,"))"); 206 if ( i == parcours->var->v_nbdim ) strcat(*ligne,"))"); 242 207 i++; 243 208 } 244 209 } 245 210 didvariableadded = 1; 246  compteur = compteur +1 ;Â247  /*if ( retour77 == 0 )Â248  {Â249  strcat(ligne," &");Â250  fprintf(outputfile,"\n");Â251  }Â252  else fprintf(outputfile,"\n & ");*/Â253  /*tofich(outputfile,ligne,0);*/Â254 211 } 255 212 parcours = parcours -> suiv; 256 213 } 257   258  // Save_Length(ligne,41); 259  // tofich(outputfile,ligne,0); 260  /* Now we should replace the last ", &" by " &" */ 261  /* if ( didvariableadded != 0 && retour77 == 0 ) fseek(outputfile,-1,SEEK_CUR); 262  if ( didvariableadded == 0 ) fseek(outputfile,-1,SEEK_CUR);*/ 263  if ( todebug == 1 ) printf("Out of WriteVariablelist_subloop_Call\n");  214 if ( todebug == 1 ) printf("< out of WriteVariablelist_subloop_Call\n"); 264 215 } 265 216  … …  280 231 /* */ 281 232 /******************************************************************************/ 282  void WriteVariablelist_subloop_Def( FILE *outputfile,char *ligne) 233 void WriteVariablelist_subloop_Def(char *ligne) 283 234 { 284 235 listvar *parcours; 285  /* char ligne[LONG_40M];*/ 286  int compteur; 287   288  if ( todebug == 1 ) printf("Enter in WriteVariablelist_subloop_Def\n");  236   237 if ( todebug == 1 ) printf("> enter in WriteVariablelist_subloop_Def\n"); 289 238 parcours = List_UsedInSubroutine_Var; 290  compteur = 0 ;  239  291 240 while ( parcours ) 292 241 { … …  295 244 /* in the output file */ 296 245 if ( !strcasecmp(parcours->var->v_subroutinename,subroutinename) && 297  (parcours->var->v_pointerdeclare == 0 || !strcasecmp(parcours->var->v_typevar,"type")) 298  )  246 (parcours->var->v_pointerdeclare == 0 || !strcasecmp(parcours->var->v_typevar,"type")) ) 299 247 { 300  if ( didvariableadded == 1 ) 301  { 302  strcat(ligne,","); 303  }  248 if ( didvariableadded == 1 ) strcat(ligne,","); 304 249 strcat(ligne,parcours->var->v_nomvar); 305 250 didvariableadded = 1; 306   251 } 307 252 parcours = parcours -> suiv; 308 253 } 309  /* if ( compteur != 3 && compteur != 0 )Â310  {Â311  if ( retour77 == 0 ) fprintf(outputfile,"\n %s &",ligne);Â312  else fprintf(outputfile,"\n & %s",ligne);Â313  }*/Â314 254 Save_Length(ligne,41); 315  // tofich(outputfile,ligne,0); 316   317  /* Now we should replace the last ", &" by " &" */ 318  /* if ( didvariableadded != 0 && retour77 == 0 ) fseek(outputfile,-1,SEEK_CUR); 319  if ( didvariableadded == 0 ) fseek(outputfile,-1,SEEK_CUR);*/ 320  if ( todebug == 1 ) printf("Out of WriteVariablelist_subloop_Def\n"); 321   322  } 323   324    255 if ( todebug == 1 ) printf("< out of WriteVariablelist_subloop_Def\n");  256 } 325 257  326 258 /******************************************************************************/ … …  340 272 void WriteHeadofSubroutineLoop() 341 273 { 342  char ligne[LONG_ 40M]; 274 char ligne[LONG_M]; 343 275 FILE * subloop; 344 276  345  if ( todebug == 1 ) printf(" Enter in WriteHeadofSubroutineLoop\n");Â346  tofich(fortran out,"\n",1); 277 if ( todebug == 1 ) printf("> enter in WriteHeadofSubroutineLoop\n");  278 tofich(fortran_out,"\n",1); 347 279 /* Open this newfile */ 348 280 sprintf(ligne,"Sub_Loop_%s.h",subroutinename); 349  subloop = associate(ligne); 281 subloop = open_for_write(ligne); 350 282 /* */ 351  if (isrecursive)  352  { 353  sprintf(ligne," recursive subroutine Sub_Loop_%s(",subroutinename); 354  } 355  else 356  { 357  sprintf(ligne," subroutine Sub_Loop_%s(",subroutinename); 358  }  283 if (isrecursive) sprintf(ligne,"recursive subroutine Sub_Loop_%s(",subroutinename);  284 else sprintf(ligne,"subroutine Sub_Loop_%s(",subroutinename); 359 285 /* */ 360  WriteVariablelist_subloop( subloop,ligne);Â361  WriteVariablelist_subloop_Def( subloop,ligne); 286 WriteVariablelist_subloop(ligne);  287 WriteVariablelist_subloop_Def(ligne); 362 288 /* */ 363   289 strcat(ligne,")"); 364 290 tofich(subloop,ligne,1); 365 291 /* if USE agrif_Uti l should be add */ 366 292 AddUseAgrifUtil_0(subloop); 367 293 /* */ 368  oldfortran out = fortranout;Â369  fortran out = subloop;Â370  if ( todebug == 1 ) printf(" Out of WriteHeadofSubroutineLoop\n"); 294 oldfortran_out = fortran_out;  295 fortran_out = subloop;  296 if ( todebug == 1 ) printf("< out of WriteHeadofSubroutineLoop\n"); 371 297 } 372 298  … …  386 312 void closeandcallsubloopandincludeit_0(int suborfun) 387 313 { 388  char ligne[LONG_40M]; 389   390  if ( firstpass == 0 ) 391  { 392   393  if ( todebug == 1 ) printf("Enter in closeandcallsubloopandincludeit_0\n");  314 char *ligne;  315   316 if ( firstpass == 1 ) return;  317 if ( todebug == 1 ) printf("> enter in closeandcallsubloopandincludeit_0\n");  318   319 ligne = (char*) calloc(LONG_M, sizeof(char));  320  394 321 if ( IsTabvarsUseInArgument_0() == 1 ) 395 322 { 396 323 /* We should remove the key word end subroutine */ 397  RemoveWordCUR_0(fortranout,(long)(-(pos_cur-pos_endsubroutine)), 398  pos_cur-pos_endsubroutine);  324 RemoveWordCUR_0(fortran_out,setposcur()-pos_endsubroutine); 399 325 /* We should close the loop subroutine */ 400  sprintf(ligne,"\n end subroutine Sub_Loop_%s",subroutinename);Â401  tofich(fortranout,ligne,1);Â402  fclose(fortranout);Â403  f ortranout = oldfortranout;Â404   405   406  AddUseAgrifUtilBeforeCall_0(fortran out); 326 tofich(fortran_out,"\n",1);  327 sprintf(ligne,"end subroutine Sub_Loop_%s\n",subroutinename);  328 tofich(fortran_out,ligne,1);  329 fclose(fortran_out);  330 fortran_out = oldfortran_out;  331   332 AddUseAgrifUtilBeforeCall_0(fortran_out); 407 333 WriteArgumentDeclaration_beforecall(); 408  if ( functiondeclarationisdone == 0 ) WriteFunctionDeclaration( 0); 334 if ( functiondeclarationisdone == 0 ) WriteFunctionDeclaration(fortran_out, 0); 409 335 if ( !strcasecmp(subofagrifinitgrids,subroutinename) ) 410  fprintf(oldfortranout," Call Agrif_Init_Grids ()\n"); 336 fprintf(fortran_out," call Agrif_Init_Grids()\n"); 411 337 /* Now we add the call af the new subroutine */ 412  sprintf(ligne,"\n Call Sub_Loop_%s( ",subroutinename);  338 tofich(fortran_out,"\n",1);  339 sprintf(ligne," call Sub_Loop_%s(",subroutinename); 413 340 /* Write the list of the local variables used in this new subroutine */ 414  WriteVariablelist_subloop( fortranout,ligne); 341 WriteVariablelist_subloop(ligne); 415 342 /* Write the list of the global tables used in this new subroutine */ 416 343 /* in doloop */ 417  WriteVariablelist_subloop_Call( fortranout,ligne); 344 WriteVariablelist_subloop_Call(&ligne, LONG_M); 418 345 /* Close the parenthesis of the new subroutine called */ 419  strcat(ligne,")");Â420  Â421  tofich(fortranout,ligne,1); 346 strcat(ligne,")\n");  347 tofich(fortran_out,ligne,1);  348 /* we should include the above file in the original code */ 422 349  423 350 /* We should close the original subroutine */ 424  if ( suborfun == 3 ) sprintf(ligne,"\n end program %s" 425  ,subroutinename); 426  if ( suborfun == 2 ) sprintf(ligne,"\n end"); 427  if ( suborfun == 1 ) sprintf(ligne,"\n end subroutine %s" 428  ,subroutinename); 429  if ( suborfun == 0 ) sprintf(ligne,"\n end function %s" 430  ,subroutinename); 431  tofich(fortranout,ligne,1); 432  /* we should include the above file in the original code */ 433  sprintf(ligne,"\n#include \"Sub_Loop_%s.h\" \n",subroutinename); 434  tofich(fortranout,ligne,1); 435  } 436  oldfortranout = (FILE *)NULL;  437  if ( todebug == 1 ) printf("Out of closeandcallsubloopandincludeit_0\n"); 438  } 439   440  } 441   442   443    351 if ( suborfun == 3 ) fprintf(fortran_out, " end program %s\n" , subroutinename);  352 if ( suborfun == 2 ) fprintf(fortran_out, " end\n");  353 if ( suborfun == 1 ) fprintf(fortran_out, " end subroutine %s\n", subroutinename);  354 if ( suborfun == 0 ) fprintf(fortran_out, " end function %s\n" , subroutinename);  355   356 fprintf(fortran_out,"\n\n#include \"Sub_Loop_%s.h\"\n",subroutinename);  357 }  358 oldfortran_out = (FILE *)NULL;  359 if ( todebug == 1 ) printf("< out of closeandcallsubloopandincludeit_0\n");  360 } 444 361  445 362 void closeandcallsubloop_contains_0() 446 363 { 447  char ligne[LONG_40M]; 448   449  if ( firstpass == 0 ) 450  { 451  if ( todebug == 1 ) printf("Enter in closeandcallsubloopandincludeit_0\n");  364 char *ligne;  365   366 if ( todebug == 1 ) printf("> enter in closeandcallsubloop_contains_0\n"); 452 367 if ( IsTabvarsUseInArgument_0() == 1 ) 453 368 { 454  Remove_Word_Contains_0(); 455  sprintf(ligne,"\n end subroutine Sub_Loop_%s",subroutinename); 456  tofich(fortranout,ligne,1); 457  fclose(fortranout); 458  fortranout = oldfortranout; 459   460  AddUseAgrifUtilBeforeCall_0(fortranout); 461  if ( ImplicitNoneInSubroutine() == 1 ) fprintf(fortranout, 462  " IMPLICIT NONE\n"); 463  WriteLocalParamDeclaration();  369 ligne = (char*) calloc(LONG_M, sizeof(char));  370 RemoveWordCUR_0(fortran_out,9); // Remove word 'contains'  371 tofich(fortran_out,"\n",1);  372 sprintf(ligne,"end subroutine Sub_Loop_%s\n",subroutinename);  373 tofich(fortran_out,ligne,1);  374 fclose(fortran_out);  375 fortran_out = oldfortran_out;  376   377 AddUseAgrifUtilBeforeCall_0(fortran_out);  378   379 if ( ImplicitNoneInSubroutine() == 1 ) fprintf(fortran_out, " implicit none\n");  380 WriteLocalParamDeclaration(fortran_out); 464 381 WriteArgumentDeclaration_beforecall(); 465  if ( functiondeclarationisdone == 0 ) WriteFunctionDeclaration( 0);Â466  WriteSubroutineDeclaration(0);  382 if ( functiondeclarationisdone == 0 ) WriteFunctionDeclaration(fortran_out, 0);  383 /* WriteSubroutineDeclaration(0);*/ 467 384 if ( !strcasecmp(subofagrifinitgrids,subroutinename) ) 468  fprintf(oldfortranout," Call Agrif_Init_Grids ()\n"); 385 fprintf(fortran_out," call Agrif_Init_Grids()\n"); 469 386 /* Now we add the call af the new subroutine */ 470  if ( retour77 == 0 ) sprintf(ligne,"\n Call Sub_Loop_%s( &" 471  ,subroutinename); 472  else sprintf(ligne,"\n Call Sub_Loop_%s( ",subroutinename); 473  fprintf(fortranout,ligne);  387 tofich(fortran_out,"\n",1);  388 sprintf(ligne," call Sub_Loop_%s(",subroutinename); 474 389 /* Write the list of the local variables used in this new subroutine */ 475  WriteVariablelist_subloop( fortranout,ligne); 390 WriteVariablelist_subloop(ligne); 476 391 /* Write the list of the global tables used in this new subroutine */ 477 392 /* in doloop */ 478  WriteVariablelist_subloop_Call( fortranout,ligne); 393 WriteVariablelist_subloop_Call(&ligne, LONG_M); 479 394 /* Close the parenthesis of the new subroutine called */ 480  s printf(ligne,")");Â481  tofich(fortran out,ligne,1); 395 strcat(ligne,")\n");  396 tofich(fortran_out,ligne,1); 482 397 /* We should close the original subroutine */ 483  sprintf(ligne,"\n contains"); 484  tofich(fortranout,ligne,1);  398 fprintf(fortran_out, " contains\n"); 485 399 /* we should include the above file in the original code */ 486  sprintf(ligne,"\n#include \"Sub_Loop_%s.h\" \n",subroutinename); 487  tofich(fortranout,ligne,1);  400 fprintf(fortran_out,"#include \"Sub_Loop_%s.h\"\n",subroutinename); 488 401 } 489  oldfortranout = (FILE *)NULL; 490  if ( todebug == 1 ) printf("Out of closeandcallsubloopandincludeit_0\n"); 491  } 492  }  402 oldfortran_out = (FILE *)NULL;  403 if ( todebug == 1 ) printf("< out of closeandcallsubloop_contains_0\n");  404 } -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/EXTERNAL/AGRIF/LIB/UtilAgrif.c
r5783 r6237  45 45 /* */ 46 46 /******************************************************************************/ 47  int Vartonumber(c har *tokname) 47 int Vartonumber(const char *tokname) 48 48 { 49 49 int agrifintheword; … …  68 68 else if ( !strcasecmp(tokname,"Agrif_Set_restore") ) agrifintheword = 1; 69 69 else if ( !strcasecmp(tokname,"Agrif_Save_Forrestore")) agrifintheword = 1; 70  else if ( !strcasecmp(tokname,"agrif_init_grids") ) agrifintheword = 1; 71  else if ( !strcasecmp(tokname,"agrif_step") ) agrifintheword = 1;  70 else if ( !strcasecmp(tokname,"Agrif_init_grids") ) agrifintheword = 1;  71 else if ( !strcasecmp(tokname,"Agrif_step") ) agrifintheword = 1;  72 /**************************************************/  73 /* adding specific adjoint agrif subroutine names */  74 /**************************************************/  75 else if ( !strcasecmp(tokname,"Agrif_bc_variable_adj") ) agrifintheword = 1;  76 else if ( !strcasecmp(tokname,"Agrif_update_variable_adj")) agrifintheword = 1; 72 77  73 78 return agrifintheword; … …  85 90 /* */ 86 91 /******************************************************************************/ 87  int Agrif_in_Tok_NAME(char *tokname) 88  { 89  int agrifintheword; 90   91  if ( strncasecmp(tokname,"Agrif_",6) == 0 ) agrifintheword = 1; 92  else agrifintheword = 0; 93   94  return agrifintheword;  92 int Agrif_in_Tok_NAME(const char *tokname)  93 {  94 return ( strncasecmp(tokname,"Agrif_",6) == 0 ); 95 95 } 96 96  … …  104 104 /* */ 105 105 /******************************************************************************/ 106  void ModifyTheVariableName_0(char *ident, int lengthname) 107  { 108  listvar *newvar; 109  int out; 110   111  printf("ICI ident = %s\n",ident); 112   113  if ( firstpass == 0 ) 114  { 115  newvar = List_Global_Var; 116  out=0; 117  while ( newvar && out == 0 ) 118  { 119  if ( !strcasecmp(newvar->var->v_nomvar,ident) ) out = 1; 120  else newvar=newvar->suiv; 121  } 122  printf("out1 = %d\n",out); 123  if ( out == 0 ) 124  { 125  newvar = List_ModuleUsed_Var; 126  while ( newvar && out == 0 ) 127  {  106 void ModifyTheVariableName_0(const char *ident, int lengthname)  107 {  108 listvar *newvar;  109 int out;  110   111 if ( firstpass ) return;  112   113 newvar = List_Global_Var;  114 out = 0;  115 while ( newvar && out == 0 )  116 {  117 if ( !strcasecmp(newvar->var->v_nomvar, ident) ) out = 1;  118 else newvar = newvar->suiv;  119 }  120 if ( out == 0 )  121 {  122 newvar = List_ModuleUsed_Var;  123 while ( newvar && out == 0 )  124 { 128 125 if ( !strcasecmp(newvar->var->v_nomvar,ident) ) out = 1; 129  else newvar =newvar->suiv;Â130  131  132  if (out == 1&& !strcasecmp(newvar->var->v_typevar,"type")) return;Â133   134  135  136  137  138   126 else newvar = newvar->suiv;  127 }  128 }  129 if ( out && !strcasecmp(newvar->var->v_typevar,"type")) return;  130   131 if ( out == 0 )  132 {  133 newvar = List_Common_Var;  134 while ( newvar && out == 0 )  135 { 139 136 if ( !strcasecmp(newvar->var->v_nomvar,ident) ) out = 1; 140  else newvar=newvar->suiv; 141  } 142  } 143   144  if ( out == 0 ) 145  { 146  newvar = List_ModuleUsedInModuleUsed_Var; 147  while ( newvar && out == 0 ) 148  {  137 else newvar = newvar->suiv;  138 }  139 }  140 if ( out == 0 )  141 {  142 newvar = List_ModuleUsedInModuleUsed_Var;  143 while ( newvar && out == 0 )  144 { 149 145 if ( !strcasecmp(newvar->var->v_nomvar,ident) ) out = 1; 150  else newvar=newvar->suiv; 151  } 152  } 153   154  if ( out == 1 && strcasecmp(newvar->var->v_typevar,"type")) 155  { 156  printf("ICIC3\n"); 157  /* remove the variable */ 158  RemoveWordCUR_0(fortranout,(long)(-lengthname), 159  lengthname); 160  fseek(fortranout,(long)(-lengthname),SEEK_CUR); 161  /* then write the new name */ 162  if ( inagrifcallargument == 1 && agrif_parentcall == 0 ) 163  fprintf(fortranout,"%d",newvar->var->v_indicetabvars); 164  else 165  {  146 else newvar = newvar->suiv;  147 }  148 }  149 if ( out == 1 && strcasecmp(newvar->var->v_typevar,"type"))  150 {  151 // remove the variable  152 RemoveWordCUR_0(fortran_out,lengthname);  153 // then write the new name  154 if ( inagrifcallargument == 1 && agrif_parentcall == 0 )  155 fprintf(fortran_out,"%d",newvar->var->v_indicetabvars);  156 else  157 { 166 158 if ( retour77 == 0 ) 167  { 168  fprintf(fortranout," Agrif_tabvars & \n "); 169  }  159 fprintf(fortran_out,"Agrif_%s & \n ", tabvarsname(newvar->var)); 170 160 else 171 161 { 172  fprintf(fortran out,"Agrif_tabvars");Â173  fprintf(fortran out," \n & "); 162 fprintf(fortran_out,"Agrif_%s", tabvarsname(newvar->var));  163 fprintf(fortran_out," \n & "); 174 164 } 175  fprintf(fortranout,"%s", 176  vargridcurgridtabvarswithoutAgrif_Gr(newvar->var)); 177  colnum = strlen(vargridcurgridtabvarswithoutAgrif_Gr(newvar->var)); 178  } 179  } 180  else 181  { 182  /* we should look in the List_ModuleUsed_Var */ 183  if ( inagrifcallargument != 1 ) 184  {  165 fprintf(fortran_out,"%s",vargridcurgridtabvarswithoutAgrif_Gr(newvar->var));  166 }  167 }  168 else  169 {  170 // we should look in the List_ModuleUsed_Var  171 if ( inagrifcallargument != 1 )  172 { 185 173 newvar = List_ModuleUsed_Var; 186 174 while ( newvar && out == 0 ) 187 175 { 188  if ( !strcasecmp(newvar->var->v_nomvar,ident) ) out = 1;Â189  else newvar=newvar->suiv; 176 if ( !strcasecmp(newvar->var->v_nomvar,ident) ) out = 1;  177 else newvar = newvar->suiv; 190 178 } 191  if ( out == 1 && strcasecmp(newvar->var->v_typevar, "type")) 179 if ( out == 1 && strcasecmp(newvar->var->v_typevar, "type")) 192 180 { 193  printf("ICICIC4 %s\n",newvar->var->v_typevar); 194  /* remove the variable */ 195  RemoveWordCUR_0(fortranout,(long)(-lengthname), 196  lengthname); 197  fseek(fortranout,(long)(-lengthname),SEEK_CUR); 198  /* then write the new name */ 199  if ( retour77 == 0 ) 200  { 201  fprintf(fortranout," Agrif_tabvars & \n "); 202  } 203  else 204  { 205  fprintf(fortranout," \n & Agrif_tabvars"); 206  } 207  fprintf(fortranout,"%s", 208  vargridcurgridtabvarswithoutAgrif_Gr(newvar->var)); 209  colnum = strlen( 210  vargridcurgridtabvarswithoutAgrif_Gr(newvar->var));  181 // remove the variable  182 RemoveWordCUR_0(fortran_out,lengthname);  183 // then write the new name  184 if ( retour77 == 0 )  185 fprintf(fortran_out,"Agrif_%s & \n ",tabvarsname(newvar->var));  186 else  187 {  188 fprintf(fortran_out," \n &Agrif_%s",tabvarsname(newvar->var));  189 }  190 fprintf(fortran_out,"%s",vargridcurgridtabvarswithoutAgrif_Gr(newvar->var)); 211 191 } 212  } 213  } 214  } 215  } 216   217  /******************************************************************************/ 218  /* ModifyTheVariableName_0 */ 219  /******************************************************************************/ 220  /* Firstpass 0 */ 221  /******************************************************************************/ 222  /* */ 223  /* Agrif_<toto>(variable) ====> Agrif_<toto>(variable) */ 224  /* */ 225  /******************************************************************************/ 226  void ModifyTheVariableNamecoupled_0(char *ident, char* coupledident) 227  { 228  listvar *newvar; 229  int out; 230   231  if ( firstpass == 0 ) 232  { 233  newvar = List_Global_Var; 234  out=0; 235  while ( newvar && out == 0 ) 236  { 237  if ( !strcasecmp(newvar->var->v_nomvar,coupledident) ) out = 1; 238  else newvar=newvar->suiv; 239  } 240   241  if ( out == 0 ) 242  { 243  newvar = List_ModuleUsed_Var; 244  while ( newvar && out == 0 ) 245  { 246  if ( !strcasecmp(newvar->var->v_nomvar,coupledident) ) out = 1; 247  else newvar=newvar->suiv; 248  } 249  } 250  if ( out == 0 ) 251  { 252  newvar = List_Common_Var; 253  while ( newvar && out == 0 ) 254  { 255  if ( !strcasecmp(newvar->var->v_nomvar,coupledident) ) out = 1; 256  else newvar=newvar->suiv; 257  } 258  } 259   260  if ( out == 0 ) 261  { 262  newvar = List_ModuleUsedInModuleUsed_Var; 263  while ( newvar && out == 0 ) 264  { 265  if ( !strcasecmp(newvar->var->v_nomvar,coupledident) ) out = 1; 266  else newvar=newvar->suiv; 267  } 268  } 269   270  if ( out == 1 ) 271  { 272  /* remove the variable */ 273  RemoveWordCUR_0(fortranout,(long)(-strlen(ident)), 274  strlen(ident)); 275  fseek(fortranout,(long)(-strlen(ident)),SEEK_CUR); 276  /* then write the new name */ 277  if ( inagrifcallargument == 1 && agrif_parentcall == 0 ) 278  fprintf(fortranout,"%d",newvar->var->v_indicetabvars); 279  else 280  { 281  if ( retour77 == 0 ) 282  { 283  fprintf(fortranout," Agrif_tabvars & \n "); 284  } 285  else 286  { 287  fprintf(fortranout,"Agrif_tabvars"); 288  fprintf(fortranout," \n & "); 289  } 290  fprintf(fortranout,"%s", 291  vargridcurgridtabvarswithoutAgrif_Gr(newvar->var)); 292  colnum = strlen(vargridcurgridtabvarswithoutAgrif_Gr(newvar->var)); 293  } 294  } 295  else 296  { 297  /* we should look in the List_ModuleUsed_Var */ 298  if ( inagrifcallargument != 1 ) 299  { 300  newvar = List_ModuleUsed_Var; 301  while ( newvar && out == 0 ) 302  { 303  if ( !strcasecmp(newvar->var->v_nomvar,coupledident) ) out = 1; 304  else newvar=newvar->suiv; 305  } 306  if ( out == 1 ) 307  { 308  /* remove the variable */ 309  RemoveWordCUR_0(fortranout,(long)(-strlen(ident)), 310  strlen(ident)); 311  fseek(fortranout,(long)(-strlen(ident)),SEEK_CUR); 312  /* then write the new name */ 313  if ( retour77 == 0 ) 314  { 315  fprintf(fortranout," Agrif_tabvars & \n "); 316  } 317  else 318  { 319  fprintf(fortranout," \n & Agrif_tabvars"); 320  } 321  fprintf(fortranout,"%s", 322  vargridcurgridtabvarswithoutAgrif_Gr(newvar->var)); 323  colnum = strlen( 324  vargridcurgridtabvarswithoutAgrif_Gr(newvar->var)); 325  } 326  } 327  } 328  } 329  } 330   331    192 }  193 }  194 } 332 195  333 196 /******************************************************************************/ … …  348 211 /* */ 349 212 /******************************************************************************/ 350  void Add_SubroutineWhereAgrifUsed_1(char *sub,char *mod) 351  { 352  listnom *listnomtmp; 353  listnom *parcours; 354   355  if ( firstpass == 1 ) 356  { 357  if ( !List_SubroutineWhereAgrifUsed ) 358  { 359  listnomtmp=(listnom *)malloc(sizeof(listnom)); 360  strcpy(listnomtmp->o_nom,sub); 361  Save_Length(sub,23); 362  strcpy(listnomtmp->o_module,mod); 363  Save_Length(mod,24); 364  listnomtmp->suiv = NULL; 365  List_SubroutineWhereAgrifUsed = listnomtmp; 366  } 367  else 368  { 369  parcours = List_SubroutineWhereAgrifUsed; 370  while ( parcours && strcasecmp(parcours->o_nom,sub) ) 371  { 372  parcours = parcours->suiv; 373  } 374  if ( !parcours ) 375  { 376  listnomtmp=(listnom *)malloc(sizeof(listnom)); 377  strcpy(listnomtmp->o_nom,sub); 378  Save_Length(sub,23); 379  strcpy(listnomtmp->o_module,mod); 380  Save_Length(mod,24); 381  listnomtmp->suiv = List_SubroutineWhereAgrifUsed; 382  List_SubroutineWhereAgrifUsed = listnomtmp; 383  } 384  } 385  }  213 void Add_SubroutineWhereAgrifUsed_1(const char *sub, const char *mod)  214 {  215 listnom *listnomtmp;  216 listnom *parcours;  217   218 if ( firstpass == 1 )  219 {  220 if ( !List_SubroutineWhereAgrifUsed )  221 {  222 listnomtmp = (listnom*) calloc(1, sizeof(listnom));  223 strcpy(listnomtmp->o_nom, sub);  224 strcpy(listnomtmp->o_module, mod);  225 listnomtmp->suiv = NULL;  226 List_SubroutineWhereAgrifUsed = listnomtmp;  227 }  228 else  229 {  230 parcours = List_SubroutineWhereAgrifUsed;  231 while ( parcours && strcasecmp(parcours->o_nom,sub) )  232 {  233 parcours = parcours->suiv;  234 }  235 if ( !parcours )  236 {  237 listnomtmp = (listnom*) calloc(1, sizeof(listnom));  238 strcpy(listnomtmp->o_nom, sub);  239 strcpy(listnomtmp->o_module, mod);  240 listnomtmp->suiv = List_SubroutineWhereAgrifUsed;  241 List_SubroutineWhereAgrifUsed = listnomtmp;  242 }  243 }  244 } 386 245 } 387 246  … …  411 270 parcours = List_SubroutineWhereAgrifUsed; 412 271 while ( parcours && strcasecmp(parcours->o_nom,subroutinename) ) 413  parcours = parcours -> suiv;  272 {  273 parcours = parcours -> suiv;  274 } 414 275 if ( parcours && parcours->o_val != 0 ) 415  { 416  if( strcasecmp(subroutinename,"Agrif_InvLoc") )  417  fprintf(fileout,"\n USE Agrif_Util \n"); 418  else fprintf(fileout,"\n USE Agrif_Types \n"); 419   420  }  276 fprintf(fileout,"\n use Agrif_Util\n");  277 else  278 fprintf(fileout,"\n use Agrif_Types, only : Agrif_tabvars\n"); 421 279 } 422 280 } … …  424 282 void AddUseAgrifUtilBeforeCall_0(FILE *fileout) 425 283 { 426  listusemodule *parcours; 427   428  int out; 429   430  if ( firstpass == 0 ) 431  { 432  parcours = List_NameOfModuleUsed; 433  out = 0 ; 434  while ( parcours && out == 0 ) 435  { 436  if ( !strcasecmp(parcours->u_usemodule,"Agrif_Util") && 437  !strcasecmp(parcours->u_modulename,curmodulename) && 438  !strcasecmp(parcours->u_cursubroutine,subroutinename) 439  ) out = 1; 440  else parcours = parcours->suiv; 441  } 442  if ( out == 0 ) 443  { 444  if( strcasecmp(subroutinename,"Agrif_InitWorkspace") )  445  fprintf(fileout,"\n USE Agrif_Util \n"); 446  else fprintf(fileout,"\n USE Agrif_Types \n"); 447  } 448  }  284 listusemodule *parcours;  285   286 int out;  287   288 if ( firstpass == 0 )  289 {  290 parcours = List_NameOfModuleUsed;  291 out = 0 ;  292 while ( parcours && out == 0 )  293 {  294 if ( !strcasecmp(parcours->u_usemodule, "Agrif_Util") &&  295 !strcasecmp(parcours->u_modulename, curmodulename) &&  296 !strcasecmp(parcours->u_cursubroutine, subroutinename) )  297 out = 1;  298 else  299 parcours = parcours->suiv;  300 }  301 if ( out == 0 )  302 {  303 fprintf(fileout,"\n use Agrif_Util\n");  304 }  305 } 449 306 } 450 307  … …  458 315 /* */ 459 316 /******************************************************************************/ 460  void NotifyAgrifFunction_0(char *ident) 461  { 462  if ( firstpass == 0 ) 463  { 464  if ( !strcasecmp(ident,"Agrif_parent") ) 465  { 466  InAgrifParentDef = 1; 467  pos_curagrifparent = setposcur()-12; 468  } 469  else if ( !strcasecmp(ident,"Agrif_Get_Coarse_grid") ) 470  { 471  InAgrifParentDef = 2; 472  pos_curagrifparent = setposcur()-21; 473  } 474  else if ( !strcasecmp(ident,"Agrif_Rhox") ) 475  { 476  InAgrifParentDef = 3; 477  pos_curagrifparent = setposcur()-10; 478  } 479  else if ( !strcasecmp(ident,"Agrif_Parent_Rhox") ) 480  { 481  InAgrifParentDef = 4; 482  pos_curagrifparent = setposcur()-17; 483  } 484  else if ( !strcasecmp(ident,"Agrif_IRhox") ) 485  { 486  InAgrifParentDef = 5; 487  pos_curagrifparent = setposcur()-11; 488  } 489  else if ( !strcasecmp(ident,"Agrif_Parent_IRhox") ) 490  { 491  InAgrifParentDef = 6; 492  pos_curagrifparent = setposcur()-18; 493  } 494  else if ( !strcasecmp(ident,"Agrif_Rhoy") ) 495  { 496  InAgrifParentDef = 7; 497  pos_curagrifparent = setposcur()-10; 498  } 499  else if ( !strcasecmp(ident,"Agrif_Parent_Rhoy") ) 500  { 501  InAgrifParentDef = 8; 502  pos_curagrifparent = setposcur()-17; 503  } 504  else if ( !strcasecmp(ident,"Agrif_IRhoy") ) 505  { 506  InAgrifParentDef = 9; 507  pos_curagrifparent = setposcur()-11; 508  } 509  else if ( !strcasecmp(ident,"Agrif_Parent_IRhoy") ) 510  { 511  InAgrifParentDef = 10; 512  pos_curagrifparent = setposcur()-18; 513  } 514  else if ( !strcasecmp(ident,"Agrif_Rhoz") ) 515  { 516  InAgrifParentDef = 11; 517  pos_curagrifparent = setposcur()-10; 518  } 519  else if ( !strcasecmp(ident,"Agrif_Parent_Rhoz") ) 520  { 521  InAgrifParentDef = 12; 522  pos_curagrifparent = setposcur()-17; 523  } 524  else if ( !strcasecmp(ident,"Agrif_IRhoz") ) 525  { 526  InAgrifParentDef = 13; 527  pos_curagrifparent = setposcur()-11; 528  } 529  else if ( !strcasecmp(ident,"Agrif_Parent_IRhoz") ) 530  { 531  InAgrifParentDef = 14; 532  pos_curagrifparent = setposcur()-18; 533  } 534  else if ( !strcasecmp(ident,"Agrif_NearCommonBorderX") ) 535  { 536  InAgrifParentDef = 15; 537  pos_curagrifparent = setposcur()-23; 538  } 539  else if ( !strcasecmp(ident,"Agrif_NearCommonBorderY") ) 540  { 541  InAgrifParentDef = 16; 542  pos_curagrifparent = setposcur()-23; 543  } 544  else if ( !strcasecmp(ident,"Agrif_NearCommonBorderZ") ) 545  { 546  InAgrifParentDef = 17; 547  pos_curagrifparent = setposcur()-23; 548  } 549  else if ( !strcasecmp(ident,"Agrif_DistantCommonBorderX") ) 550  { 551  InAgrifParentDef = 18; 552  pos_curagrifparent = setposcur()-26; 553  } 554  else if ( !strcasecmp(ident,"Agrif_DistantCommonBorderY") ) 555  { 556  InAgrifParentDef = 19; 557  pos_curagrifparent = setposcur()-26; 558  } 559  else if ( !strcasecmp(ident,"Agrif_DistantCommonBorderZ") ) 560  { 561  InAgrifParentDef = 20; 562  pos_curagrifparent = setposcur()-26; 563  } 564  else if ( !strcasecmp(ident,"Agrif_Get_parent_id") ) 565  { 566  InAgrifParentDef = 21; 567  pos_curagrifparent = setposcur()-19; 568  } 569  else if ( !strcasecmp(ident,"Agrif_Get_grid_id") ) 570  { 571  InAgrifParentDef = 22; 572  pos_curagrifparent = setposcur()-17; 573  } 574  else if ( !strcasecmp(ident,"Agrif_Parent_Iz") ) 575  { 576  InAgrifParentDef = 23; 577  pos_curagrifparent = setposcur()-15; 578  } 579  else if ( !strcasecmp(ident,"Agrif_Parent_Iy") ) 580  { 581  InAgrifParentDef = 24; 582  pos_curagrifparent = setposcur()-15; 583  } 584  else if ( !strcasecmp(ident,"Agrif_Parent_Ix") ) 585  { 586  InAgrifParentDef = 25; 587  pos_curagrifparent = setposcur()-15; 588  } 589  else if ( !strcasecmp(ident,"Agrif_Iz") ) 590  { 591  InAgrifParentDef = 26; 592  pos_curagrifparent = setposcur()-8; 593  } 594  else if ( !strcasecmp(ident,"Agrif_Iy") ) 595  { 596  InAgrifParentDef = 27; 597  pos_curagrifparent = setposcur()-8; 598  } 599  else if ( !strcasecmp(ident,"Agrif_Ix") ) 600  { 601  InAgrifParentDef = 28; 602  pos_curagrifparent = setposcur()-8; 603  } 604  else if ( !strcasecmp(ident,"Agrif_Nb_Fixed_Grids") ) 605  { 606  InAgrifParentDef = 29; 607  pos_curagrifparent = setposcur()-20; 608  } 609  else if ( !strcasecmp(ident,"Agrif_Nb_Fine_Grids") ) 610  { 611  InAgrifParentDef = 29; 612  pos_curagrifparent = setposcur()-19; 613  } 614  else if ( !strcasecmp(ident,"AGRIF_Nb_Step") ) 615  { 616  InAgrifParentDef = 30; 617  pos_curagrifparent = setposcur()-13; 618  } 619  }  317 void NotifyAgrifFunction_0(const char *ident)  318 {  319 if ( firstpass == 1 ) return;  320   321 if ( !strcasecmp(ident,"Agrif_parent") )  322 {  323 InAgrifParentDef = 1;  324 pos_curagrifparent = setposcur()-12;  325 }  326 else if ( !strcasecmp(ident,"Agrif_Get_Coarse_grid") )  327 {  328 InAgrifParentDef = 2;  329 pos_curagrifparent = setposcur()-21;  330 }  331 else if ( !strcasecmp(ident,"Agrif_Rhox") )  332 {  333 InAgrifParentDef = 3;  334 pos_curagrifparent = setposcur()-10;  335 }  336 else if ( !strcasecmp(ident,"Agrif_Parent_Rhox") )  337 {  338 InAgrifParentDef = 4;  339 pos_curagrifparent = setposcur()-17;  340 }  341 else if ( !strcasecmp(ident,"Agrif_IRhox") )  342 {  343 InAgrifParentDef = 5;  344 pos_curagrifparent = setposcur()-11;  345 }  346 else if ( !strcasecmp(ident,"Agrif_Parent_IRhox") )  347 {  348 InAgrifParentDef = 6;  349 pos_curagrifparent = setposcur()-18;  350 }  351 else if ( !strcasecmp(ident,"Agrif_Rhoy") )  352 {  353 InAgrifParentDef = 7;  354 pos_curagrifparent = setposcur()-10;  355 }  356 else if ( !strcasecmp(ident,"Agrif_Parent_Rhoy") )  357 {  358 InAgrifParentDef = 8;  359 pos_curagrifparent = setposcur()-17;  360 }  361 else if ( !strcasecmp(ident,"Agrif_IRhoy") )  362 {  363 InAgrifParentDef = 9;  364 pos_curagrifparent = setposcur()-11;  365 }  366 else if ( !strcasecmp(ident,"Agrif_Parent_IRhoy") )  367 {  368 InAgrifParentDef = 10;  369 pos_curagrifparent = setposcur()-18;  370 }  371 else if ( !strcasecmp(ident,"Agrif_Rhoz") )  372 {  373 InAgrifParentDef = 11;  374 pos_curagrifparent = setposcur()-10;  375 }  376 else if ( !strcasecmp(ident,"Agrif_Parent_Rhoz") )  377 {  378 InAgrifParentDef = 12;  379 pos_curagrifparent = setposcur()-17;  380 }  381 else if ( !strcasecmp(ident,"Agrif_IRhoz") )  382 {  383 InAgrifParentDef = 13;  384 pos_curagrifparent = setposcur()-11;  385 }  386 else if ( !strcasecmp(ident,"Agrif_Parent_IRhoz") )  387 {  388 InAgrifParentDef = 14;  389 pos_curagrifparent = setposcur()-18;  390 }  391 else if ( !strcasecmp(ident,"Agrif_NearCommonBorderX") )  392 {  393 InAgrifParentDef = 15;  394 pos_curagrifparent = setposcur()-23;  395 }  396 else if ( !strcasecmp(ident,"Agrif_NearCommonBorderY") )  397 {  398 InAgrifParentDef = 16;  399 pos_curagrifparent = setposcur()-23;  400 }  401 else if ( !strcasecmp(ident,"Agrif_NearCommonBorderZ") )  402 {  403 InAgrifParentDef = 17;  404 pos_curagrifparent = setposcur()-23;  405 }  406 else if ( !strcasecmp(ident,"Agrif_DistantCommonBorderX") )  407 {  408 InAgrifParentDef = 18;  409 pos_curagrifparent = setposcur()-26;  410 }  411 else if ( !strcasecmp(ident,"Agrif_DistantCommonBorderY") )  412 {  413 InAgrifParentDef = 19;  414 pos_curagrifparent = setposcur()-26;  415 }  416 else if ( !strcasecmp(ident,"Agrif_DistantCommonBorderZ") )  417 {  418 InAgrifParentDef = 20;  419 pos_curagrifparent = setposcur()-26;  420 }  421 else if ( !strcasecmp(ident,"Agrif_Get_parent_id") )  422 {  423 InAgrifParentDef = 21;  424 pos_curagrifparent = setposcur()-19;  425 }  426 else if ( !strcasecmp(ident,"Agrif_Get_grid_id") )  427 {  428 InAgrifParentDef = 22;  429 pos_curagrifparent = setposcur()-17;  430 }  431 else if ( !strcasecmp(ident,"Agrif_Parent_Iz") )  432 {  433 InAgrifParentDef = 23;  434 pos_curagrifparent = setposcur()-15;  435 }  436 else if ( !strcasecmp(ident,"Agrif_Parent_Iy") )  437 {  438 InAgrifParentDef = 24;  439 pos_curagrifparent = setposcur()-15;  440 }  441 else if ( !strcasecmp(ident,"Agrif_Parent_Ix") )  442 {  443 InAgrifParentDef = 25;  444 pos_curagrifparent = setposcur()-15;  445 }  446 else if ( !strcasecmp(ident,"Agrif_Iz") )  447 {  448 InAgrifParentDef = 26;  449 pos_curagrifparent = setposcur()-8;  450 }  451 else if ( !strcasecmp(ident,"Agrif_Iy") )  452 {  453 InAgrifParentDef = 27;  454 pos_curagrifparent = setposcur()-8;  455 }  456 else if ( !strcasecmp(ident,"Agrif_Ix") )  457 {  458 InAgrifParentDef = 28;  459 pos_curagrifparent = setposcur()-8;  460 }  461 else if ( !strcasecmp(ident,"Agrif_Nb_Fixed_Grids") )  462 {  463 InAgrifParentDef = 29;  464 pos_curagrifparent = setposcur()-20;  465 }  466 else if ( !strcasecmp(ident,"Agrif_Nb_Fine_Grids") )  467 {  468 InAgrifParentDef = 29;  469 pos_curagrifparent = setposcur()-19;  470 }  471 else if ( !strcasecmp(ident,"AGRIF_Nb_Step") )  472 {  473 InAgrifParentDef = 30;  474 pos_curagrifparent = setposcur()-13;  475 } 620 476 } 621 477  … …  629 485 /* */ 630 486 /******************************************************************************/ 631  void ModifyTheAgrifFunction_0(c har *ident) 487 void ModifyTheAgrifFunction_0(const char *ident) 632 488 { 633 489 if ( InAgrifParentDef != 0 ) 634 490 AgriffunctionModify_0(ident,InAgrifParentDef); 635  /* */Â636 491 InAgrifParentDef = 0; 637 492 } … …  707 562 /* */ 708 563 /******************************************************************************/ 709  void AgriffunctionModify_0(char *ident,int whichone) 710  { 711  char toprint[LONG_C]; 712  if ( firstpass == 0 ) 713  { 714  strcpy(toprint,""); 715  pos_end = setposcur(); 716  fseek(fortranout,pos_curagrifparent,SEEK_SET); 717  if ( whichone == 1 || whichone == 2 ) 718  { 719  /* */ 720  FindAndChangeNameToTabvars(ident,toprint,List_Global_Var,1); 721  if ( !strcasecmp(ident,toprint) ) 722  { 723  /* la liste des use de cette subroutine */ 724  strcpy(toprint,""); 725  FindAndChangeNameToTabvars(ident, 726  toprint,List_Common_Var,whichone); 727  } 728  if ( !strcasecmp(ident,toprint) ) 729  { 730  /* la liste des use de cette subroutine */ 731  strcpy(toprint,""); 732  FindAndChangeNameToTabvars(ident, 733  toprint,List_ModuleUsed_Var,whichone); 734  } 735  } 736  else if ( whichone == 3 ) /* Agrif_Rhox */ 737  { 738  sprintf(toprint,"REAL("); 739  if( retour77 == 0 ) strcat(toprint," & \n"); 740  else strcat(toprint,"\n & "); 741  strcat(toprint,"Agrif_Curgrid % spaceref(1))"); 742  } 743  else if ( whichone == 4 ) /* Agrif_Parent_Rhox */ 744  { 745  sprintf(toprint,"REAL("); 746  if( retour77 == 0 ) strcat(toprint," & \n"); 747  else strcat(toprint,"\n & "); 748  strcat(toprint,"Agrif_Curgrid % parent % spaceref(1))"); 749  } 750  else if ( whichone == 5 ) /* Agrif_Rhox */ 751  { 752  sprintf(toprint,"Agrif_Curgrid"); 753  if( retour77 == 0 ) strcat(toprint," & \n"); 754  else strcat(toprint,"\n & "); 755  strcat(toprint,"% spaceref(1)"); 756  } 757  else if ( whichone == 6 ) /* Agrif_Parent_Rhox */ 758  { 759  sprintf(toprint,"Agrif_Curgrid"); 760  if( retour77 == 0 ) strcat(toprint," & \n"); 761  else strcat(toprint,"\n & "); 762  strcat(toprint,"% parent % spaceref(1)"); 763  } 764  else if ( whichone == 7 ) /* Agrif_Rhoy */ 765  { 766  sprintf(toprint,"REAL(Agrif_Curgrid"); 767  if( retour77 == 0 ) strcat(toprint," & \n"); 768  else strcat(toprint,"\n & "); 769  strcat(toprint,"% spaceref(2))"); 770  } 771  else if ( whichone == 8 ) /* Agrif_Parent_Rhoy */ 772  { 773  sprintf(toprint,"REAL(Agrif_Curgrid"); 774  if( retour77 == 0 ) strcat(toprint," & \n"); 775  else strcat(toprint,"\n & "); 776  strcat(toprint,"% parent % spaceref(2))"); 777  } 778  else if ( whichone == 9 ) /* Agrif_Rhoy */ 779  { 780  sprintf(toprint,"Agrif_Curgrid"); 781  if( retour77 == 0 ) strcat(toprint," & \n"); 782  else strcat(toprint,"\n & "); 783  strcat(toprint,"% spaceref(2)"); 784  } 785  else if ( whichone == 10 ) /* Agrif_Parent_Rhoy */ 786  { 787  sprintf(toprint,"Agrif_Curgrid"); 788  if( retour77 == 0 ) strcat(toprint," & \n"); 789  else strcat(toprint,"\n & "); 790  strcat(toprint,"% parent % spaceref(2)"); 791  } 792  else if ( whichone == 11 ) /* Agrif_Rhoz */ 793  { 794  sprintf(toprint,"REAL(Agrif_Curgrid"); 795  if( retour77 == 0 ) strcat(toprint," & \n"); 796  else strcat(toprint,"\n & "); 797  strcat(toprint,"% spaceref(3))"); 798  } 799  else if ( whichone == 12 ) /* Agrif_Parent_Rhoz */ 800  { 801  sprintf(toprint,"REAL(Agrif_Curgrid"); 802  if( retour77 == 0 ) strcat(toprint," & \n"); 803  else strcat(toprint,"\n & "); 804  strcat(toprint,"% parent % spaceref(3))"); 805  } 806  else if ( whichone == 13 ) /* Agrif_Rhoz */ 807  { 808  sprintf(toprint,"Agrif_Curgrid"); 809  if( retour77 == 0 ) strcat(toprint," & \n"); 810  else strcat(toprint,"\n & "); 811  strcat(toprint,"% spaceref(3)"); 812  } 813  else if ( whichone == 14 ) /* Agrif_Parent_Rhoz */ 814  { 815  sprintf(toprint,"Agrif_Curgrid"); 816  if( retour77 == 0 ) strcat(toprint," & \n"); 817  else strcat(toprint,"\n & "); 818  strcat(toprint,"% parent % spaceref(3)"); 819  } 820  else if ( whichone == 15 ) /* Agrif_NearCommonBorderX */ 821  { 822  sprintf(toprint,"Agrif_Curgrid"); 823  if( retour77 == 0 ) strcat(toprint," & \n"); 824  else strcat(toprint,"\n & "); 825  strcat(toprint,"% NearRootBorder(1)"); 826  } 827  else if ( whichone == 16 ) /* Agrif_NearCommonBorderY */ 828  { 829  sprintf(toprint,"Agrif_Curgrid"); 830  if( retour77 == 0 ) strcat(toprint," & \n"); 831  else strcat(toprint,"\n & "); 832  strcat(toprint,"% NearRootBorder(2)"); 833  } 834  else if ( whichone == 17 ) /* Agrif_NearCommonBorderZ */ 835  { 836  sprintf(toprint,"Agrif_Curgrid"); 837  if( retour77 == 0 ) strcat(toprint," & \n"); 838  else strcat(toprint,"\n & "); 839  strcat(toprint,"% NearRootBorder(3)"); 840  } 841  else if ( whichone == 18 ) /* Agrif_NearCommonBorderX */ 842  { 843  sprintf(toprint,"Agrif_Curgrid"); 844  if( retour77 == 0 ) strcat(toprint," & \n"); 845  else strcat(toprint,"\n & ");  564 void AgriffunctionModify_0(const char *ident,int whichone)  565 {  566 char toprint[LONG_M];  567 if ( firstpass == 0 )  568 {  569 strcpy(toprint,"");  570 pos_end = setposcur();  571 fseek(fortran_out,pos_curagrifparent,SEEK_SET);  572 if ( whichone == 1 || whichone == 2 )  573 {  574 FindAndChangeNameToTabvars(ident,toprint,List_Global_Var,1);  575 if ( !strcasecmp(ident,toprint) )  576 {  577 /* la liste des use de cette subroutine */  578 strcpy(toprint,"");  579 FindAndChangeNameToTabvars(ident,toprint,List_Common_Var,whichone);  580 }  581 if ( !strcasecmp(ident,toprint) )  582 {  583 /* la liste des use de cette subroutine */  584 strcpy(toprint,"");  585 FindAndChangeNameToTabvars(ident,toprint,List_ModuleUsed_Var,whichone);  586 }  587 }  588 else if ( whichone == 3 ) /* Agrif_Rhox */  589 {  590 sprintf(toprint,"REAL(");  591 if( retour77 == 0 ) strcat(toprint," & \n");  592 else strcat(toprint,"\n & ");  593 strcat(toprint,"Agrif_Curgrid % spaceref(1))");  594 }  595 else if ( whichone == 4 ) /* Agrif_Parent_Rhox */  596 {  597 sprintf(toprint,"REAL(");  598 if( retour77 == 0 ) strcat(toprint," & \n");  599 else strcat(toprint,"\n & ");  600 strcat(toprint,"Agrif_Curgrid % parent % spaceref(1))");  601 }  602 else if ( whichone == 5 ) /* Agrif_Rhox */  603 {  604 sprintf(toprint,"Agrif_Curgrid");  605 if( retour77 == 0 ) strcat(toprint," & \n");  606 else strcat(toprint,"\n & ");  607 strcat(toprint,"% spaceref(1)");  608 }  609 else if ( whichone == 6 ) /* Agrif_Parent_Rhox */  610 {  611 sprintf(toprint,"Agrif_Curgrid");  612 if( retour77 == 0 ) strcat(toprint," & \n");  613 else strcat(toprint,"\n & ");  614 strcat(toprint,"% parent % spaceref(1)");  615 }  616 else if ( whichone == 7 ) /* Agrif_Rhoy */  617 {  618 sprintf(toprint,"REAL(Agrif_Curgrid");  619 if( retour77 == 0 ) strcat(toprint," & \n");  620 else strcat(toprint,"\n & ");  621 strcat(toprint,"% spaceref(2))");  622 }  623 else if ( whichone == 8 ) /* Agrif_Parent_Rhoy */  624 {  625 sprintf(toprint,"REAL(Agrif_Curgrid");  626 if( retour77 == 0 ) strcat(toprint," & \n");  627 else strcat(toprint,"\n & ");  628 strcat(toprint,"% parent % spaceref(2))");  629 }  630 else if ( whichone == 9 ) /* Agrif_Rhoy */  631 {  632 sprintf(toprint,"Agrif_Curgrid");  633 if( retour77 == 0 ) strcat(toprint," & \n");  634 else strcat(toprint,"\n & ");  635 strcat(toprint,"% spaceref(2)");  636 }  637 else if ( whichone == 10 ) /* Agrif_Parent_Rhoy */  638 {  639 sprintf(toprint,"Agrif_Curgrid");  640 if( retour77 == 0 ) strcat(toprint," & \n");  641 else strcat(toprint,"\n & ");  642 strcat(toprint,"% parent % spaceref(2)");  643 }  644 else if ( whichone == 11 ) /* Agrif_Rhoz */  645 {  646 sprintf(toprint,"REAL(Agrif_Curgrid");  647 if( retour77 == 0 ) strcat(toprint," & \n");  648 else strcat(toprint,"\n & ");  649 strcat(toprint,"% spaceref(3))");  650 }  651 else if ( whichone == 12 ) /* Agrif_Parent_Rhoz */  652 {  653 sprintf(toprint,"REAL(Agrif_Curgrid");  654 if( retour77 == 0 ) strcat(toprint," & \n");  655 else strcat(toprint,"\n & ");  656 strcat(toprint,"% parent % spaceref(3))");  657 }  658 else if ( whichone == 13 ) /* Agrif_Rhoz */  659 {  660 sprintf(toprint,"Agrif_Curgrid");  661 if( retour77 == 0 ) strcat(toprint," & \n");  662 else strcat(toprint,"\n & ");  663 strcat(toprint,"% spaceref(3)");  664 }  665 else if ( whichone == 14 ) /* Agrif_Parent_Rhoz */  666 {  667 sprintf(toprint,"Agrif_Curgrid");  668 if( retour77 == 0 ) strcat(toprint," & \n");  669 else strcat(toprint,"\n & ");  670 strcat(toprint,"% parent % spaceref(3)");  671 }  672 else if ( whichone == 15 ) /* Agrif_NearCommonBorderX */  673 {  674 sprintf(toprint,"Agrif_Curgrid");  675 if( retour77 == 0 ) strcat(toprint," & \n");  676 else strcat(toprint,"\n & ");  677 strcat(toprint,"% NearRootBorder(1)");  678 }  679 else if ( whichone == 16 ) /* Agrif_NearCommonBorderY */  680 {  681 sprintf(toprint,"Agrif_Curgrid");  682 if( retour77 == 0 ) strcat(toprint," & \n");  683 else strcat(toprint,"\n & ");  684 strcat(toprint,"% NearRootBorder(2)");  685 }  686 else if ( whichone == 17 ) /* Agrif_NearCommonBorderZ */  687 {  688 sprintf(toprint,"Agrif_Curgrid");  689 if( retour77 == 0 ) strcat(toprint," & \n");  690 else strcat(toprint,"\n & ");  691 strcat(toprint,"% NearRootBorder(3)");  692 }  693 else if ( whichone == 18 ) /* Agrif_NearCommonBorderX */  694 {  695 sprintf(toprint,"Agrif_Curgrid");  696 if( retour77 == 0 ) strcat(toprint," & \n");  697 else strcat(toprint,"\n & "); 846 698 strcat(toprint,"% DistantRootBorder(1)"); 847  } 848  else if ( whichone == 19 ) /* Agrif_NearCommonBorderY */ 849  { 850  sprintf(toprint,"Agrif_Curgrid"); 851  if( retour77 == 0 ) strcat(toprint," & \n"); 852  else strcat(toprint,"\n & "); 853  strcat(toprint,"% DistantRootBorder(2)"); 854  } 855  else if ( whichone == 20 ) /* Agrif_NearCommonBorderZ */ 856  { 857  sprintf(toprint,"Agrif_Curgrid"); 858  if( retour77 == 0 ) strcat(toprint," & \n"); 859  else strcat(toprint,"\n & "); 860  strcat(toprint,"% DistantRootBorder(3)"); 861  } 862  else if ( whichone == 21 ) /* Agrif_Get_parent_id */ 863  { 864  sprintf(toprint,"Agrif_Curgrid"); 865  if( retour77 == 0 ) strcat(toprint," & \n"); 866  else strcat(toprint,"\n & "); 867  strcat(toprint,"% parent % grid_id"); 868  } 869  else if ( whichone == 22 ) /* Agrif_Get_grid_id */ 870  { 871  sprintf(toprint,"Agrif_Curgrid"); 872  if( retour77 == 0 ) strcat(toprint," & \n"); 873  else strcat(toprint,"\n & "); 874  strcat(toprint,"% grid_id"); 875  } 876  else if ( whichone == 23 ) /* Agrif_Parent_Iz */ 877  { 878  sprintf(toprint,"Agrif_Curgrid"); 879  if( retour77 == 0 ) strcat(toprint," & \n"); 880  else strcat(toprint,"\n & "); 881  strcat(toprint,"% parent % ix(3)"); 882  } 883  else if ( whichone == 24 ) /* Agrif_Parent_Iy */ 884  { 885  sprintf(toprint,"Agrif_Curgrid"); 886  if( retour77 == 0 ) strcat(toprint," & \n"); 887  else strcat(toprint,"\n & "); 888  strcat(toprint,"% parent % ix(2)"); 889  } 890  else if ( whichone == 25 ) /* Agrif_Parent_Ix */ 891  { 892  sprintf(toprint,"Agrif_Curgrid"); 893  if( retour77 == 0 ) strcat(toprint," & \n"); 894  else strcat(toprint,"\n & "); 895  strcat(toprint,"% parent % ix(1)"); 896  } 897  else if ( whichone == 26 ) /* Agrif_Iz */ 898  { 899  sprintf(toprint,"Agrif_Curgrid"); 900  if( retour77 == 0 ) strcat(toprint," & \n"); 901  else strcat(toprint,"\n & "); 902  strcat(toprint," % ix(3)"); 903  } 904  else if ( whichone == 27 ) /* Agrif_Iy */ 905  { 906  sprintf(toprint,"Agrif_Curgrid"); 907  if( retour77 == 0 ) strcat(toprint," & \n"); 908  else strcat(toprint,"\n & "); 909  strcat(toprint,"% ix(2)"); 910  } 911  else if ( whichone == 28 ) /* Agrif_Ix */ 912  { 913  sprintf(toprint,"Agrif_Curgrid"); 914  if( retour77 == 0 ) strcat(toprint," & \n"); 915  else strcat(toprint,"\n & "); 916  strcat(toprint,"% ix(1)"); 917  } 918  else if ( whichone == 29 ) /* Agrif_Nb_Fixed_Grids */ 919  { 920  sprintf(toprint,"Agrif_nbfixedgrids"); 921  } 922  else if ( whichone == 30 ) /* AGRIF_Nb_Step */ 923  { 924  sprintf(toprint,"Agrif_Curgrid"); 925  if( retour77 == 0 ) strcat(toprint," & \n"); 926  else strcat(toprint,"\n & "); 927  strcat(toprint,"% ngridstep"); 928  } 929  /* */ 930  if ( whichone == 1 || whichone == 2 ) 931  { 932  Save_Length(toprint,43); 933  tofich(fortranout,toprint,2); 934  } 935  else 936  { 937  /* if( retour77 == 0 ) fprintf(fortranout," & \n"); 938  else fprintf(fortranout,"\n & ");*/ 939  Save_Length(toprint,43); 940  fprintf(fortranout,"%s",toprint); 941  } 942  } 943  } 944    699 }  700 else if ( whichone == 19 ) /* Agrif_NearCommonBorderY */  701 {  702 sprintf(toprint,"Agrif_Curgrid");  703 if( retour77 == 0 ) strcat(toprint," & \n");  704 else strcat(toprint,"\n & ");  705 strcat(toprint,"% DistantRootBorder(2)");  706 }  707 else if ( whichone == 20 ) /* Agrif_NearCommonBorderZ */  708 {  709 sprintf(toprint,"Agrif_Curgrid");  710 if( retour77 == 0 ) strcat(toprint," & \n");  711 else strcat(toprint,"\n & ");  712 strcat(toprint,"% DistantRootBorder(3)");  713 }  714 else if ( whichone == 21 ) /* Agrif_Get_parent_id */  715 {  716 sprintf(toprint,"Agrif_Curgrid");  717 if( retour77 == 0 ) strcat(toprint," & \n");  718 else strcat(toprint,"\n & ");  719 strcat(toprint,"% parent % grid_id");  720 }  721 else if ( whichone == 22 ) /* Agrif_Get_grid_id */  722 {  723 sprintf(toprint,"Agrif_Curgrid");  724 if( retour77 == 0 ) strcat(toprint," & \n");  725 else strcat(toprint,"\n & ");  726 strcat(toprint,"% grid_id");  727 }  728 else if ( whichone == 23 ) /* Agrif_Parent_Iz */  729 {  730 sprintf(toprint,"Agrif_Curgrid");  731 if( retour77 == 0 ) strcat(toprint," & \n");  732 else strcat(toprint,"\n & ");  733 strcat(toprint,"% parent % ix(3)");  734 }  735 else if ( whichone == 24 ) /* Agrif_Parent_Iy */  736 {  737 sprintf(toprint,"Agrif_Curgrid");  738 if( retour77 == 0 ) strcat(toprint," & \n");  739 else strcat(toprint,"\n & ");  740 strcat(toprint,"% parent % ix(2)");  741 }  742 else if ( whichone == 25 ) /* Agrif_Parent_Ix */  743 {  744 sprintf(toprint,"Agrif_Curgrid");  745 if( retour77 == 0 ) strcat(toprint," & \n");  746 else strcat(toprint,"\n & ");  747 strcat(toprint,"% parent % ix(1)");  748 }  749 else if ( whichone == 26 ) /* Agrif_Iz */  750 {  751 sprintf(toprint,"Agrif_Curgrid");  752 if( retour77 == 0 ) strcat(toprint," & \n");  753 else strcat(toprint,"\n & ");  754 strcat(toprint," % ix(3)");  755 }  756 else if ( whichone == 27 ) /* Agrif_Iy */  757 {  758 sprintf(toprint,"Agrif_Curgrid");  759 if( retour77 == 0 ) strcat(toprint," & \n");  760 else strcat(toprint,"\n & ");  761 strcat(toprint,"% ix(2)");  762 }  763 else if ( whichone == 28 ) /* Agrif_Ix */  764 {  765 sprintf(toprint,"Agrif_Curgrid");  766 if( retour77 == 0 ) strcat(toprint," & \n");  767 else strcat(toprint,"\n & ");  768 strcat(toprint,"% ix(1)");  769 }  770 else if ( whichone == 29 ) /* Agrif_Nb_Fixed_Grids */  771 {  772 sprintf(toprint,"Agrif_nbfixedgrids");  773 }  774 else if ( whichone == 30 ) /* AGRIF_Nb_Step */  775 {  776 sprintf(toprint,"Agrif_Curgrid");  777 if( retour77 == 0 ) strcat(toprint," & \n");  778 else strcat(toprint,"\n & ");  779 strcat(toprint,"% ngridstep");  780 }  781   782 Save_Length(toprint,43);  783   784 if ( whichone == 1 || whichone == 2 ) tofich(fortran_out,toprint,0);  785 else fprintf(fortran_out,"%s",toprint);  786 }  787 } 945 788  946 789 /******************************************************************************/ … …  953 796 /* */ 954 797 /******************************************************************************/ 955  void Instanciation_0(char *ident) 956  { 957  listvar *newvar; 958  int out; 959   960  if ( firstpass == 0 && sameagrifargument == 1 ) 961  { 962  newvar = List_Global_Var; 963   964  out=0; 965  while ( newvar && out == 0 ) 966  { 967  if ( !strcasecmp(newvar->var->v_nomvar,ident) ) out = 1; 968  else newvar=newvar->suiv; 969  } 970   971  if ( out == 0 ) 972  { 973  newvar = List_Common_Var; 974   975  out=0; 976  while ( newvar && out == 0 ) 977  {  798 void Instanciation_0(const char *ident)  799 {  800 listvar *newvar;  801 int out;  802   803 if ( firstpass == 0 && sameagrifargument == 1 )  804 {  805 newvar = List_Global_Var;  806 out = 0;  807 while ( newvar && out == 0 )  808 { 978 809 if ( !strcasecmp(newvar->var->v_nomvar,ident) ) out = 1; 979  else newvar=newvar->suiv; 980  } 981  } 982  if ( out == 0 ) 983  { 984  newvar = List_ModuleUsed_Var; 985   986  out=0; 987  while ( newvar && out == 0 ) 988  { 989  if ( !strcasecmp(newvar->var->v_nomvar,ident) ) out = 1; 990  else newvar=newvar->suiv; 991  } 992  } 993   994  if ( out == 1 ) 995  { 996  /* then write the instanciation */ 997  fprintf(fortranout,"\n %s = %s",ident, 998  vargridcurgridtabvars(newvar->var,3)); 999  colnum = 0; 1000  } 1001  } 1002  sameagrifargument = 0; 1003  }  810 else newvar = newvar->suiv;  811 }  812 if ( out == 0 )  813 {  814 newvar = List_Common_Var;  815 while ( newvar && out == 0 )  816 {  817 if ( !strcasecmp(newvar->var->v_nomvar,ident) ) out = 1;  818 else newvar = newvar->suiv;  819 }  820 }  821 if ( out == 0 )  822 {  823 newvar = List_ModuleUsed_Var;  824 while ( newvar && out == 0 )  825 {  826 if ( !strcasecmp(newvar->var->v_nomvar,ident) ) out = 1;  827 else newvar = newvar->suiv;  828 }  829 }  830 // if ( out == 1 )  831 // {  832 // /* then write the instanciation */  833 // fprintf(fortran_out,"\n %s = %s",ident,vargridcurgridtabvars(newvar->var,3));  834 // printf("#\n# Instanciation_0: |%s = %s|\n#\n", ident,vargridcurgridtabvars(newvar->var,3));  835 // }  836 }  837 sameagrifargument = 0;  838 } -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/EXTERNAL/AGRIF/LIB/UtilCharacter.c
r5781 r6237  46 46 /* */ 47 47 /******************************************************************************/ 48  /* if whichone = 0 ----> Agrif_tabvars(i) % var % array2*/Â49  /* */ Â50  /* if whichone = 1 ----> Agrif_tabvars(i) % parentvar % var % array2*/Â51  /* */ Â52  /******************************************************************************/ Â53  void FindAndChangeNameToTabvars(c har name[LONG_C],char toprint[LONG_4C], 48 /* if whichone = 0 ----> Agrif_tabvars(i) % array2 */  49 /* */  50 /* if whichone = 1 ----> Agrif_tabvars(i) % parentvar % array2 */  51 /* */  52 /******************************************************************************/  53 void FindAndChangeNameToTabvars(const char name[LONG_M],char toprint[LONG_M], 54 54 listvar * listtosee, int whichone) 55 55 { … …  71 71 { 72 72 out = 1; 73  strcat(toprint,vargridcurgridtabvars(newvar->var, whichone)); 73 strcat(toprint,vargridcurgridtabvars(newvar->var, whichone)); 74 74 } 75 75 else newvar=newvar->suiv; … …  92 92 /* */ 93 93 /******************************************************************************/ 94  char *ChangeTheInitalvaluebyTabvarsName(char *nom,listvar *listtoread, 95  int whichone) 96  { 97  char toprinttmp[LONG_4C]; 98  int i; 99  char chartmp[2]; 100   101  i=0; 102  strcpy(toprintglob,""); 103  strcpy(toprinttmp,""); 104   105  /* */ 106  while ( i < strlen(nom) ) 107  { 108  if ( nom[i] == '+' ) 109  { 110  FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,whichone); 111  strcpy(toprinttmp,""); 112  strcat(toprintglob,"+"); 113  } 114  else if ( nom[i] == '-' ) 115  { 116  FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,whichone); 117  strcpy(toprinttmp,""); 118  strcat(toprintglob,"-"); 119  } 120  else if ( nom[i] == '*' ) 121  { 122  FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,whichone); 123  strcpy(toprinttmp,""); 124  strcat(toprintglob,"*"); 125  } 126  else if ( nom[i] == '/' ) 127  { 128  FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,whichone); 129  strcpy(toprinttmp,""); 130  strcat(toprintglob,"/"); 131  } 132  else if ( nom[i] == '(' ) 133  { 134  FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,whichone); 135  strcpy(toprinttmp,""); 136  strcat(toprintglob,"("); 137  } 138  else if ( nom[i] == ')' ) 139  { 140  FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,whichone); 141  strcpy(toprinttmp,""); 142  strcat(toprintglob,")"); 143  } 144  else if ( nom[i] == ':' ) 145  { 146  FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,whichone); 147  strcpy(toprinttmp,""); 148  strcat(toprintglob,":"); 149  } 150  else if ( nom[i] == ',' ) 151  { 152  FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,whichone); 153  strcpy(toprinttmp,""); 154  strcat(toprintglob,","); 155  } 156  else 157  { 158  sprintf(chartmp,"%c",nom[i]); 159  strcat(toprinttmp,chartmp); 160  } 161  /* */ 162  i=i+1; 163  } 164  FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,whichone); 165  strcpy(toprinttmp,""); 166   167  Save_Length(toprinttmp,44); 168  Save_Length(toprintglob,39); 169   170  /* */ 171  return toprintglob;  94 const char *ChangeTheInitalvaluebyTabvarsName(const char *nom, listvar *listtoread)  95 {  96 char toprinttmp[LONG_M];  97 char chartmp[2];  98 size_t i = 0;  99   100 strcpy(toprintglob, "");  101 strcpy(toprinttmp, "");  102   103 while ( i < strlen(nom) )  104 {  105 if ( (nom[i] == '+') || (nom[i] == '-') || (nom[i] == '*') || (nom[i] == '/') ||  106 (nom[i] == '(') || (nom[i] == ')') || (nom[i] == ':') || (nom[i] == ',') )  107 {  108 FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,0);  109 strcpy(toprinttmp, "");  110 sprintf(chartmp, "%c", nom[i]);  111 strcat(toprintglob, chartmp);  112 }  113 else  114 {  115 sprintf(chartmp, "%c", nom[i]);  116 strcat(toprinttmp, chartmp);  117 }  118 i += 1;  119 }  120 FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,0);  121 strcpy(toprinttmp,"");  122   123 Save_Length(toprinttmp,44);  124 Save_Length(toprintglob,39);  125   126 return toprintglob; 172 127 } 173 128  … …  181 136 /* */ 182 137 /******************************************************************************/ 183  int IsVariableReal(char *nom) 184  { 185  int Real; 186   187  Real = 0; 188  if ( ( nom[0] >= 'a' && nom[0] <= 'h' ) ||  138 int IsVariableReal(const char *nom)  139 {  140 return ( ( nom[0] >= 'a' && nom[0] <= 'h' ) || 189 141 ( nom[0] >= 'A' && nom[0] <= 'H' ) || 190 142 ( nom[0] >= 'o' && nom[0] <= 'z' ) || 191  ( nom[0] >= 'O' && nom[0] <= 'Z' ) 192  ) 193  { 194  Real = 1; 195  } 196  /* */ 197  return Real;  143 ( nom[0] >= 'O' && nom[0] <= 'Z' ) ); 198 144 } 199 145 /******************************************************************************/ … …  206 152 /* */ 207 153 /******************************************************************************/ 208  void IsVarInUseFile(c har *nom) 154 void IsVarInUseFile(const char *nom) 209 155 { 210 156 listvar *parcours; … …  217 163 while( parcours && out == 0 ) 218 164 { 219  if ( !strcasecmp(nom,parcours->var->v_nomvar) ) out = 1 ; 165 if ( !strcasecmp(nom,parcours->var->v_nomvar) ) out = 1 ; 220 166 else parcours=parcours->suiv; 221 167 } … …  225 171 while( parcours && out == 0 ) 226 172 {  173 if ( !strcasecmp(nom,parcours->var->v_nomvar) ) out = 1 ;  174 else parcours=parcours->suiv;  175 }  176 }  177 if ( out == 0 )  178 {  179 parcours = List_GlobalParameter_Var;  180 while( parcours && out == 0 )  181 { 227 182 if ( !strcasecmp(nom,parcours->var->v_nomvar) ) out =1 ; 228 183 else parcours=parcours->suiv; … …  231 186 if ( out == 0 ) 232 187 { 233  parcours = List_GlobalParameter_Var;Â234  while( parcours && out == 0 )Â235  {Â236  if ( !strcasecmp(nom,parcours->var->v_nomvar) ) out =1 ;Â237  else parcours=parcours->suiv;Â238  }Â239  }Â240  if ( out == 0 )Â241  {Â242 188 parcours = List_Parameter_Var; 243 189 while( parcours && out == 0 ) 244 190 { 245  if ( !strcasecmp(nom,parcours->var->v_nomvar) ) out = 1 ; 191 if ( !strcasecmp(nom,parcours->var->v_nomvar) ) out = 1 ; 246 192 else parcours=parcours->suiv; 247 193 } … …  252 198 while( parcoursparam && out == 0 ) 253 199 { 254  if ( !strcasecmp(nom,parcoursparam->p_name) ) out = 2 ; 200 if ( !strcasecmp(nom,parcoursparam->p_name) ) out = 2 ; 255 201 else parcoursparam=parcoursparam->suiv; 256 202 } … …  261 207 while( parcours && out == 0 ) 262 208 { 263  if ( !strcasecmp(nom,parcours->var->v_nomvar) ) out = 2 ; 209 if ( !strcasecmp(nom,parcours->var->v_nomvar) ) out = 2 ; 264 210 else parcours=parcours->suiv; 265 211 } … …  270 216 while( parcoursparam && out != 1 ) 271 217 { 272  if ( !strcasecmp(nom,parcoursparam->p_name) ) out = 1 ; 218 if ( !strcasecmp(nom,parcoursparam->p_name) ) out = 1 ; 273 219 else parcoursparam=parcoursparam->suiv; 274 220 } … …  299 245 /* */ 300 246 /******************************************************************************/ 301  listnom *DecomposeTheNameinlistnom(char *nom, listnom * listout) 302  { 303  char toprinttmp[LONG_4C]; 304  int i;  247 listnom *DecomposeTheNameinlistnom(const char *nom, listnom * listout)  248 {  249 char toprinttmp[LONG_M]; 305 250 char chartmp[2]; 306   307  i=0;  251 size_t i = 0;  252  308 253 strcpy(toprinttmp,""); 309  /* */  254  310 255 while ( i < strlen(nom) ) 311 256 { … …  320 265 ) 321 266 { 322  Â323 267 if (strcasecmp(toprinttmp,"") && ( toprinttmp[0] >= 'A' ) ) 324 268 { … …  331 275 sprintf(chartmp,"%c",nom[i]); 332 276 strcat(toprinttmp,chartmp); 333   334  } 335  /* */  277 } 336 278 i=i+1; 337 279 } … …  340 282 listout = Addtolistnom(toprinttmp,listout,0); 341 283 }  284 Save_Length(toprinttmp,44); 342 285 strcpy(toprinttmp,""); 343  Save_Length(toprinttmp,44);Â344 286  345 287 return listout; … …  356 298 /* */ 357 299 /******************************************************************************/ 358  void DecomposeTheName(char *nom) 359  { 360  char toprinttmp[LONG_4C]; 361  int i;  300 void DecomposeTheName(const char *nom)  301 {  302 char toprinttmp[LONG_M]; 362 303 char chartmp[2]; 363   364  i=0; 304 size_t i = 0;  305  365 306 strcpy(toprinttmp,""); 366  /* */  307  367 308 while ( i < strlen(nom) ) 368 309 { … …  390 331 strcat(toprinttmp,chartmp); 391 332 } 392  /* */Â393 333 i=i+1; 394 334 } 395  Save_Length(toprinttmp,44);Â396 335 if (strcasecmp(toprinttmp,"") && ( toprinttmp[0] >= 'A' ) ) 397 336 { … …  400 339 IsVarInUseFile(toprinttmp); 401 340 }  341 Save_Length(toprinttmp,44); 402 342 strcpy(toprinttmp,""); 403 343  404 344 } 405 345  406  void convert2lower(char * name)Â407  { Â408  int l;Â409  int i; 410  int caractere;Â411   412  l=strlen(name)-1; 413  for (i=0;i<=l;i++)Â414  {Â415  caractere=name[i];Â416  if ((caractere>=65 && caractere<=90)||(caractere>=192 && caractere<=221))Â417  {Â418  name[i]+=32;Â419  }Â420  }Â421  } Â422   423  int convert2int(c har *name) 346 void convert2lower(char *lowername, const char* inputname)  347 {  348 int i, l, caractere;  349   350 strcpy(lowername, inputname);  351 l = strlen(lowername)-1;  352   353 for ( i=0 ; i<=l ; i++)  354 {  355 caractere = lowername[i];  356 if ( (caractere>=65 && caractere<=90) || (caractere>=192 && caractere<=221) )  357 {  358 lowername[i] += 32;  359 }  360 }  361 }  362   363 int convert2int(const char *name) 424 364 { 425 365 int i; -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/EXTERNAL/AGRIF/LIB/UtilFile.c
r5781 r6237  40 40  41 41 /******************************************************************************/ 42  /* associate*/ 42 /* open_for_write */ 43 43 /******************************************************************************/ 44 44 /* This subroutine is used to open a file */ 45 45 /******************************************************************************/ 46  FILE * associate (char *filename) 46 FILE* open_for_write (const char *filename) 47 47 { 48  char filefich[LONG_C];Â49  sprintf(filefich,"%s/%s",nomdir,filename);Â50  return fopen(filefich, "w"); 48 char filefich[LONG_FNAME];  49 sprintf(filefich,"%s/%s",include_dir,filename);  50 return fopen(filefich, "w"); 51 51 } 52 52  53  Â54 53 /******************************************************************************/ 55  /* associateaplus*/ 54 /* open_for_append */ 56 55 /******************************************************************************/ 57 56 /* This subroutine is used to open a file with option a+ */ 58 57 /******************************************************************************/ 59  FILE * associateaplus (char *filename) 58 FILE* open_for_append (const char *filename) 60 59 { 61  char filefich[LONG_C];Â62  sprintf(filefich,"%s/%s",nomdir,filename);Â63  return fopen(filefich, "a+"); 60 char filefich[LONG_M];  61 sprintf(filefich,"%s/%s",include_dir,filename);  62 return fopen(filefich, "a+"); 64 63 } 65 64  66  Â67 65 /******************************************************************************/ 68  /* setposcurname  66 /* setposcurname */ 69 67 /******************************************************************************/ 70 68 /* This subroutine is used to know the current position in the file in argument */ … …  76 74 long int setposcurname(FILE *fileout) 77 75 { 78  fflush(fileout);Â79  return ftell(fileout); 76 fflush(fileout);  77 return ftell(fileout); 80 78 } 81 79  … …  91 89 long int setposcur() 92 90 { 93  fflush(fortranout); 94  return ftell(fortranout); 95  } 96   97  /******************************************************************************/ 98  /* setposcurinoldfortranout */ 99  /******************************************************************************/ 100  /* This subroutine is used to know the position in the oldfortranout */ 101  /******************************************************************************/ 102  /* */ 103  /* setposcurinoldfortranout ---------> position in file */ 104  /* */ 105  /******************************************************************************/ 106  long int setposcurinoldfortranout() 107  { 108  fflush(oldfortranout); 109  return ftell(oldfortranout);  91 return setposcurname(fortran_out); 110 92 } 111 93  … …  114 96 /******************************************************************************/ 115 97 /* Firstpass 0 */ 116  /* We should write in the fortran out the USE tok_name */ 98 /* We should write in the fortran_out the USE tok_name */ 117 99 /* read in the original file */ 118 100 /******************************************************************************/ 119 101 /* */ 120 102 /******************************************************************************/ 121  void copyuse_0(c har *namemodule) 103 void copyuse_0(const char *namemodule) 122 104 { 123  if (firstpass == 0 &&IsTabvarsUseInArgument_0() == 1 )Â124  {Â125  /* We should write this declaration into the original subroutine too */Â126  fprintf(oldfortranout," USE %s \n",namemodule);Â127  } 105 if ( IsTabvarsUseInArgument_0() == 1 )  106 {  107 /* We should write this declaration into the original subroutine too */  108 fprintf(oldfortran_out," use %s\n", namemodule);  109 } 128 110 } 129 111  … …  132 114 /******************************************************************************/ 133 115 /* Firstpass 0 */ 134  /* We should write in the fortran out the USE tok_name, only */ 116 /* We should write in the fortran_out the USE tok_name, only */ 135 117 /* read in the original file */ 136 118 /******************************************************************************/ 137 119 /* */ 138 120 /******************************************************************************/ 139  void copyuseonly_0(c har *namemodule) 121 void copyuseonly_0(const char *namemodule) 140 122 { 141 123 if (firstpass == 0 && IsTabvarsUseInArgument_0() == 1 ) 142 124 { 143 125 /* We should write this declaration into the original subroutine too */ 144  fprintf(oldfortran out," USE %s , ONLY : \n",namemodule); 126 fprintf(oldfortran_out," use %s , only : \n", namemodule); 145 127 } 146 128 } -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/EXTERNAL/AGRIF/LIB/UtilFortran.c
r5781 r6237  43 43 /* This subroutine is used to initialized grid dimension variable */ 44 44 /******************************************************************************/ 45  /* */ 46  /* */ 47  /* */ 48  /******************************************************************************/ 49  void initdimprob(int dimprobmod, char * nx, char * ny,char* nz) 50  { 51  dimprob = dimprobmod; 52   53  strcpy(nbmaillesX,nx); 54  strcpy(nbmaillesY,ny); 55  strcpy(nbmaillesZ,nz); 56  } 57   58  /******************************************************************************/ 59  /* Variableshouldberemove */  45 void initdimprob(int dimprobmod, const char * nx, const char * ny, const char* nz)  46 {  47 dimprob = dimprobmod;  48   49 strcpy(nbmaillesX, nx);  50 strcpy(nbmaillesY, ny);  51 strcpy(nbmaillesZ, nz);  52 }  53   54 /******************************************************************************/  55 /* Variableshouldberemoved */ 60 56 /******************************************************************************/ 61 57 /* Firstpass 0 */ … …  65 61 /* */ 66 62 /******************************************************************************/ 67  int Variableshouldberemove(char *nom) 68  { 69   70  int remove; 71   72  remove = 0 ; 73   74  if ( remove == 0 && Agrif_in_Tok_NAME(nom) == 1 ) remove = 1 ; 75   76  return remove;  63 int Variableshouldberemoved(const char *nom)  64 {  65 return Agrif_in_Tok_NAME(nom); 77 66 } 78 67  … …  97 86 /* Now we should give the definition of the variable in the */ 98 87 /* table List_UsedInSubroutine_Var */ 99  printf("QDKFLSDFKSLDF\n"); 100  strcpy(curvar->var->v_typevar,newvar->var->v_typevar); 101  strcpy(curvar->var->v_dimchar,newvar->var->v_dimchar); 102  curvar->var->v_nbdim = newvar->var->v_nbdim;  88 strcpy(curvar->var->v_typevar, newvar->var->v_typevar);  89 strcpy(curvar->var->v_dimchar, newvar->var->v_dimchar);  90 curvar->var->v_nbdim = newvar->var->v_nbdim; 103 91 curvar->var->v_dimensiongiven = newvar->var->v_dimensiongiven; 104  curvar->var->v_allocatable = newvar->var->v_allocatable; 105  curvar->var->v_target = newvar->var->v_target;  92 curvar->var->v_allocatable = newvar->var->v_allocatable;  93 curvar->var->v_target = newvar->var->v_target;  94 curvar->var->v_catvar = newvar->var->v_catvar; 106 95 curvar->var->v_pointerdeclare = newvar->var->v_pointerdeclare; 107  curvar->var->v_indicetabvars = newvar->var->v_indicetabvars; 108  strcpy(curvar->var->v_nameinttypename,newvar->var->v_nameinttypename); 109  strcpy(curvar->var->v_precision,newvar->var->v_precision); 110  strcpy(curvar->var->v_readedlistdimension, 111  newvar->var->v_readedlistdimension); 112  strcpy(curvar->var->v_commoninfile,newvar->var->v_commoninfile);  96 curvar->var->v_indicetabvars = newvar->var->v_indicetabvars;  97 strcpy(curvar->var->v_nameinttypename, newvar->var->v_nameinttypename);  98 strcpy(curvar->var->v_precision, newvar->var->v_precision);  99 strcpy(curvar->var->v_readedlistdimension, newvar->var->v_readedlistdimension);  100 strcpy(curvar->var->v_commoninfile, newvar->var->v_commoninfile); 113 101 } 114 102 else … …  128 116 present = 0; 129 117 newvar = listin;  118  130 119 while ( newvar && present == 0 ) 131 120 { 132 121 if ( !strcasecmp(newvar->var->v_nomvar,curvar->var->v_nomvar) && 133  !strcasecmp(newvar->var->v_subroutinename, 134  curvar->var->v_subroutinename) 135  )  122 !strcasecmp(newvar->var->v_subroutinename, curvar->var->v_subroutinename) ) 136 123 { 137 124 strcpy(curvar->var->v_commoninfile,newvar->var->v_commoninfile); 138  CopyRecord(curvar->var,newvar->var); 125 Merge_Variables(curvar->var,newvar->var); 139 126 present = 1; 140 127 } … …  156 143 if ( !strcasecmp(newvar->var->v_nomvar,curvar->var->v_nomvar) ) 157 144 { 158  CopyRecord(curvar->var,newvar->var); 145 Merge_Variables(curvar->var,newvar->var); 159 146 present = 1; 160 147 } … …  170 157 /* This subroutine is to know if a variable is global */ 171 158 /******************************************************************************/ 172  void variableisglobalinmodule(listcouple *listin, c har *module, FILE *fileout, long int oldposcuruse) 159 void variableisglobalinmodule(listcouple *listin, const char *module, FILE *fileout, long int oldposcuruse) 173 160 { 174 161 int Globalite; … …  178 165 listvar *newvar2; 179 166 int out; 180  char truename[LONG_ C]; 167 char truename[LONG_VNAME]; 181 168  182 169 Globalite = 1; … …  195 182 strcpy(truename,newvar->c_namepointedvar); 196 183 } 197    184  198 185 out = 0; 199 186 newvar2 = tempo; … …  227 214 { 228 215 pos_end = setposcurname(fileout); 229  RemoveWordSET_0(fileout,oldposcuruse, 230  pos_end-oldposcuruse); 231    216 RemoveWordSET_0(fileout,oldposcuruse,pos_end-oldposcuruse);  217  232 218 newvar = listin; 233 219 while ( newvar ) 234 220 { 235  fprintf(fileout," USE %s, ONLY: %s \n",module,newvar->c_namevar); 221 fprintf(fileout," use %s, only : %s \n",module,newvar->c_namevar); 236 222 newvar = newvar->suiv; 237 223 } … …  239 225 } 240 226  241  Â242  void Remove_Word_Contains_0()Â243  {Â244  if ( firstpass == 0 )Â245  {Â246  RemoveWordCUR_0(fortranout,(long)(-9),9);Â247  }Â248  }Â249  Â250  void Remove_Word_end_module_0(int modulenamelength)Â251  {Â252  if ( firstpass == 0 )Â253  {Â254  RemoveWordCUR_0(fortranout,(long)(-modulenamelength-12),Â255  modulenamelength+11);Â256  }Â257  }Â258  Â259  void Write_Word_Contains_0()Â260  {Â261  if ( firstpass == 0 )Â262  {Â263  fprintf(fortranout,"\n contains\n");Â264  }Â265  }Â266  Â267  Â268 227 void Write_Word_end_module_0() 269 228 { 270  if ( firstpass == 0 )Â271  {Â272  fprintf(fortranout,"\n end module %s",curmodulename);Â273  }Â274  } Â275   276  void Add_Subroutine_For_Alloc(c har *nom) 229 if ( firstpass == 0 )  230 {  231 fprintf(fortran_out,"\n end module %s",curmodulename);  232 }  233 }  234   235 void Add_Subroutine_For_Alloc(const char *nom) 277 236 { 278 237 listnom *parcours; … …  280 239 int out; 281 240  282  newvar = (listnom *)malloc(sizeof(listnom)); 241 newvar = (listnom*) calloc(1, sizeof(listnom)); 283 242 strcpy(newvar->o_nom,nom); 284  Save_Length(nom,23);Â285 243 newvar->suiv = NULL; 286 244  … …  306 264 } 307 265  308   309  void Write_Alloc_Subroutine_0() 310  { 311  listnom *parcours_nom; 312  listnom *parcours_nomprec; 313  int out; 314  char ligne[LONG_C]; 315   316  if ( firstpass == 0 ) 317  { 318  parcours_nomprec = (listnom *)NULL; 319  parcours_nom = List_NameOfModule; 320  out = 0 ; 321  while ( parcours_nom && out == 0 ) 322  { 323  /* */ 324  if ( !strcasecmp(curmodulename,parcours_nom->o_nom) ) out = 1; 325  else parcours_nom = parcours_nom -> suiv; 326  } 327  if ( out == 1 ) 328  { 329  if ( parcours_nom->o_val == 1 ) 330  { 331  strcpy (ligne, "\n PUBLIC Alloc_agrif_"); 332  strcat (ligne, curmodulename); 333  strcat (ligne, "\n"); 334  convert2lower(ligne); 335  fprintf(fortranout,ligne); 336  } 337  } 338  Write_Word_Contains_0(); 339  if ( out == 1 ) 340  { 341  if ( parcours_nom->o_val == 1 ) 342  { 343  sprintf (ligne, "Subroutine Alloc_agrif_%s(Agrif_Gr)", 344  curmodulename); 345  tofich(fortranout,ligne,1); 346  strcpy(ligne,"Use Agrif_Util"); 347  tofich(fortranout,ligne,1); 348  strcpy (ligne, "Type(Agrif_grid), Pointer :: Agrif_Gr"); 349  tofich(fortranout,ligne,1); 350  strcpy(ligne, "INTEGER :: i"); 351  tofich (fortranout, ligne,1); 352  strcpy (ligne, "\n#include \"alloc_agrif_"); 353  strcat (ligne, curmodulename); 354  strcat (ligne, ".h\"\n"); 355  convert2lower(ligne); 356  fprintf(fortranout,ligne); 357  strcpy (ligne, "Return"); 358  tofich(fortranout,ligne,1); 359  sprintf (ligne, "End Subroutine Alloc_agrif_%s",curmodulename); 360  tofich(fortranout,ligne,1); 361  /* List all Call Alloc_agrif_ */  266 void Write_Closing_Module(int forend)  267 {  268 listvar *parcours;  269 listnom *parcours_nom;  270 listnom *parcours_nomprec;  271 variable *v;  272 int out = 0;  273 int headtypewritten = 0;  274 char ligne[LONG_M];  275 int changeval;  276   277 // Write Global Parameter Declaration  278 parcours = List_GlobalParameter_Var;  279 while( parcours )  280 {  281 if ( !strcasecmp(parcours->var->v_modulename, curmodulename) )  282 {  283 WriteVarDeclaration(parcours->var, module_declar, 0, 1);  284 }  285 parcours = parcours -> suiv;  286 }  287   288 // Write Global Type declaration  289 parcours = List_Global_Var;  290 while( parcours )  291 {  292 v = parcours->var;  293 if ( !strcasecmp(v->v_modulename, curmodulename) &&  294 !strcasecmp(v->v_typevar, "type") )  295 {  296 if ( headtypewritten == 0 )  297 {  298 fprintf(fortran_out, "\n type Agrif_%s\n", curmodulename);  299 headtypewritten = 1;  300 }  301 changeval = 0;  302 if ( v->v_allocatable )  303 {  304 changeval = 1;  305 v->v_allocatable = 0;  306 v->v_pointerdeclare = 1;  307 }  308 WriteVarDeclaration(v, fortran_out, 0, 0);  309 if ( changeval )  310 {  311 v->v_allocatable = 1;  312 v->v_pointerdeclare = 0;  313 }  314 out = 1;  315 }  316 parcours = parcours -> suiv;  317 }  318 if (out == 1)  319 {  320 fprintf(fortran_out, " end type Agrif_%s\n", curmodulename);  321 sprintf(ligne, "type(Agrif_%s), dimension(:), allocatable :: Agrif_%s_var",curmodulename, curmodulename);  322 tofich(fortran_out,ligne,1);  323 fprintf(fortran_out, " public :: Agrif_%s\n", curmodulename);  324 fprintf(fortran_out, " public :: Agrif_%s_var\n", curmodulename);  325 }  326   327 // Write NotGridDepend declaration  328 parcours = List_NotGridDepend_Var;  329 while( parcours )  330 {  331 if ( !strcasecmp(parcours->var->v_modulename,curmodulename) )  332 {  333 WriteVarDeclaration(parcours->var, fortran_out, 0, 1);  334 }  335 parcours = parcours -> suiv;  336 }  337   338 // Write Alloc_agrif_'modulename' subroutine  339 parcours_nomprec = (listnom*) NULL;  340 parcours_nom = List_NameOfModule;  341 out = 0 ;  342 while ( parcours_nom && out == 0 )  343 {  344 if ( !strcasecmp(curmodulename,parcours_nom->o_nom) ) out = 1;  345 else parcours_nom = parcours_nom -> suiv;  346 }  347 if ( ! out )  348 {  349 printf("#\n# Write_Closing_Module : OUT == 0 *** /!\\ ***\n");  350 printf("# FIXME: POSSIBLE BUG in CONV !!!\n#\n");  351 }  352 if ( out )  353 {  354 if ( parcours_nom->o_val == 1 )  355 {  356 fprintf(fortran_out,"\n public :: Alloc_agrif_%s\n",curmodulename);  357 }  358 if ( (forend == 0) || (parcours_nom->o_val == 1) )  359 {  360 fprintf(fortran_out,"\n contains\n");  361 }  362 if ( parcours_nom->o_val == 1 )  363 {  364 fprintf(fortran_out, " subroutine Alloc_agrif_%s(Agrif_Gr)\n", curmodulename);  365 fprintf(fortran_out, " use Agrif_Util\n");  366 fprintf(fortran_out, " type(Agrif_grid), pointer :: Agrif_Gr\n");  367 fprintf(fortran_out, " integer :: i\n");  368 fprintf(fortran_out, "\n#include \"alloc_agrif_%s.h\"\n", curmodulename);  369 fprintf(fortran_out, " end subroutine Alloc_agrif_%s\n", curmodulename); 362 370 Add_Subroutine_For_Alloc(curmodulename); 363  364  365   371 }  372 else  373 { 366 374 parcours_nom = List_Subroutine_For_Alloc; 367 375 out = 0; 368 376 while ( parcours_nom && out == 0 ) 369 377 { 370  if ( !strcasecmp(parcours_nom->o_nom,curmodulename) ) out = 1; 371  else 372  { 373  parcours_nomprec = parcours_nom; 374  parcours_nom = parcours_nom->suiv; 375  } 376  } 377  if ( out == 1 ) 378  { 379  if ( parcours_nom == List_Subroutine_For_Alloc) 380  { 381  List_Subroutine_For_Alloc = List_Subroutine_For_Alloc->suiv; 382  } 383  else 384  { 385  parcours_nomprec->suiv = parcours_nom->suiv; 386  parcours_nom = parcours_nomprec->suiv ; 387  } 388  } 389  } 390  } 391  } 392  } 393   394   395  void Write_Alloc_Subroutine_For_End_0() 396  { 397  listnom *parcours_nom; 398  listnom *parcours_nomprec; 399  int out; 400  char ligne[LONG_C]; 401   402  if ( firstpass == 0 ) 403  { 404  parcours_nomprec = (listnom *)NULL; 405  parcours_nom = List_NameOfModule; 406  out = 0 ; 407  while ( parcours_nom && out == 0 ) 408  { 409  /* */ 410  if ( !strcasecmp(curmodulename,parcours_nom->o_nom) ) out = 1; 411  else parcours_nom = parcours_nom -> suiv; 412  } 413  if ( out == 1 ) 414  { 415  if ( parcours_nom->o_val == 1 ) 416  { 417  strcpy (ligne, "\n PUBLIC Alloc_agrif_"); 418  strcat (ligne, curmodulename); 419  strcat (ligne, "\n"); 420  convert2lower(ligne); 421  fprintf(fortranout,ligne); 422  strcpy (ligne, "\n contains\n"); 423  fprintf(fortranout,ligne); 424  sprintf (ligne, "Subroutine Alloc_agrif_%s(Agrif_Gr)", 425  curmodulename); 426  tofich(fortranout,ligne,1); 427  strcpy(ligne,"Use Agrif_Util"); 428  tofich(fortranout,ligne,1); 429  strcpy (ligne, "Type(Agrif_grid), Pointer :: Agrif_Gr"); 430  tofich(fortranout,ligne,1); 431  strcpy(ligne, "INTEGER :: i"); 432  tofich (fortranout, ligne,1); 433  strcpy (ligne, "\n#include \"alloc_agrif_"); 434  strcat (ligne, curmodulename); 435  strcat (ligne, ".h\"\n"); 436  convert2lower(ligne); 437  fprintf(fortranout,ligne); 438  strcpy (ligne, "Return"); 439  tofich(fortranout,ligne,1); 440  sprintf (ligne, "End Subroutine Alloc_agrif_%s",curmodulename); 441  tofich(fortranout,ligne,1); 442  /* List all Call Alloc_agrif */ 443  Add_Subroutine_For_Alloc(parcours_nom->o_nom); 444  } 445  else 446  { 447  parcours_nom = List_Subroutine_For_Alloc; 448  out = 0; 449  while ( parcours_nom && out == 0 ) 450  { 451  if ( !strcasecmp(parcours_nom->o_nom,curmodulename) ) out = 1; 452  else 453  { 454  parcours_nomprec = parcours_nom; 455  parcours_nom = parcours_nom->suiv; 456  } 457  } 458  if ( out == 1 ) 459  { 460  if ( parcours_nom == List_Subroutine_For_Alloc) 461  { 462  List_Subroutine_For_Alloc = List_Subroutine_For_Alloc->suiv; 463  } 464  else 465  { 466  parcours_nomprec->suiv = parcours_nom->suiv; 467  parcours_nom = parcours_nomprec->suiv ; 468  } 469  } 470  } 471  } 472  } 473  } 474   475  void Write_GlobalParameter_Declaration_0() 476  { 477  listvar *parcours; 478   479  if ( firstpass == 0 ) 480  { 481  parcours = List_GlobalParameter_Var; 482  while( parcours ) 483  { 484  if ( !strcasecmp(parcours->var->v_modulename,curmodulename) ) 485  { 486  writevardeclaration(parcours,module_declar,0,1); 487  } 488  parcours = parcours -> suiv; 489  } 490  } 491  } 492   493  void Write_GlobalType_Declaration_0() 494  { 495  listvar *parcours; 496  int out = 0; 497  int headtypewritten = 0; 498  char ligne[LONGNOM]; 499  int changeval; 500   501  if ( firstpass == 0 ) 502  { 503  parcours = List_Global_Var; 504  while( parcours ) 505  { 506  if ( !strcasecmp(parcours->var->v_modulename,curmodulename) ) 507  { 508  if (!strcasecmp(parcours->var->v_typevar,"type")) 509  { 510  out = 1; 511  if (headtypewritten == 0) 512  { 513  /*RB*/ 514  sprintf (ligne, "Module_DeclarType_%s.h",curmodulename); 515  module_declar_type = associate(ligne); 516  sprintf (ligne, " "); 517  tofich (module_declar_type, ligne,1); 518  sprintf(ligne,"TYPE :: Agrif_%s",curmodulename); 519  tofich(module_declar_type,ligne,1); 520  headtypewritten = 1; 521  /*RBend*/ 522  } 523  changeval = 0; 524  if (parcours->var->v_allocatable == 1) 525  { 526  changeval = 1; 527  parcours->var->v_allocatable = 0; 528  parcours->var->v_pointerdeclare = 1; 529  } 530  /*RB*/ 531  writevardeclaration(parcours,module_declar_type,0,0); 532  /*RBend*/ 533  if (changeval == 1) 534  { 535  parcours->var->v_allocatable = 1; 536  parcours->var->v_pointerdeclare = 0; 537  } 538  } 539  } 540  parcours = parcours -> suiv; 541  } 542  if (out == 1) 543  { 544  /*RB*/ 545  sprintf(ligne,"END TYPE Agrif_%s",curmodulename); 546  tofich(module_declar_type,ligne,1); 547  sprintf(ligne,"TYPE(Agrif_%s), DIMENSION(:), ALLOCATABLE :: Agrif_%s_var",curmodulename,curmodulename);  548  tofich(module_declar_type,ligne,1); 549  sprintf(ligne,"PUBLIC :: Agrif_%s",curmodulename);  550  tofich(module_declar_type,ligne,1); 551  sprintf(ligne,"PUBLIC :: Agrif_%s_var",curmodulename);  552  tofich(module_declar_type,ligne,1); 553  /*RBend*/ 554  } 555  } 556  } 557   558  void Write_NotGridDepend_Declaration_0() 559  { 560  listvar *parcours; 561   562  if ( firstpass == 0 ) 563  { 564  parcours = List_NotGridDepend_Var; 565  while( parcours ) 566  { 567  if ( !strcasecmp(parcours->var->v_modulename,curmodulename) ) 568  { 569  writevardeclaration(parcours,fortranout,0,1); 570  } 571  parcours = parcours -> suiv; 572  } 573  }  378 if ( !strcasecmp(parcours_nom->o_nom, curmodulename) ) out = 1;  379 else  380 {  381 parcours_nomprec = parcours_nom;  382 parcours_nom = parcours_nom->suiv;  383 }  384 }  385 if ( out )  386 {  387 if ( parcours_nom == List_Subroutine_For_Alloc)  388 {  389 List_Subroutine_For_Alloc = List_Subroutine_For_Alloc->suiv;  390 }  391 else  392 {  393 parcours_nomprec->suiv = parcours_nom->suiv;  394 parcours_nom = parcours_nomprec->suiv ;  395 }  396 }  397 }  398 } 574 399 } 575 400  … …  669 494 if ( !List_Pointer_Var ) 670 495 { 671  newvar = (listname *)malloc(sizeof(listname)); 672  strcpy(newvar->n_name,nom); 673  Save_Length(nom,20);  496 newvar = (listname*) calloc(1, sizeof(listname));  497 strcpy(newvar->n_name, nom); 674 498 newvar->suiv = NULL; 675 499 List_Pointer_Var = newvar; … …  691 515 { 692 516 /* add the record */ 693  newvar = (listname *)malloc(sizeof(listname)); 517 newvar = (listname*) calloc(1, sizeof(listname)); 694 518 strcpy(newvar->n_name,nom); 695  Save_Length(nom,20);Â696 519 newvar->suiv = NULL; 697 520 parcours->suiv = newvar; … …  745 568 while( parcours && out == 0 ) 746 569 { 747  if ( !strcasecmp(ident,parcours->var->v_nomvar) )  570 if ( !strcasecmp(ident,parcours->var->v_nomvar) ) 748 571 { 749 572 if (!strcasecmp(parcours->var->v_typevar,"type")) out = 1; … …  757 580  758 581 /******************************************************************************/ 759  /* VariableIsNotFunction */ 760  /******************************************************************************/ 761  /* */ 762  /******************************************************************************/ 763  int VariableIsNotFunction(char *ident) 764  { 765  int out; 766  listvar *newvar; 767   768  out =0; 769   770  if ( !strcasecmp(ident,"size") || 771  !strcasecmp(ident,"if") || 772  !strcasecmp(ident,"max") || 773  !strcasecmp(ident,"min") 774  ) 775  { 776  newvar = List_SubroutineDeclaration_Var; 777  while ( newvar && out == 0 ) 778  { 779  if ( !strcasecmp(subroutinename, newvar->var->v_subroutinename) && 780  !strcasecmp(ident, newvar->var->v_nomvar) ) out = 1; 781  newvar = newvar -> suiv ; 782  } 783  if ( out == 1 ) out = 0; 784  else out = 1; 785  /* if it has not been found */ 786  if ( out == 1 ) 787  { 788  out = 0; 789  newvar = List_Global_Var; 790  while ( newvar && out == 0 ) 791  { 792  if ( !strcasecmp(ident, newvar->var->v_nomvar) ) out = 1;  582 /* VariableIsFunction */  583 /******************************************************************************/  584 /* */  585 /******************************************************************************/  586 int VariableIsFunction(const char *ident)  587 {  588 int out;  589 listvar *newvar;  590   591 out = 0;  592   593 if ( !strcasecmp(ident,"size") ||  594 !strcasecmp(ident,"if") ||  595 !strcasecmp(ident,"max") ||  596 !strcasecmp(ident,"min") )  597 {  598 newvar = List_SubroutineDeclaration_Var;  599 while ( newvar && out == 0 )  600 {  601 if ( !strcasecmp(subroutinename, newvar->var->v_subroutinename) &&  602 !strcasecmp(ident, newvar->var->v_nomvar) )  603 {  604 out = 1;  605 } 793 606 newvar = newvar -> suiv ; 794  } 795  if ( out == 1 ) out = 0; 796  else out = 1; 797  } 798  } 799  /* */ 800  return out; 801  }  607 }  608 if ( out == 0 ) /* if it has not been found */  609 {  610 newvar = List_Global_Var;  611 while ( newvar && out == 0 )  612 {  613 if ( !strcasecmp(ident, newvar->var->v_nomvar) ) out = 1;  614 newvar = newvar -> suiv ;  615 }  616 }  617 }  618 return (out == 0);  619 }  620   621 void dump_var(const variable* var)  622 {  623 fprintf(stderr, " var->v_nomvar : %s\n",var->v_nomvar);  624 fprintf(stderr, " var->v_indice : %d\n",var->v_indicetabvars);  625 fprintf(stderr, " var->v_typevar: %s\n",var->v_typevar);  626 fprintf(stderr, " var->v_catvar : %d\n",var->v_catvar);  627 fprintf(stderr, " var->v_modulename: %s\n",var->v_modulename);  628 fprintf(stderr, " var->v_subroutinename: %s\n",var->v_subroutinename);  629 fprintf(stderr, " var->v_commonname: %s\n",var->v_commonname);  630 fprintf(stderr, " var->v_commoninfile: %s\n",var->v_commoninfile);  631 fprintf(stderr, " var->v_nbdim: %d\n",var->v_nbdim);  632 fprintf(stderr, " var->v_common: %d\n",var->v_common);  633 fprintf(stderr, " var->v_module: %d\n",var->v_module);  634 fprintf(stderr, " var->v_initialvalue: %s\n",var->v_initialvalue);  635 } -
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/EXTERNAL/AGRIF/LIB/UtilListe.c
r5781 r6237  41 41 void Init_Variable(variable *var) 42 42 { 43  strcpy(var->v_typevar , "");Â44  strcpy(var->v_nomvar , "");Â45  strcpy(var->v_oldname , "");Â46  strcpy(var->v_dimchar , "");Â47  strcpy(var->v_modulename , "");Â48  strcpy(var->v_commonname , "");Â49  strcpy(var->v_vallengspec , "");Â50  strcpy(var->v_nameinttypename , "");Â51  strcpy(var->v_commoninfile , "");Â52  strcpy(var->v_subroutinename , "");Â53  strcpy(var->v_precision , "");Â54  strcpy(var->v_initialvalue , "");Â55  strcpy(var->v_IntentSpec , "");Â56  strcpy(var->v_readedlistdimension, ""); 43 strcpy(var->v_typevar , "");  44 strcpy(var->v_nomvar , "");  45 strcpy(var->v_oldname , "");  46 strcpy(var->v_dimchar , "");  47 strcpy(var->v_modulename , "");  48 strcpy(var->v_commonname , "");  49 strcpy(var->v_vallengspec , "");  50 strcpy(var->v_nameinttypename , "");  51 strcpy(var->v_commoninfile , "");  52 strcpy(var->v_subroutinename , "");  53 strcpy(var->v_precision , "");  54 strcpy(var->v_initialvalue , "");  55 strcpy(var->v_IntentSpec , "");  56 strcpy(var->v_readedlistdimension, ""); 57 57 var->v_nbdim = 0 ; 58 58 var->v_common = 0 ; … …  60 60 var->v_module = 0 ; 61 61 var->v_save = 0 ;  62 var->v_catvar = 0 ; 62 63 var->v_VariableIsParameter = 0 ; 63 64 var->v_PublicDeclare = 0 ; … …  74 75 var->v_target = 0 ; 75 76 var->v_dimsempty = 0 ; 76  var->v_dimension = (listdim *) NULL; 77 var->v_dimension = (listdim *) NULL; 77 78 } 78 79 /******************************************************************************/ … …  89 90 /* */ 90 91 /******************************************************************************/ 91  listvar * AddListvarToListvar(listvar *l,listvar *glob,int ValueFirstpass) 92  { 93  listvar *newvar; 94  if ( firstpass == ValueFirstpass ) 95  { 96  if ( !glob) glob = l ; 97  else 98  { 99  newvar=glob; 100  while (newvar->suiv) newvar = newvar->suiv; 101  newvar->suiv = l; 102  } 103  } 104  return glob;  92 listvar * AddListvarToListvar ( listvar *l, listvar *glob, int ValueFirstpass )  93 {  94 listvar *newvar;  95 if ( firstpass == ValueFirstpass )  96 {  97 if ( !glob ) glob = l;  98 else  99 {  100 newvar = glob;  101 while (newvar->suiv)  102 newvar = newvar->suiv;  103 newvar->suiv = l;  104 }  105 }  106 return glob; 105 107 } 106 108  … …  113 115 /* */ 114 116 /******************************************************************************/ 115  void CreateAndFillin_Curvar(char *type,variable *curvar) 116  { 117  if (!strcasecmp(type,"character") && strcasecmp(CharacterSize,"") ) 118  { 119  strcpy(curvar->v_dimchar,CharacterSize); 120  Save_Length(CharacterSize,5); 121  } 122   123  /* On donne la precision de la variable si elle a ete donnee */ 124  curvar->v_c_star = 0; 125  if ( c_star == 1 ) curvar->v_c_star = 1; 126  /* */ 127  strcpy(curvar->v_vallengspec,""); 128  if ( strcasecmp(vallengspec,"") ) 129  { 130  strcpy(curvar->v_vallengspec,vallengspec); 131  Save_Length(vallengspec,8); 132  } 133   134  strcpy(curvar->v_precision,""); 135  if ( strcasecmp(NamePrecision,"") ) 136  { 137  strcpy(curvar->v_precision,NamePrecision); 138  Save_Length(NamePrecision,12); 139  } 140  /* Si cette variable a ete declaree dans un module on met curvar->module=1 */ 141  if ( inmoduledeclare == 1 || SaveDeclare == 1) 142  { 143  curvar->v_module = 1; 144  } 145  /* Puis on donne le nom du module dans curvar->v_modulename */ 146  strcpy(curvar->v_modulename,curmodulename); 147  Save_Length(curmodulename,6); 148  /* Si cette variable a ete initialisee */ 149  /*RB*/ 150  if ( ! strcmp(InitialValueGiven,"=") )  151  /*RBend*/ 152  { 153  strcpy(curvar->v_initialvalue,InitValue); 154  Save_Length(InitValue,14); 155  } 156  /* Si cette variable est declaree en save */ 157  /*RB*/ 158  if (SaveDeclare == 1 && !strcasecmp(curvar->v_typevar,"type")) { 159  /*RBend*/ 160  curvar->v_save = 1; 161  } 162   163  /* Si cette variable est v_allocatable */ 164  if (Allocatabledeclare == 1 ) curvar->v_allocatable=1; 165   166  /* Si cette variable est v_targer */ 167  if (Targetdeclare == 1 ) curvar->v_target=1; 168  /* if INTENT spec has been given */ 169  if ( strcasecmp(IntentSpec,"") ) 170  { 171  strcpy(curvar->v_IntentSpec,IntentSpec); 172  Save_Length(IntentSpec,13); 173  } 174  } 175    117 void CreateAndFillin_Curvar(const char *type, variable *curvar)  118 {  119 if ( !strcasecmp(type, "character") && strcasecmp(CharacterSize, "") )  120 {  121 strcpy(curvar->v_dimchar, CharacterSize);  122 }  123   124 /* On donne la precision de la variable si elle a ete donnee */  125 curvar->v_c_star = 0;  126 if ( c_star == 1 ) curvar->v_c_star = 1;  127   128 strcpy(curvar->v_vallengspec,"");  129 if ( strcasecmp(vallengspec,"") )  130 {  131 strcpy(curvar->v_vallengspec,vallengspec);  132 Save_Length(vallengspec,8);  133 }  134   135 strcpy(curvar->v_precision,"");  136 if ( strcasecmp(NamePrecision,"") )  137 {  138 strcpy(curvar->v_precision,NamePrecision);  139 addprecision_derivedfromkind(curvar);  140 Save_Length(NamePrecision,12);  141 }  142 /* Si cette variable a ete declaree dans un module on met curvar->module=1 */  143 if ( inmoduledeclare == 1 || SaveDeclare == 1 )  144 {  145 curvar->v_module = 1;  146 }  147 /* Puis on donne le nom du module dans curvar->v_modulename */  148 strcpy(curvar->v_modulename,curmodulename);  149 /* Si cette variable a ete initialisee */  150 if (InitialValueGiven == 1 )  151 {  152 strcpy(curvar->v_initialvalue,InitValue);  153 Save_Length(InitValue,14);  154 }  155 /* Si cette variable est declaree en save */  156 if (SaveDeclare == 1 && !strcasecmp(curvar->v_typevar,"type")) curvar->v_save = 1;  157   158 /* Si cette variable est v_allocatable */  159 if (Allocatabledeclare == 1 ) curvar->v_allocatable=1;  160   161 /* Si cette variable est v_target */  162 if (Targetdeclare == 1 ) curvar->v_target=1;  163   164 /* if INTENT spec has been given */  165 if ( strcasecmp(IntentSpec,"") )  166 {  167 strcpy(curvar->v_IntentSpec,IntentSpec);  168 Save_Length(IntentSpec,13);  169 }  170 }  171   172   173 void addprecision_derivedfromkind(variable *curvar)  174 {  175 listnom *parcours;  176 char kind[LONG_VNAME];  177 char kind_val[LONG_C];  178   179 sscanf(curvar->v_precision, "%100s =", kind_val);  180   181 if ( !strcasecmp(kind_val, "kind") )  182 sscanf(curvar->v_precision, "%50s = %50s", kind, kind_val);  183   184 parcours = listofkind;  185 while (parcours)  186 {  187 if ( !strcasecmp(parcours->o_nom, kind_val) )  188 {  189 sprintf(curvar->v_nameinttypename, "%d", parcours->o_val);  190 }  191 parcours=parcours->suiv;  192 }  193 } 176 194  177 195 /******************************************************************************/ … …  180 198 /* */ 181 199 /******************************************************************************/ 182  void duplicatelistvar(listvar *orig) 183  { 184  listvar *parcours; 185  listvar *tmplistvar; 186  listvar *tmplistvarprec; 187  listdim *tmplistdim; 188  variable *tmpvar; 189   190  tmplistvarprec = (listvar *)NULL; 191  parcours = orig; 192  while ( parcours ) 193  { 194  tmplistvar = (listvar *)malloc(sizeof(listvar)); 195  tmpvar = (variable *)malloc(sizeof(variable)); 196  /* */ 197  Init_Variable(tmpvar); 198  /* */ 199 Â