Ignore:
Timestamp:
Apr 1, 2010, 12:16:29 PM (16 years ago)
Author:
Saskia Metzler <metzler@…>
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.
Message:

Merge Till's structure refactoring

Merge commit 'till/StructureRefactoring' into StateAndFormatParser

Conflicts:

molecuilder/src/Makefile.am
molecuilder/src/unittests/Makefile.am

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/Parser/TremoloParser.cpp

    r2704e2 r0f7883  
    2020 */
    2121TremoloParser::TremoloParser() {
     22  knownKeys[" "] = noKey; // so we can detect invalid keys
    2223  knownKeys["x"] = x;
    2324  knownKeys["u"] = u;
     
    6162  while (lineStream.good()) {
    6263    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    }
    6369    usedFields.push_back(keyword);
    6470  }
     
    7480  vector<string>::iterator it;
    7581  stringstream lineStream;
     82  atom* newAtom = World::getInstance().createAtom();
     83  TremoloAtomInfoContainer atomInfo = *(new TremoloAtomInfoContainer());
     84  atomDataKey currentField;
    7685  string word;
    7786
     
    7988  for (it=usedFields.begin(); it < usedFields.end(); it++) {
    8089    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) {
    8292      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;
    85175        break;
    86176      default :
     
    90180    }
    91181  }
     182  moreData[newAtom->getId()] = atomInfo;
    92183}
    93184
     
    117208}
    118209
    119 /*
    120 #ATOMDATA  <record_entry_1> ... <record_entry_n>
    121 # <record_entry>: <dataname>[=<n>]
    122 # <dataname>    : x | u | F | stress | Id | neighbors | imprData
    123 #               | GroupMeasureTypeNo | Type | extType
    124 #               | name | resName | chainID | resSeq
    125 #               | occupancy | tempFactor | segID | Charge
    126 #               | charge
    127 ATOMDATA name Id x=3 mass charge epsilon sigma eps14 sig14 name type protein protno neighbors=4
    128 */
    129 
    130 //MatrixContainer* data = readData(fileName, getHeaderSize('#'), 0);
    131 
    132 
    133210/**
    134211 * Saves the World's current state into as a tremolo file.
     
    144221*/
    145222}
     223
     224TremoloAtomInfoContainer::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.