ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/types/ZconStamp.cpp
Revision: 1930
Committed: Wed Jan 12 22:41:40 2005 UTC (19 years, 5 months ago) by gezelter
File size: 4314 byte(s)
Log Message:
merging new_design branch into OOPSE-2.0

File Contents

# User Rev Content
1 gezelter 1930 /*
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 gezelter 1490 #include <stdio.h>
43     #include <string.h>
44    
45 tim 1492 #include "types/ZconStamp.hpp"
46 gezelter 1490
47    
48     ZconStamp::ZconStamp(int theIndex){
49     index = theIndex;
50    
51     have_zPos = 0;
52     have_molIndex = 0;
53     have_kRatio = 0;
54    
55     unhandled = NULL;
56     have_extras = 0;
57     }
58    
59     ZconStamp::~ZconStamp(){
60    
61     if( unhandled != NULL ) delete unhandled;
62     }
63    
64     char* ZconStamp::checkMe( void ){
65     char myErr[1000];
66    
67     // if( !have_zPos ){
68     // sprintf( myErr,
69     // "No zPos was given to the Zconstraint[%d].",
70     // index );
71     // return strdup( myErr );
72     // }
73    
74     if( !have_molIndex ){
75     sprintf( myErr,
76     "No Index was given to the Zconstraint[%d].",
77     index );
78     return strdup( myErr );
79     }
80    
81     return NULL;
82     }
83    
84     int ZconStamp::assignString( char* lhs, char* rhs, char** err ){
85    
86     if( unhandled == NULL ){
87     unhandled = new LinkedAssign( lhs, rhs );
88     return 1;
89     }
90     else {
91     unhandled->add( lhs, rhs );
92     have_extras = 1;
93     return 1;
94     }
95    
96     return 0;
97     }
98    
99     int ZconStamp::assignDouble( char* lhs, double rhs, char** err ){
100    
101     if( !strcasecmp( lhs, "zPos" )){
102    
103     zPos = rhs;
104     have_zPos = 1;
105     return 1;
106     }
107     else if( !strcasecmp( lhs, "kRatio" ) ){
108    
109     kRatio = rhs;
110     have_kRatio = 1;
111     return 1;
112     }
113     else if( !strcasecmp( lhs, "cantVel" )){
114    
115     cantVel = (double)rhs;
116     have_cantVel = 1;
117     return 1;
118     }
119     else if( unhandled == NULL ){
120     unhandled = new LinkedAssign( lhs, rhs );
121     return 1;
122     }
123     else {
124     unhandled->add( lhs, rhs );
125     have_extras = 1;
126     return 1;
127     }
128    
129     return 0;
130     }
131    
132     int ZconStamp::assignInt( char* lhs, int rhs, char** err ){
133    
134     if( !strcasecmp( lhs, "molIndex" ) ){
135    
136     molIndex = rhs;
137     have_molIndex = 1;
138     return 1;
139     }
140     else if( !strcasecmp( lhs, "kRatio" ) ){
141    
142     kRatio = (double)rhs;
143     have_kRatio = 1;
144     return 1;
145     }
146     else if( !strcasecmp( lhs, "zPos" )){
147    
148     zPos = (double)rhs;
149     have_zPos = 1;
150     return 1;
151     }
152     else if( !strcasecmp( lhs, "cantVel" )){
153    
154     cantVel = (double)rhs;
155     have_cantVel = 1;
156     return 1;
157     }
158     else if( unhandled == NULL ){
159     unhandled = new LinkedAssign( lhs, rhs );
160     return 1;
161     }
162     else {
163     unhandled->add( lhs, rhs );
164     have_extras = 1;
165     return 1;
166     }
167     return 0;
168     }