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

Comparing trunk/OOPSE-2.0/src/io/Globals.cpp (file contents):
Revision 1490 by gezelter, Fri Sep 24 04:16:43 2004 UTC vs.
Revision 2238 by tim, Sun May 22 21:05:15 2005 UTC

# Line 1 | Line 1
1 + /*
2 + * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved.
3 + *
4 + * The University of Notre Dame grants you ("Licensee") a
5 + * non-exclusive, royalty free, license to use, modify and
6 + * redistribute this software in source and binary code form, provided
7 + * that the following conditions are met:
8 + *
9 + * 1. Acknowledgement of the program authors must be made in any
10 + *    publication of scientific results based in part on use of the
11 + *    program.  An acceptable form of acknowledgement is citation of
12 + *    the article in which the program was described (Matthew
13 + *    A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher
14 + *    J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented
15 + *    Parallel Simulation Engine for Molecular Dynamics,"
16 + *    J. Comput. Chem. 26, pp. 252-271 (2005))
17 + *
18 + * 2. Redistributions of source code must retain the above copyright
19 + *    notice, this list of conditions and the following disclaimer.
20 + *
21 + * 3. Redistributions in binary form must reproduce the above copyright
22 + *    notice, this list of conditions and the following disclaimer in the
23 + *    documentation and/or other materials provided with the
24 + *    distribution.
25 + *
26 + * This software is provided "AS IS," without a warranty of any
27 + * kind. All express or implied conditions, representations and
28 + * warranties, including any implied warranty of merchantability,
29 + * fitness for a particular purpose or non-infringement, are hereby
30 + * excluded.  The University of Notre Dame and its licensors shall not
31 + * be liable for any damages suffered by licensee as a result of
32 + * using, modifying or distributing the software or its
33 + * derivatives. In no event will the University of Notre Dame or its
34 + * licensors be liable for any lost revenue, profit or data, or for
35 + * direct, indirect, special, consequential, incidental or punitive
36 + * damages, however caused and regardless of the theory of liability,
37 + * arising out of the use of or inability to use software, even if the
38 + * University of Notre Dame has been advised of the possibility of
39 + * such damages.
40 + */
41 +
42   #include <stdlib.h>
43   #include <stdio.h>
44   #include <string.h>
45  
46 < #include "Globals.hpp"
47 < #include "simError.h"
46 > #include "io/Globals.hpp"
47 > #include "utils/simError.h"
48   #ifdef IS_MPI
49 < #include "mpiBASS.h"
49 > #include "io/mpiBASS.h"
50   #endif // is_mpi
51  
52   /*
53   * The following section lists all of the defined tokens for the
54 < * gloabal assignment statements. All are prefixed with a G_ to avoid
54 > * global assignment statements. All are prefixed with a G_ to avoid
55   * stepping on any previously defined enumerations.
56   *
57   * NOTE: tokens start at 1, 0 is a resrved token number
# Line 71 | Line 112
112   #define G_THERM_INT_LAMBDA  50
113   #define G_THERM_INT_K       51
114   #define G_FORCEFIELD_VARIANT 52
115 + #define G_FORCEFIELD_FILENAME 53
116 + #define G_THERM_INT_DIST_SPRING  54
117 + #define G_THERM_INT_THETA_SPRING 55
118 + #define G_THERM_INT_OMEGA_SPRING 56
119 + #define G_SURFACETENSION 57
120 + #define G_PRINTPREESURETENSOR   58
121  
122   Globals::Globals(){
123    initalize();
# Line 78 | Line 125 | Globals::~Globals(){
125  
126   Globals::~Globals(){
127    int i;
81
82  for( i=0; i<hash_size; i++ ){
83    if( command_table[i] != NULL ) delete command_table[i];
84  }
85  delete[] command_table;
86
128    if( components != NULL ){
129      for( i=0; i<n_components; i++ ) delete components[i];
130      delete[] components;
# Line 93 | Line 134 | void Globals::initalize(){
134   void Globals::initalize(){
135    int i;
136    
96  hash_size = 23;
97  hash_shift = 4;
98  
137    components = NULL;
138    
139 <  command_table = new LinkedCommand*[hash_size];
140 <  for( i=0; i<hash_size; i++ ) command_table[i] = NULL;
141 <  
142 <  addHash( "forceField",    G_FORCEFIELD );
143 <  addHash( "nComponents",   G_NCOMPONENTS );
144 <  addHash( "targetTemp",    G_TARGETTEMP );
145 <  addHash( "ensemble",      G_ENSEMBLE );
146 <  
147 <  addHash( "dt",            G_DT );
148 <  addHash( "runTime",       G_RUNTIME );
149 <  
150 <  addHash( "initialConfig", G_INITIALCONFIG );
151 <  addHash( "finalConfig",   G_FINALCONFIG );
152 <  addHash( "nMol",          G_NMOL );
153 <  addHash( "density",       G_DENSITY );
154 <  addHash( "box",           G_BOX );
155 <  addHash( "boxX",          G_BOXX );
156 <  addHash( "boxY",          G_BOXY );
157 <  addHash( "boxZ",          G_BOXZ );
158 <  addHash( "sampleTime",    G_SAMPLETIME );
159 <  addHash( "resetTime",     G_RESETTIME );
160 <  addHash( "statusTime",    G_STATUSTIME );
161 <  addHash( "cutoffRadius",  G_RCUT );
162 <  addHash( "switchingRadius",  G_RSW );
163 <  addHash( "dielectric",    G_DIELECTRIC );
164 <  addHash( "tempSet",       G_TEMPSET );
165 <  addHash( "thermalTime",   G_THERMALTIME );
166 <  addHash( "mixingRule",    G_MIXINGRULE);
167 <  addHash( "usePeriodicBoundaryConditions",        G_USEPBC);
168 <  addHash( "useReactionField",                     G_USERF );
169 <  addHash( "targetPressure",                       G_TARGETPRESSURE);
170 <  addHash( "tauThermostat",                        G_TAUTHERMOSTAT);
171 <  addHash( "tauBarostat",                          G_TAUBAROSTAT);
172 <  addHash( "zconsTime",                            G_ZCONSTIME);
173 <  addHash( "nZconstraints",                        G_NZCONSTRAINTS);
174 <  addHash( "zconsTol",                             G_ZCONSTOL);
175 <  addHash( "zconsForcePolicy",                     G_ZCONSFORCEPOLICY);
176 <  addHash( "seed",                                 G_SEED);
177 <  addHash( "useInitialTime",                       G_USEINITTIME);
178 <  addHash( "useInitialExtendedSystemState",        G_USEINIT_XS_STATE);
179 <  addHash( "orthoBoxTolerance",                    G_ORTHOBOXTOLERANCE);
180 <  addHash( "minimizer",                            G_MINIMIZER);
181 <  addHash( "minimizerMaxIter",                     G_MIN_MAXITER);
182 <  addHash( "minimizerWriteFrq",                    G_MIN_WRITEFRQ);
183 <  addHash( "minimizerStepSize",                    G_MIN_STEPSIZE);
184 <  addHash( "minimizerFTol",                        G_MIN_FTOL);
185 <  addHash( "minimizerGTol",                        G_MIN_GTOL);
186 <  addHash( "minimizerLSTol",                       G_MIN_LSTOL);
187 <  addHash( "minimizerLSMaxIter",                   G_MIN_LSMAXITER);
188 <  addHash( "zconsGap",                             G_ZCONSGAP);
189 <  addHash( "zconsFixtime",                         G_ZCONSFIXTIME);
190 <  addHash( "zconsUsingSMD",                        G_ZCONSUSINGSMD);
191 <  addHash( "useSolidThermInt",                     G_USE_SOLID_THERM_INT);
192 <  addHash( "useLiquidThermInt",                    G_USE_LIQUID_THERM_INT);
193 <  addHash( "thermodynamicIntegrationLambda",       G_THERM_INT_LAMBDA);
194 <  addHash( "thermodynamicIntegrationK",            G_THERM_INT_K);
195 <  addHash( "forceFieldVariant",                    G_FORCEFIELD_VARIANT);
139 >  command_table.insert(CommandMapType::value_type("forceField", G_FORCEFIELD));
140 >  command_table.insert(CommandMapType::value_type("nComponents", G_NCOMPONENTS));
141 >  command_table.insert(CommandMapType::value_type("targetTemp", G_TARGETTEMP));
142 >  command_table.insert(CommandMapType::value_type("ensemble", G_ENSEMBLE));
143 >  command_table.insert(CommandMapType::value_type("dt", G_DT));
144 >  command_table.insert(CommandMapType::value_type("runTime", G_RUNTIME));
145 >  command_table.insert(CommandMapType::value_type("initialConfig", G_INITIALCONFIG));
146 >  command_table.insert(CommandMapType::value_type("finalConfig", G_FINALCONFIG));
147 >  command_table.insert(CommandMapType::value_type("nMol", G_NMOL));
148 >  command_table.insert(CommandMapType::value_type("density", G_DENSITY));
149 >  command_table.insert(CommandMapType::value_type("box", G_BOX));
150 >  command_table.insert(CommandMapType::value_type("boxX", G_BOXX));
151 >  command_table.insert(CommandMapType::value_type("boxY", G_BOXY));
152 >  command_table.insert(CommandMapType::value_type("boxZ", G_BOXZ));
153 >  command_table.insert(CommandMapType::value_type("sampleTime", G_SAMPLETIME));
154 >  command_table.insert(CommandMapType::value_type("resetTime", G_RESETTIME));
155 >  command_table.insert(CommandMapType::value_type("statusTime", G_STATUSTIME));
156 >  command_table.insert(CommandMapType::value_type("cutoffRadius", G_RCUT));
157 >  command_table.insert(CommandMapType::value_type("switchingRadius", G_RSW));
158 >  command_table.insert(CommandMapType::value_type("dielectric", G_DIELECTRIC));
159 >  command_table.insert(CommandMapType::value_type("tempSet", G_TEMPSET));
160 >  command_table.insert(CommandMapType::value_type("thermalTime", G_THERMALTIME));
161 >  command_table.insert(CommandMapType::value_type("mixingRule", G_MIXINGRULE));
162 >  command_table.insert(CommandMapType::value_type("usePeriodicBoundaryConditions", G_USEPBC));
163 >  command_table.insert(CommandMapType::value_type("useReactionField", G_USERF));
164 >  command_table.insert(CommandMapType::value_type("targetPressure", G_TARGETPRESSURE));
165 >  command_table.insert(CommandMapType::value_type("tauThermostat", G_TAUTHERMOSTAT));
166 >  command_table.insert(CommandMapType::value_type("tauBarostat", G_TAUBAROSTAT));
167 >  command_table.insert(CommandMapType::value_type("zconsTime", G_ZCONSTIME));
168 >  command_table.insert(CommandMapType::value_type("nZconstraints", G_NZCONSTRAINTS));
169 >  command_table.insert(CommandMapType::value_type("zconsTol", G_ZCONSTOL));
170 >  command_table.insert(CommandMapType::value_type("zconsForcePolicy", G_ZCONSFORCEPOLICY));
171 >  command_table.insert(CommandMapType::value_type("seed", G_SEED));
172 >  command_table.insert(CommandMapType::value_type("useInitialTime", G_USEINITTIME));
173 >  command_table.insert(CommandMapType::value_type("useInitialExtendedSystemState", G_USEINIT_XS_STATE));
174 >  command_table.insert(CommandMapType::value_type("orthoBoxTolerance", G_ORTHOBOXTOLERANCE));
175 >  command_table.insert(CommandMapType::value_type("minimizer", G_MINIMIZER));
176 >  command_table.insert(CommandMapType::value_type("minimizerMaxIter", G_MIN_MAXITER));
177 >  command_table.insert(CommandMapType::value_type("minimizerWriteFrq", G_MIN_WRITEFRQ));
178 >  command_table.insert(CommandMapType::value_type("minimizerStepSize", G_MIN_STEPSIZE));
179 >  command_table.insert(CommandMapType::value_type("minimizerFTol", G_MIN_FTOL));
180 >  command_table.insert(CommandMapType::value_type("minimizerGTol", G_MIN_GTOL));
181 >  command_table.insert(CommandMapType::value_type("minimizerLSTol", G_MIN_LSTOL));
182 >  command_table.insert(CommandMapType::value_type("minimizerLSMaxIter", G_MIN_LSMAXITER));
183 >  command_table.insert(CommandMapType::value_type("zconsGap", G_ZCONSGAP));
184 >  command_table.insert(CommandMapType::value_type("zconsFixtime", G_ZCONSFIXTIME));
185 >  command_table.insert(CommandMapType::value_type("zconsUsingSMD", G_ZCONSUSINGSMD));
186 >  command_table.insert(CommandMapType::value_type("useSolidThermInt", G_USE_SOLID_THERM_INT));
187 >  command_table.insert(CommandMapType::value_type("useLiquidThermInt", G_USE_LIQUID_THERM_INT));
188 >  command_table.insert(CommandMapType::value_type("thermodynamicIntegrationLambda", G_THERM_INT_LAMBDA));
189 >  command_table.insert(CommandMapType::value_type("thermodynamicIntegrationK", G_THERM_INT_K));
190 >  command_table.insert(CommandMapType::value_type("forceFieldVariant", G_FORCEFIELD_VARIANT));
191 >  command_table.insert(CommandMapType::value_type("forceFieldFileName", G_FORCEFIELD_FILENAME));
192 >  command_table.insert(CommandMapType::value_type("thermIntDistSpringConst", G_THERM_INT_DIST_SPRING));
193 >  command_table.insert(CommandMapType::value_type("thermIntThetaSpringConst", G_THERM_INT_THETA_SPRING));
194 >  command_table.insert(CommandMapType::value_type("thermIntOmegaSpringConst", G_THERM_INT_OMEGA_SPRING));
195 >  command_table.insert(CommandMapType::value_type("surfaceTension", G_SURFACETENSION));
196 >  command_table.insert(CommandMapType::value_type("printPressureTensor", G_PRINTPREESURETENSOR));
197  
198 +
199    strcpy( mixingRule,"standard");  //default mixing rules to standard.
200    usePBC = 1; //default  periodic boundry conditions to on
201    useRF  = 0;
# Line 212 | Line 252 | void Globals::initalize(){
252    have_thermodynamic_integration_lambda = 0;
253    have_thermodynamic_integration_k = 0;
254    have_forcefield_variant = 0;
255 <
255 >  have_forcefield_filename = 0;
256 >  have_dist_spring_constant =  0;
257 >  have_theta_spring_constant = 0;
258 >  have_omega_spring_constant = 0;
259 >  have_surface_tension = 0;
260 >  have_print_pressure_tensor = 0;
261   }
262  
263   int Globals::newComponent( event* the_event ){
# Line 360 | Line 405 | int Globals::globalAssign( event* the_event ){
405    char err[300];
406    
407    token = 0;
408 <  key = hash( lhs );
409 <  if( command_table[key] != NULL ) token = command_table[key]->match( lhs );
408 >
409 >  CommandMapType::iterator iter;
410 >  std::string keyword(lhs);
411 >  iter = command_table.find(keyword);
412 >  if (iter != command_table.end()) {
413 >    token = iter->second;
414 >  }
415    
416    if( token ){
417      
# Line 1205 | Line 1255 | int Globals::globalAssign( event* the_event ){
1255        switch( the_type ){
1256          
1257        case STRING:
1258 <   strcpy(zconsForcePolicy, the_event->evt.asmt.rhs.sval);
1258 >        strcpy(zconsForcePolicy, the_event->evt.asmt.rhs.sval);
1259  
1260 <   for(int i = 0; zconsForcePolicy[i] != '\0'; i++)
1261 <        {
1262 <      zconsForcePolicy[i] = toupper(zconsForcePolicy[i]);
1263 <   }
1260 >        for(int i = 0; zconsForcePolicy[i] != '\0'; i++)
1261 >          {
1262 >            zconsForcePolicy[i] = toupper(zconsForcePolicy[i]);
1263 >          }
1264          have_zcons_force_policy = 1;
1265 <   return 1;
1265 >        return 1;
1266          break;
1267          
1268        case DOUBLE:
# Line 1389 | Line 1439 | int Globals::globalAssign( event* the_event ){
1439  
1440        case STRING:
1441          the_event->err_msg =
1442 <          strdup( "Error in parsing meta-data file!\n\tminimizer_writefrq is not a double or int.\n" );
1442 >          strdup( "Error in parsing meta-data file!\n\tminimizer_writefrq is not an int.\n" );
1443          return 1;
1444          break;
1445          
1446        case DOUBLE:
1447 <        minimizer_writefrq= the_event->evt.asmt.rhs.dval;
1448 <        have_minimizer_writefrq = 1;
1447 >        the_event->err_msg =
1448 >          strdup( "Error in parsing meta-data file!\n\tminimizer_writefrq is not an  int.\n" );
1449          return 1;
1450          break;
1451          
# Line 1505 | Line 1555 | int Globals::globalAssign( event* the_event ){
1555  
1556        case STRING:
1557          the_event->err_msg =
1558 <          strdup( "Error in parsing meta-data file!\n\tminimizer_ls_maxiteration is not a double or int.\n" );
1558 >          strdup( "Error in parsing meta-data file!\n\tminimizer_ls_maxiteration is not an int.\n" );
1559          return 1;
1560          break;
1561          
1562        case DOUBLE:
1563 <        minimizer_ls_maxiteration = the_event->evt.asmt.rhs.dval;
1564 <        have_minimizer_ls_maxiteration = 1;
1563 >        the_event->err_msg =
1564 >          strdup( "Error in parsing meta-data file!\n\tminimizer_ls_maxiteration is not an int.\n" );
1565          return 1;
1566          break;
1567          
# Line 1563 | Line 1613 | int Globals::globalAssign( event* the_event ){
1613        switch( the_type ){
1614          
1615        case STRING:
1616 <   the_event->err_msg =
1616 >        the_event->err_msg =
1617            strdup( "Error in parsing meta-data file!\n\tseed is not a string.\n" );
1618          return 0;
1619 <   return 0;
1619 >        return 0;
1620          break;
1621          
1622        case DOUBLE:
1623 <   have_seed = 1;
1624 <   seed = (int)the_event->evt.asmt.rhs.dval;
1623 >        have_seed = 1;
1624 >        seed = (int)the_event->evt.asmt.rhs.dval;
1625          return 1;
1626          break;
1627          
1628        case INT:
1629 <   have_seed = 1;
1630 <   seed =  the_event->evt.asmt.rhs.ival ;
1629 >        have_seed = 1;
1630 >        seed =  the_event->evt.asmt.rhs.ival ;
1631          return 1;
1632          break;
1633          
# Line 1681 | Line 1731 | int Globals::globalAssign( event* the_event ){
1731          return 0;
1732          break;
1733        }
1734 <      break;      
1734 >      break;  
1735 >  
1736      case G_FORCEFIELD_VARIANT:
1737        if( the_type == STRING ){
1738          strcpy( forcefield_variant, the_event->evt.asmt.rhs.sval );
# Line 1694 | Line 1745 | int Globals::globalAssign( event* the_event ){
1745        return 0;
1746        break;      
1747        // add more token cases here.      
1748 +
1749 +    case G_FORCEFIELD_FILENAME:
1750 +      if( the_type == STRING ){
1751 +        strcpy( forcefield_filename, the_event->evt.asmt.rhs.sval );
1752 +        have_forcefield_filename = 1;
1753 +        return 1;
1754 +      }
1755 +      
1756 +      the_event->err_msg =
1757 +        strdup( "Error in parsing meta-data file!\n\tforceFieldFileName was not a string assignment.\n" );
1758 +      return 0;
1759 +      break;      
1760 +
1761 +    case G_THERM_INT_DIST_SPRING:
1762 +      switch( the_type ){
1763 +        
1764 +      case STRING:
1765 +        the_event->err_msg =
1766 +          strdup( "Error in parsing meta-data file!\n\tthermIntDistSpringConst is not a double or int.\n" );
1767 +        return 1;
1768 +        break;
1769 +        
1770 +      case DOUBLE:
1771 +        therm_int_dist_spring = the_event->evt.asmt.rhs.dval;
1772 +        have_dist_spring_constant = 1;
1773 +        return 1;
1774 +        break;
1775 +        
1776 +      case INT:
1777 +        therm_int_dist_spring = (double)the_event->evt.asmt.rhs.dval;
1778 +        have_dist_spring_constant = 1;
1779 +        return 1;
1780 +        break;
1781 +        
1782 +      default:
1783 +        the_event->err_msg =
1784 +          strdup( "Error in parsing meta-data file!\n\tthermIntDistSpringConst unrecognized.\n" );
1785 +        return 0;
1786 +        break;
1787 +      }
1788 +      break;  
1789 +
1790 +    case G_THERM_INT_THETA_SPRING:
1791 +      switch( the_type ){
1792 +        
1793 +      case STRING:
1794 +        the_event->err_msg =
1795 +          strdup( "Error in parsing meta-data file!\n\tthermIntThetaSpringConst is not a double or int.\n" );
1796 +        return 1;
1797 +        break;
1798 +        
1799 +      case DOUBLE:
1800 +        therm_int_theta_spring = the_event->evt.asmt.rhs.dval;
1801 +        have_theta_spring_constant = 1;
1802 +        return 1;
1803 +        break;
1804 +        
1805 +      case INT:
1806 +        therm_int_theta_spring = (double)the_event->evt.asmt.rhs.dval;
1807 +        have_theta_spring_constant = 1;
1808 +        return 1;
1809 +        break;
1810 +        
1811 +      default:
1812 +        the_event->err_msg =
1813 +          strdup( "Error in parsing meta-data file!\n\tthermIntThetaSpringConst unrecognized.\n" );
1814 +        return 0;
1815 +        break;
1816 +      }
1817 +      break;
1818 +
1819 +    case G_THERM_INT_OMEGA_SPRING:
1820 +      switch( the_type ){
1821 +        
1822 +      case STRING:
1823 +        the_event->err_msg =
1824 +          strdup( "Error in parsing meta-data file!\n\tthermIntOmegaSpringConst is not a double or int.\n" );
1825 +        return 1;
1826 +        break;
1827 +        
1828 +      case DOUBLE:
1829 +        therm_int_omega_spring = the_event->evt.asmt.rhs.dval;
1830 +        have_omega_spring_constant = 1;
1831 +        return 1;
1832 +        break;
1833 +        
1834 +      case INT:
1835 +        therm_int_omega_spring = (double)the_event->evt.asmt.rhs.dval;
1836 +        have_omega_spring_constant = 1;
1837 +        return 1;
1838 +        break;
1839 +        
1840 +      default:
1841 +        the_event->err_msg =
1842 +          strdup( "Error in parsing meta-data file!\n\tthermIntOmegaSpringConst unrecognized.\n" );
1843 +        return 0;
1844 +        break;
1845 +      }
1846 +      break;  
1847 +
1848 +    case G_SURFACETENSION:
1849 +        switch( the_type ){
1850 +      
1851 +        case STRING:
1852 +          the_event->err_msg =
1853 +            strdup( "Error in parsing meta-data file!\n\tsurfaceTension is not a double or int.\n" );
1854 +          return 1;
1855 +          break;
1856 +          
1857 +        case DOUBLE:
1858 +          surface_tension= the_event->evt.asmt.rhs.dval;
1859 +          have_surface_tension = 1;
1860 +          return 1;
1861 +          break;
1862 +          
1863 +        case INT:
1864 +          surface_tension = (double)the_event->evt.asmt.rhs.dval;
1865 +          have_surface_tension = 1;
1866 +          return 1;
1867 +          break;
1868 +          
1869 +        default:
1870 +          the_event->err_msg =
1871 +            strdup( "Error in parsing meta-data file!\n\tsurfaceTension unrecognized.\n" );
1872 +          return 0;
1873 +          break;
1874 +        }
1875 +        break;
1876 +
1877 +    case G_PRINTPREESURETENSOR:
1878 +          if( the_type == STRING ){
1879 +        
1880 +        if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) {
1881 +            have_print_pressure_tensor= 1;
1882 +            print_pressure_tensor = 1;
1883 +        } else if( !strcasecmp( "false", the_event->evt.asmt.rhs.sval )) {
1884 +            have_print_pressure_tensor= 1;
1885 +            print_pressure_tensor = 0;
1886 +        } else{
1887 +          the_event->err_msg =
1888 +            strdup( "Error in parsing meta-data file!\n\tprintPressureTensor was not \"true\" or \"false\".\n" );
1889 +          return 0;
1890 +        }
1891 +        return 1;
1892 +          }
1893 +          
1894 +          the_event->err_msg =
1895 +        strdup( "Error in parsing meta-data file!\n\tprintPressureTensor was not \"true\" or \"false\".\n" );
1896 +          return 0;
1897 +          break;
1898 +
1899 +        
1900 +
1901 +      
1902 +      // add more token cases here.      
1903      }
1904    }
1905    
# Line 1784 | Line 1990 | int Globals::hash( char* text ){
1990    return 1;
1991   }
1992  
1787 int Globals::hash( char* text ){
1788
1789  register unsigned short int i = 0; // loop counter
1790  int key = 0; // the hash key
1791  
1792  while( text[i] != '\0' ){
1793    
1794    key = ( ( key << hash_shift ) + text[i] ) % hash_size;
1795    
1796    i++;
1797  }
1798  
1799  if( key < 0 ){
1800
1801    // if the key is less than zero, we've had an overflow error
1802
1803    sprintf( painCave.errMsg,
1804             "There has been an overflow error in the Globals' hash key.");
1805    painCave.isFatal = 1;
1806    simError();
1807 #ifdef IS_MPI
1808    if( painCave.isEventLoop ){
1809      if( worldRank == 0 ) mpiInterfaceExit();
1810    }
1811 #endif //is_mpi
1812  }
1813  
1814  return key;
1815 }
1816
1817 void Globals::addHash( char* text, int token ){
1818
1819  int key;
1820  LinkedCommand* the_element;
1821
1822  the_element = new LinkedCommand;
1823  the_element->setValues( text, token );
1824
1825  key = hash( text );
1826
1827  the_element->setNext( command_table[key] );
1828  command_table[key] = the_element;
1829 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines