1 |
< |
#include <cstdlib> |
2 |
< |
#include <cstdio> |
3 |
< |
#include <cstring> |
1 |
> |
#include <stdlib.h> |
2 |
> |
#include <stdio.h> |
3 |
> |
#include <string.h> |
4 |
|
|
5 |
|
#include "Globals.hpp" |
6 |
|
#include "simError.h" |
52 |
|
#define G_ZCONSFORCEPOLICY 31 |
53 |
|
#define G_SEED 32 |
54 |
|
#define G_RESETTIME 33 |
55 |
+ |
#define G_USEINITTIME 34 |
56 |
+ |
#define G_USEINIT_XS_STATE 35 |
57 |
+ |
#define G_ORTHOBOXTOLERANCE 36 |
58 |
|
|
59 |
+ |
|
60 |
|
Globals::Globals(){ |
61 |
|
|
62 |
|
int i; |
63 |
+ |
|
64 |
+ |
hash_size = 23; |
65 |
+ |
hash_shift = 4; |
66 |
|
|
67 |
|
components = NULL; |
68 |
|
|
104 |
|
addHash( "zconsTol", G_ZCONSTOL); |
105 |
|
addHash( "zconsForcePolicy", G_ZCONSFORCEPOLICY); |
106 |
|
addHash( "seed", G_SEED); |
107 |
+ |
addHash( "useInitialTime", G_USEINITTIME); |
108 |
+ |
addHash( "useInitialExtendedSystemState", G_USEINIT_XS_STATE); |
109 |
+ |
addHash( "orthoBoxTolerance", G_ORTHOBOXTOLERANCE); |
110 |
|
|
111 |
|
|
112 |
|
// define some default values |
114 |
|
strcpy( mixingRule,"standard"); //default mixing rules to standard. |
115 |
|
usePBC = 1; //default periodic boundry conditions to on |
116 |
|
useRF = 0; |
117 |
< |
|
117 |
> |
useInitTime = 1; // default to pull init time from the init file |
118 |
> |
useInitXSstate = 1; // default to pull the extended state from the init file |
119 |
> |
orthoBoxTolerance = 1E-6; |
120 |
> |
|
121 |
|
have_force_field = 0; |
122 |
|
have_n_components = 0; |
123 |
|
have_target_temp = 0; |
400 |
|
default: |
401 |
|
the_event->err_msg = |
402 |
|
strdup( "Global error. targetTemp unrecognized.\n" ); |
403 |
+ |
return 0; |
404 |
+ |
break; |
405 |
+ |
} |
406 |
+ |
break; |
407 |
+ |
|
408 |
+ |
case G_ORTHOBOXTOLERANCE: |
409 |
+ |
switch( the_type ){ |
410 |
+ |
|
411 |
+ |
case STRING: |
412 |
+ |
the_event->err_msg = |
413 |
+ |
strdup( "Global error. orthoBoxTolerance is not a double or int.\n" ); |
414 |
+ |
return 0; |
415 |
+ |
break; |
416 |
+ |
|
417 |
+ |
case DOUBLE: |
418 |
+ |
orthoBoxTolerance = the_event->evt.asmt.rhs.dval; |
419 |
+ |
have_target_temp = 1; |
420 |
+ |
return 1; |
421 |
+ |
break; |
422 |
+ |
|
423 |
+ |
case INT: |
424 |
+ |
orthoBoxTolerance = (double)the_event->evt.asmt.rhs.ival; |
425 |
+ |
have_target_temp = 1; |
426 |
+ |
return 1; |
427 |
+ |
break; |
428 |
+ |
|
429 |
+ |
default: |
430 |
+ |
the_event->err_msg = |
431 |
+ |
strdup( "Global error.orthoBoxTolerance unrecognized.\n" ); |
432 |
|
return 0; |
433 |
|
break; |
434 |
|
} |
934 |
|
strdup( "Global error. tempSet was not \"true\" or \"false\".\n" ); |
935 |
|
return 0; |
936 |
|
break; |
937 |
+ |
|
938 |
+ |
case G_USEINITTIME: |
939 |
+ |
if( the_type == STRING ){ |
940 |
+ |
|
941 |
+ |
if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) useInitTime = 1; |
942 |
+ |
else if( !strcasecmp( "false", the_event->evt.asmt.rhs.sval )) useInitTime = 0; |
943 |
+ |
else{ |
944 |
+ |
the_event->err_msg = |
945 |
+ |
strdup( "Global error. useInitTime was not \"true\" or \"false\".\n" ); |
946 |
+ |
return 0; |
947 |
+ |
} |
948 |
+ |
return 1; |
949 |
+ |
} |
950 |
|
|
951 |
+ |
the_event->err_msg = |
952 |
+ |
strdup( "Global error. useInitTime was not \"true\" or \"false\".\n" ); |
953 |
+ |
return 0; |
954 |
+ |
break; |
955 |
+ |
|
956 |
+ |
case G_USEINIT_XS_STATE: |
957 |
+ |
if( the_type == STRING ){ |
958 |
+ |
|
959 |
+ |
if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) |
960 |
+ |
useInitXSstate = 1; |
961 |
+ |
else if( !strcasecmp( "false", the_event->evt.asmt.rhs.sval )) |
962 |
+ |
useInitXSstate = 0; |
963 |
+ |
else{ |
964 |
+ |
the_event->err_msg = |
965 |
+ |
strdup( "Global error. useInitExtendedSystemState was not \"true\" or \"false\".\n" ); |
966 |
+ |
return 0; |
967 |
+ |
} |
968 |
+ |
return 1; |
969 |
+ |
} |
970 |
+ |
|
971 |
+ |
the_event->err_msg = |
972 |
+ |
strdup( "Global error. useInitExtendedSystemState was not \"true\" or \"false\".\n" ); |
973 |
+ |
return 0; |
974 |
+ |
break; |
975 |
+ |
|
976 |
|
case G_USEPBC: |
977 |
|
if( the_type == STRING ){ |
978 |
|
|