4 #include <sys/resource.h>
11 #include "protos_kpp.h"
16 main( int argc
, char *argv
[], char *env
[] )
18 char fname_in
[NAMELEN
], dir
[NAMELEN
], fname_tmp
[NAMELEN
], command
[NAMELEN
] ;
19 FILE * fp_in
, *fp_tmp
;
24 mypid
= (int) getpid() ;
25 strcpy( thiscom
, argv
[0] ) ;
29 sw_io_deref_kludge
= 0 ;
30 sw_3dvar_iry_kludge
= 0 ;
31 sw_distrib_io_layer
= 1 ;
32 sw_limit_args
= 0 ; /* usually set -- except for GRAPS */
34 sw_all_x_staggered
= 0 ;
36 sw_all_y_staggered
= 0 ;
38 sw_dm_serial_in_only
= 0 ; /* input and bdy data set is distributed by node 0,
39 other data streams are written to file per process */
41 strcpy( fname_in
, "" ) ;
43 rlim
.rlim_cur
= RLIM_INFINITY
;
44 rlim
.rlim_max
= RLIM_INFINITY
;
46 setrlimit ( RLIMIT_STACK
, &rlim
) ;
51 if (*argv
[0] == '-') { /* an option */
52 if (!strncmp(*argv
,"-D",2)) {
58 if (!strcmp(*argv
,"-DDEREF_KLUDGE")) {
61 if (!strcmp(*argv
,"-DIO_DEREF_KLUDGE")) {
62 sw_io_deref_kludge
= 1 ;
64 if (!strcmp(*argv
,"-DLIMIT_ARGS")) {
67 if (!strcmp(*argv
,"-DMOVE_NESTS")) {
70 if (!strcmp(*argv
,"-DIFORT_KLUDGE")) {
73 if (!strcmp(*argv
,"-DD3VAR_IRY_KLUDGE")) {
75 sw_3dvar_iry_kludge
= 1 ;
77 fprintf(stderr
,"WARNING: -DD3VAR_IRY_KLUDGE option obsolete (it is now disabled by default). Ignored.\n") ;
80 if (!strcmp(*argv
,"-DALL_X_STAGGERED")) {
81 sw_all_x_staggered
= 1 ;
83 if (!strcmp(*argv
,"-DALL_Y_STAGGERED")) {
84 sw_all_y_staggered
= 1 ;
86 if (!strcmp(*argv
,"-DDM_PARALLEL")) {
89 if (!strcmp(*argv
,"-DDISTRIB_IO_LAYER")) {
91 sw_distrib_io_layer
= 1 ;
93 fprintf(stderr
,"WARNING: -DDISTRIB_IO_LAYER option obsolete (it is now default). Ignored.\n") ;
96 if (!strcmp(*argv
,"-DDM_SERIAL_IN_ONLY")) {
97 sw_dm_serial_in_only
= 1 ;
99 if (!strncmp(*argv
,"-h",2)) {
100 fprintf(stderr
,"Usage: %s [-DDEREF_KLUDGE] [-DDM_PARALLEL] [-DDISTRIB_IO_LAYER] [-DDM_SERIAL_IN_ONLY] [-DD3VAR_IRY_KLUDGE] registryfile\n",thisprog
) ;
104 else /* consider it an input file */
106 strcpy( fname_in
, *argv
) ;
114 /* init_core_table() ; */
116 if ( !strcmp(fname_in
,"") ) fp_in
= stdin
;
118 if (( fp_in
= fopen( fname_in
, "r" )) == NULL
)
120 fprintf(stderr
,"Registry program cannot open %s for reading. Ending.\n", fname_in
) ;
124 sprintf( fname_tmp
, "Registry_tmp.%d",mypid
) ;
125 if (( fp_tmp
= fopen( fname_tmp
, "w" )) == NULL
)
127 fprintf(stderr
,"Registry program cannot open temporary %s for writing. Ending.\n", fname_tmp
) ;
132 strcpy( dir
, fname_in
) ;
133 if ( ( e
= rindex ( dir
, '/' ) ) != NULL
) { *e
= '\0' ; } else { strcpy( dir
, "." ) ; }
136 if ( pre_parse( dir
, fp_in
, fp_tmp
) ) {
137 fprintf(stderr
,"Problem with Registry File %s\n", fname_in
) ;
145 if (( fp_tmp
= fopen( fname_tmp
, "r" )) == NULL
)
147 fprintf(stderr
,"Registry program cannot open %s for reading. Ending.\n", fname_tmp
) ;
158 gen_kpp("inc", "chem/KPP/mechanisms");
162 sprintf(command
,"/bin/rm -f %s\n",fname_tmp
);