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 699 by tim, Fri Aug 15 19:24:13 2003 UTC vs.
Revision 828 by gezelter, Tue Oct 28 16:03:06 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
54 + #define G_RESETTIME      33
55 + #define G_USEINITTIME    34
56  
57   Globals::Globals(){
58    
59    int i;
60 +
61 +  hash_size = 23;
62 +  hash_shift = 4;
63    
64    components = NULL;
65    
# Line 77 | Line 83 | Globals::Globals(){
83    addHash( "boxY",          G_BOXY );
84    addHash( "boxZ",          G_BOXZ );
85    addHash( "sampleTime",    G_SAMPLETIME );
86 +  addHash( "resetTime",     G_RESETTIME );
87    addHash( "statusTime",    G_STATUSTIME );
88    addHash( "electrostaticCutoffRadius",            G_ECR );
89    addHash( "dielectric",    G_DIELECTRIC );
# Line 91 | Line 98 | Globals::Globals(){
98    addHash( "tauBarostat",                          G_TAUBAROSTAT);
99    addHash( "zconsTime",                            G_ZCONSTIME);
100    addHash( "nZconstraints",                        G_NZCONSTRAINTS);
101 <  addHash( "zconsTol",                               G_ZCONSTOL);
102 <  addHash( "zconsForcePolicy",                    G_ZCONSFORCEPOLICY);
101 >  addHash( "zconsTol",                             G_ZCONSTOL);
102 >  addHash( "zconsForcePolicy",                     G_ZCONSFORCEPOLICY);
103 >  addHash( "seed",                                 G_SEED);
104 >  addHash( "useInitTime",                          G_USEINITTIME),
105          
106          
107    // define some default values
# Line 100 | Line 109 | Globals::Globals(){
109    strcpy( mixingRule,"standard");  //default mixing rules to standard.
110    usePBC = 1; //default  periodic boundry conditions to on
111    useRF  = 0;
112 +  useInitTime = 1; // default to pull init time from the init file
113    
114    have_force_field =  0;
115    have_n_components = 0;
# Line 119 | Line 129 | Globals::Globals(){
129    have_box_z =          0;
130    have_sample_time =    0;
131    have_status_time =    0;
132 +  have_reset_time =     0;
133    have_thermal_time =   0;
134    have_ecr =            0;
135    have_dielectric =     0;
# Line 132 | Line 143 | Globals::Globals(){
143    have_n_zConstraints = 0;
144    have_zConstraints   = 0;
145    have_zcons_tol = 0;
146 +  have_seed = 0;
147  
148   }
149  
# Line 723 | Line 735 | int Globals::globalAssign( event* the_event ){
735        }
736        break;
737  
738 +    case G_RESETTIME:
739 +      switch( the_type ){
740 +        
741 +      case STRING:
742 +        the_event->err_msg =
743 +          strdup( "Global error. resetTime is not a double or int.\n" );
744 +        return 0;
745 +        break;
746 +        
747 +      case DOUBLE:
748 +        resetTime = the_event->evt.asmt.rhs.dval;
749 +        have_reset_time = 1;
750 +        return 1;
751 +        break;
752 +        
753 +      case INT:
754 +        resetTime = (double)the_event->evt.asmt.rhs.ival;
755 +        have_reset_time = 1;
756 +        return 1;
757 +        break;
758 +        
759 +      default:
760 +        the_event->err_msg =
761 +          strdup( "Global error. resetTime unrecognized.\n" );
762 +        return 0;
763 +        break;
764 +      }
765 +      break;
766 +
767      case G_THERMALTIME:
768        switch( the_type ){
769          
# Line 857 | Line 898 | int Globals::globalAssign( event* the_event ){
898          strdup( "Global error. tempSet was not \"true\" or \"false\".\n" );
899        return 0;
900        break;
901 +
902 +    case G_USEINITTIME:
903 +      if( the_type == STRING ){
904 +        
905 +        if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) useInitTime = 1;
906 +        else if( !strcasecmp( "false", the_event->evt.asmt.rhs.sval )) useInitTime = 0;
907 +        else{
908 +          the_event->err_msg =
909 +            strdup( "Global error. useInitTime was not \"true\" or \"false\".\n" );
910 +          return 0;
911 +        }
912 +        return 1;
913 +      }
914        
915 +      the_event->err_msg =
916 +        strdup( "Global error. useInitTime was not \"true\" or \"false\".\n" );
917 +      return 0;
918 +      break;
919 +      
920      case G_USEPBC:
921        if( the_type == STRING ){
922          
# Line 1068 | Line 1127 | int Globals::globalAssign( event* the_event ){
1127        default:
1128          the_event->err_msg =
1129            strdup( "Global error. zconsForcePolicy unrecognized.\n" );
1130 +        return 0;
1131 +        break;
1132 +      }
1133 +      break;
1134 +      // add more token cases here.
1135 +    case G_SEED:
1136 +      switch( the_type ){
1137 +        
1138 +      case STRING:
1139 +   the_event->err_msg =
1140 +          strdup( "Global error. seed is not a string.\n" );
1141          return 0;
1142 +   return 0;
1143          break;
1144 +        
1145 +      case DOUBLE:
1146 +   have_seed = 1;
1147 +   seed = (int)the_event->evt.asmt.rhs.dval;
1148 +        return 1;
1149 +        break;
1150 +        
1151 +      case INT:
1152 +   have_seed = 1;
1153 +   seed =  the_event->evt.asmt.rhs.ival ;
1154 +        return 1;
1155 +        break;
1156 +        
1157 +      default:
1158 +        the_event->err_msg =
1159 +          strdup( "Global error. seed unrecognized.\n" );
1160 +        return 0;
1161 +        break;
1162        }
1163        break;
1164        // add more token cases here.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines