Changeset 0f7883 for molecuilder/src/Parser/TremoloParser.cpp
- Timestamp:
- Apr 1, 2010, 12:16:29 PM (16 years ago)
- Children:
- d3513b
- Parents:
- 2704e2 (diff), 770138 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
molecuilder/src/Parser/TremoloParser.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/Parser/TremoloParser.cpp
r2704e2 r0f7883 20 20 */ 21 21 TremoloParser::TremoloParser() { 22 knownKeys[" "] = noKey; // so we can detect invalid keys 22 23 knownKeys["x"] = x; 23 24 knownKeys["u"] = u; … … 61 62 while (lineStream.good()) { 62 63 lineStream >> keyword; 64 if (knownKeys[keyword.substr(0, keyword.find("="))] == noKey) { 65 // throw exception about unknown key 66 cout << "Unknown key: " << keyword << " is not part of the tremolo format specification." << endl; 67 break; 68 } 63 69 usedFields.push_back(keyword); 64 70 } … … 74 80 vector<string>::iterator it; 75 81 stringstream lineStream; 82 atom* newAtom = World::getInstance().createAtom(); 83 TremoloAtomInfoContainer atomInfo = *(new TremoloAtomInfoContainer()); 84 atomDataKey currentField; 76 85 string word; 77 86 … … 79 88 for (it=usedFields.begin(); it < usedFields.end(); it++) { 80 89 cout << *it << " -- " << it->substr(0, it->find("=")) << " -- " << knownKeys[it->substr(0, it->find("="))] << endl; 81 switch (knownKeys[it->substr(0, it->find("="))]) { 90 currentField = knownKeys[it->substr(0, it->find("="))]; 91 switch (currentField) { 82 92 case x : 83 lineStream >> word; 84 cout<< "Found an x: word: " << word << endl; 93 // for the moment, assume there are always three dimensions 94 lineStream >> newAtom->x.x[0]; 95 lineStream >> newAtom->x.x[1]; 96 lineStream >> newAtom->x.x[2]; 97 break; 98 case u : 99 // for the moment, assume there are always three dimensions 100 lineStream >> newAtom->v.x[0]; 101 lineStream >> newAtom->v.x[1]; 102 lineStream >> newAtom->v.x[2]; 103 break; 104 case F : 105 lineStream >> word; 106 atomInfo.F = word; 107 break; 108 case stress : 109 lineStream >> word; 110 atomInfo.F = word; 111 break; 112 case Id : 113 // this ID is not used 114 break; 115 case neighbors : 116 // TODO neighbor information 117 lineStream >> word; 118 break; 119 case imprData : 120 lineStream >> word; 121 atomInfo.imprData = word; 122 break; 123 case GroupMeasureTypeNo : 124 lineStream >> word; 125 atomInfo.GroupMeasureTypeNo = word; 126 break; 127 case Type : 128 char type[3]; 129 lineStream >> type; 130 newAtom->setType(World::getInstance().getPeriode()->FindElement(type)); 131 break; 132 case extType : 133 lineStream >> word; 134 atomInfo.extType = word; 135 break; 136 case name : 137 lineStream >> word; 138 atomInfo.name = word; 139 break; 140 case resName : 141 lineStream >> word; 142 atomInfo.resName = word; 143 break; 144 case chainID : 145 lineStream >> word; 146 atomInfo.chainID = word; 147 break; 148 case resSeq : 149 lineStream >> word; 150 atomInfo.resSeq = word; 151 break; 152 case occupancy : 153 lineStream >> word; 154 atomInfo.occupancy = word; 155 break; 156 case tempFactor : 157 lineStream >> word; 158 atomInfo.segID = word; 159 break; 160 case segID : 161 lineStream >> word; 162 atomInfo.F = word; 163 break; 164 case Charge : 165 lineStream >> word; 166 atomInfo.Charge = word; 167 break; 168 case charge : 169 lineStream >> word; 170 atomInfo.charge = word; 171 break; 172 case GrpTypeNo : 173 lineStream >> word; 174 atomInfo.GrpTypeNo = word; 85 175 break; 86 176 default : … … 90 180 } 91 181 } 182 moreData[newAtom->getId()] = atomInfo; 92 183 } 93 184 … … 117 208 } 118 209 119 /*120 #ATOMDATA <record_entry_1> ... <record_entry_n>121 # <record_entry>: <dataname>[=<n>]122 # <dataname> : x | u | F | stress | Id | neighbors | imprData123 # | GroupMeasureTypeNo | Type | extType124 # | name | resName | chainID | resSeq125 # | occupancy | tempFactor | segID | Charge126 # | charge127 ATOMDATA name Id x=3 mass charge epsilon sigma eps14 sig14 name type protein protno neighbors=4128 */129 130 //MatrixContainer* data = readData(fileName, getHeaderSize('#'), 0);131 132 133 210 /** 134 211 * Saves the World's current state into as a tremolo file. … … 144 221 */ 145 222 } 223 224 TremoloAtomInfoContainer::TremoloAtomInfoContainer() { 225 name = "none"; 226 /* Add suitable default values. 227 std::string F; 228 std::string stress; 229 std::string imprData; 230 std::string GroupMeasureTypeNo; 231 std::string extType; 232 std::string name; 233 std::string resName; 234 std::string chainID; 235 std::string resSeq; 236 std::string occupancy; 237 std::string tempFactor; 238 std::string segID; 239 std::string Charge; 240 std::string charge; 241 std::string GrpTypeNo; 242 */ 243 };
Note:
See TracChangeset
for help on using the changeset viewer.
