ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libBASS/Globals.cpp
(Generate patch)

Comparing trunk/OOPSE/libBASS/Globals.cpp (file contents):
Revision 704 by tim, Wed Aug 20 19:11:51 2003 UTC vs.
Revision 855 by mmeineke, Thu Nov 6 22:01:37 2003 UTC

# Line 1 | Line 1
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"
# Line 48 | Line 48
48   #define G_TAUBAROSTAT    27
49   #define G_ZCONSTIME      28
50   #define G_NZCONSTRAINTS  29
51 < #define G_ZCONSTOL 30
51 > #define G_ZCONSTOL       30
52   #define G_ZCONSFORCEPOLICY 31
53 < #define G_SEED                        32
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    
# Line 78 | Line 86 | Globals::Globals(){
86    addHash( "boxY",          G_BOXY );
87    addHash( "boxZ",          G_BOXZ );
88    addHash( "sampleTime",    G_SAMPLETIME );
89 +  addHash( "resetTime",     G_RESETTIME );
90    addHash( "statusTime",    G_STATUSTIME );
91    addHash( "electrostaticCutoffRadius",            G_ECR );
92    addHash( "dielectric",    G_DIELECTRIC );
# Line 92 | Line 101 | Globals::Globals(){
101    addHash( "tauBarostat",                          G_TAUBAROSTAT);
102    addHash( "zconsTime",                            G_ZCONSTIME);
103    addHash( "nZconstraints",                        G_NZCONSTRAINTS);
104 <  addHash( "zconsTol",                               G_ZCONSTOL);
105 <  addHash( "zconsForcePolicy",                    G_ZCONSFORCEPOLICY);
106 <  addHash( "seed",                                     G_SEED);
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
# Line 102 | Line 114 | Globals::Globals(){
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;
# Line 121 | Line 136 | Globals::Globals(){
136    have_box_z =          0;
137    have_sample_time =    0;
138    have_status_time =    0;
139 +  have_reset_time =     0;
140    have_thermal_time =   0;
141    have_ecr =            0;
142    have_dielectric =     0;
# Line 384 | Line 400 | int Globals::globalAssign( event* the_event ){
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        }
# Line 721 | Line 766 | int Globals::globalAssign( event* the_event ){
766        default:
767          the_event->err_msg =
768            strdup( "Global error. statusTime unrecognized.\n" );
769 +        return 0;
770 +        break;
771 +      }
772 +      break;
773 +
774 +    case G_RESETTIME:
775 +      switch( the_type ){
776 +        
777 +      case STRING:
778 +        the_event->err_msg =
779 +          strdup( "Global error. resetTime is not a double or int.\n" );
780          return 0;
781          break;
782 +        
783 +      case DOUBLE:
784 +        resetTime = the_event->evt.asmt.rhs.dval;
785 +        have_reset_time = 1;
786 +        return 1;
787 +        break;
788 +        
789 +      case INT:
790 +        resetTime = (double)the_event->evt.asmt.rhs.ival;
791 +        have_reset_time = 1;
792 +        return 1;
793 +        break;
794 +        
795 +      default:
796 +        the_event->err_msg =
797 +          strdup( "Global error. resetTime unrecognized.\n" );
798 +        return 0;
799 +        break;
800        }
801        break;
802  
# Line 858 | Line 932 | int Globals::globalAssign( event* the_event ){
932        
933        the_event->err_msg =
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          

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines