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 465 by gezelter, Mon Apr 7 14:30:12 2003 UTC vs.
Revision 675 by mmeineke, Mon Aug 11 19:38:44 2003 UTC

# Line 25 | Line 25
25   #define G_RUNTIME     6
26  
27   //optional parameters
28 < #define G_INITIALCONFIG 7
29 < #define G_FINALCONFIG   8
30 < #define G_NMOL          9
31 < #define G_DENSITY       10
32 < #define G_BOX           11
33 < #define G_BOXX          12
34 < #define G_BOXY          13
35 < #define G_BOXZ          14
36 < #define G_SAMPLETIME    15
37 < #define G_STATUSTIME    16
38 < #define G_ECR           17
39 < #define G_DIELECTRIC    18
40 < #define G_TEMPSET       19
41 < #define G_THERMALTIME   20
42 < #define G_USEPBC        21
43 < #define G_MIXINGRULE    22
44 < #define G_EST           23
45 < #define G_USERF         24
28 > #define G_INITIALCONFIG   7
29 > #define G_FINALCONFIG     8
30 > #define G_NMOL            9
31 > #define G_DENSITY        10
32 > #define G_BOX            11
33 > #define G_BOXX           12
34 > #define G_BOXY           13
35 > #define G_BOXZ           14
36 > #define G_SAMPLETIME     15
37 > #define G_STATUSTIME     16
38 > #define G_ECR            17
39 > #define G_DIELECTRIC     18
40 > #define G_TEMPSET        19
41 > #define G_THERMALTIME    20
42 > #define G_USEPBC         21
43 > #define G_MIXINGRULE     22
44 > #define G_EST            23
45 > #define G_USERF          24
46   #define G_TARGETPRESSURE 25
47 + #define G_TAUTHERMOSTAT  26
48 + #define G_TAUBAROSTAT    27
49 + #define G_ZCONSTIME      28
50 + #define G_NZCONSTRAINTS  29
51  
52  
53   Globals::Globals(){
# Line 82 | Line 86 | Globals::Globals(){
86    addHash( "electrostaticSkinThickness",           G_EST );
87    addHash( "useReactionField",                     G_USERF );
88    addHash( "targetPressure",                       G_TARGETPRESSURE);
89 <  
89 >  addHash( "tauThermostat",                        G_TAUTHERMOSTAT);
90 >  addHash( "tauBarostat",                          G_TAUBAROSTAT);
91 >  addHash( "zconsTime",                            G_ZCONSTIME);
92 >  addHash( "nZconstraints",                        G_NZCONSTRAINTS);
93 >
94    // define some default values
95  
96    strcpy( mixingRule,"standard");  //default mixing rules to standard.
# Line 113 | Line 121 | Globals::Globals(){
121    have_tempSet =        0;
122    have_est =            0;
123    have_target_pressure =0;
124 +  have_q_mass =         0;
125 +  have_tau_thermostat = 0;
126 +  have_tau_barostat   = 0;
127 +  have_zcon_time     = 0;
128 +  have_n_zConstraints = 0;
129 +  have_zConstraints   = 0;
130   }
131  
132   Globals::~Globals(){
# Line 187 | Line 201 | int Globals::componentStartIndex( event* the_event ){
201    return 0;
202   }
203  
204 < int Globals::componentStartIndex( event* the_event ){
204 > int Globals::componentEnd( event* the_event ){
205  
206 <  current_component->startIndex( the_event->evt.si.array,
207 <                                 the_event->evt.si.n_elements );
206 >  the_event->err_msg = current_component->checkMe();
207 >  if( the_event->err_msg != NULL ) return 0;
208 >
209    return 1;
210   }
211  
212 < int Globals::componentEnd( event* the_event ){
212 > int Globals::newZconstraint( event* the_event ){
213 >  
214  
215 <  the_event->err_msg = current_component->checkMe();
215 >  int index = the_event->evt.blk_index;
216 >  char err[200];
217 >  current_zConstraint = new ZconStamp( index );
218 >  
219 >  have_zConstraints = 1;
220 >
221 >  if( have_n_zConstraints && index < n_zConstraints )
222 >    zConstraints[index] = current_zConstraint;
223 >  else{
224 >    if( have_n_zConstraints ){
225 >      sprintf( err, "Globals error, %d out of nZconstraints range",
226 >               index );
227 >      the_event->err_msg = strdup( err );
228 >      return 0;
229 >    }
230 >    else{
231 >      the_event->err_msg = strdup("Globals error, nZconstraints"
232 >                                  " not given before"
233 >                                  " first zConstraint declaration." );
234 >      return 0;
235 >    }
236 >  }  
237 >
238 >  return 1;
239 > }
240 >
241 >
242 >
243 > int Globals::zConstraintAssign( event* the_event ){
244 >
245 >  switch( the_event->evt.asmt.asmt_type ){
246 >    
247 >  case STRING:
248 >    return current_zConstraint->assignString( the_event->evt.asmt.lhs,
249 >                                            the_event->evt.asmt.rhs.sval,
250 >                                            &(the_event->err_msg));
251 >    break;
252 >    
253 >  case DOUBLE:
254 >    return current_zConstraint->assignDouble( the_event->evt.asmt.lhs,
255 >                                            the_event->evt.asmt.rhs.dval,
256 >                                            &(the_event->err_msg));
257 >    break;
258 >    
259 >  case INT:
260 >    return current_zConstraint->assignInt( the_event->evt.asmt.lhs,
261 >                                         the_event->evt.asmt.rhs.ival,
262 >                                         &(the_event->err_msg));
263 >    break;
264 >    
265 >  default:
266 >    the_event->err_msg = strdup( "Globals error. Invalid zConstraint"
267 >                                 " assignment type" );
268 >    return 0;
269 >    break;
270 >  }
271 >  return 0;
272 > }
273 >
274 > int Globals::zConstraintEnd( event* the_event ){
275 >
276 >  the_event->err_msg = current_zConstraint->checkMe();
277    if( the_event->err_msg != NULL ) return 0;
278  
279    return 1;
# Line 251 | Line 328 | int Globals::globalAssign( event* the_event ){
328          return 1;
329        }
330        break;
331 +
332 +    case G_NZCONSTRAINTS:
333 +      if( the_type == STRING ){
334 +        the_event->err_msg =
335 +          strdup("Global error. nZconstraints is not a double or an int.\n" );
336 +        return 0;
337 +      }
338        
339 +      else if( the_type == DOUBLE ){
340 +        n_zConstraints = (int)the_event->evt.asmt.rhs.dval;
341 +        zConstraints = new ZconStamp*[n_zConstraints];
342 +        have_n_zConstraints = 1;
343 +        return 1;
344 +      }
345 +      
346 +      else{
347 +        n_zConstraints = the_event->evt.asmt.rhs.ival;
348 +        zConstraints = new ZconStamp*[n_zConstraints];
349 +        have_n_zConstraints = 1;
350 +        return 1;
351 +      }
352 +      break;
353 +      
354      case G_TARGETTEMP:
355        switch( the_type ){
356          
# Line 813 | Line 912 | int Globals::globalAssign( event* the_event ){
912        default:
913          the_event->err_msg =
914            strdup( "Global error. targetPressure unrecognized.\n" );
915 +        return 0;
916 +        break;
917 +      }
918 +      break;
919 +
920 +    case G_TAUTHERMOSTAT:
921 +      switch( the_type ){
922 +        
923 +      case STRING:
924 +        the_event->err_msg =
925 +          strdup( "Global error. tauThermostat is not a double or int.\n" );
926          return 0;
927          break;
928 +        
929 +      case DOUBLE:
930 +        tau_thermostat = the_event->evt.asmt.rhs.dval;
931 +        have_tau_thermostat = 1;
932 +        return 1;
933 +        break;
934 +        
935 +      case INT:
936 +        tau_thermostat = (double)the_event->evt.asmt.rhs.ival;
937 +        have_tau_thermostat = 1;
938 +        return 1;
939 +        break;
940 +        
941 +      default:
942 +        the_event->err_msg =
943 +          strdup( "Global error. tauThermostat unrecognized.\n" );
944 +        return 0;
945 +        break;
946        }
947        break;
948  
949 +    case G_TAUBAROSTAT:
950 +      switch( the_type ){
951 +        
952 +      case STRING:
953 +        the_event->err_msg =
954 +          strdup( "Global error. tauBarostat is not a double or int.\n" );
955 +        return 0;
956 +        break;
957 +        
958 +      case DOUBLE:
959 +        tau_barostat = the_event->evt.asmt.rhs.dval;
960 +        have_tau_barostat = 1;
961 +        return 1;
962 +        break;
963 +        
964 +      case INT:
965 +        tau_barostat = (double)the_event->evt.asmt.rhs.ival;
966 +        have_tau_barostat = 1;
967 +        return 1;
968 +        break;
969 +        
970 +      default:
971 +        the_event->err_msg =
972 +          strdup( "Global error. tauBarostat unrecognized.\n" );
973 +        return 0;
974 +        break;
975 +      }
976 +      break;
977 +      
978 +   case G_ZCONSTIME:
979 +      switch( the_type ){
980 +        
981 +      case STRING:
982 +        the_event->err_msg =
983 +          strdup( "Global error. zcons_time is not a double or int.\n" );
984 +        return 0;
985 +        break;
986 +        
987 +      case DOUBLE:
988 +        zcons_time = the_event->evt.asmt.rhs.dval;
989 +        return 1;
990 +        break;
991 +        
992 +      case INT:
993 +        zcons_time = (double)the_event->evt.asmt.rhs.ival;
994 +        have_zcon_time = 1;
995 +        return 1;
996 +        break;
997 +        
998 +      default:
999 +        the_event->err_msg =
1000 +          strdup( "Global error. zcons_time unrecognized.\n" );
1001 +        return 0;
1002 +        break;
1003 +      }
1004 +      break;
1005 +  
1006 +
1007 +      // add more token cases here.
1008 +
1009      }
1010    }
1011    

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines